@camstack/types 1.1.35 → 1.1.37

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.d.ts CHANGED
@@ -30,5 +30,7 @@ export { deviceOpsCapability } from './capabilities/device-ops.cap.js';
30
30
  export { createDeviceProxy } from './generated/device-proxy.js';
31
31
  export { BaseAddon, normalizeAddonInitResult } from './addon/base-addon.js';
32
32
  export { adminUiCapability } from './capabilities/admin-ui.cap.js';
33
+ export { viewerUiCapability } from './capabilities/viewer-ui.cap.js';
33
34
  export type { IAdminUiProvider } from './capabilities/admin-ui.cap.js';
35
+ export type { IViewerUiProvider } from './capabilities/viewer-ui.cap.js';
34
36
  export type { ICamstackAddon, AddonDeclaration, AddonInitResult, ProviderRegistration, } from './interfaces/addon.js';
package/dist/addon.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_sleep = require("./sleep-DuN1nc6O.js");
2
+ const require_sleep = require("./sleep-BtS3xMHv.js");
3
3
  const require_err_msg = require("./err-msg-COpsHMw2.js");
4
4
  exports.BaseAddon = require_sleep.BaseAddon;
5
5
  exports.DATAPLANE_SECRET_HEADER = require_sleep.DATAPLANE_SECRET_HEADER;
@@ -20,3 +20,4 @@ exports.normalizeAddonInitResult = require_sleep.normalizeAddonInitResult;
20
20
  exports.parseJsonUnknown = require_sleep.parseJsonUnknown;
21
21
  exports.scopeKey = require_sleep.scopeKey;
22
22
  exports.sleep = require_sleep.sleep;
23
+ exports.viewerUiCapability = require_sleep.viewerUiCapability;
package/dist/addon.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { A as ReadinessRegistry, C as asJsonObject, O as parseJsonUnknown, P as scopeKey, T as asString, a as adminUiCapability, b as DeviceType, gt as DisposerChain, ht as EventCategory, i as deviceOpsCapability, j as ReadinessTimeoutError, k as DATAPLANE_SECRET_HEADER, o as createDeviceProxy, ot as BaseAddon, p as expandCapMethods, st as normalizeAddonInitResult, t as sleep, ut as emitReadiness } from "./sleep-DiQ8xW1M.mjs";
1
+ import { A as DATAPLANE_SECRET_HEADER, E as asString, F as scopeKey, M as ReadinessTimeoutError, a as viewerUiCapability, bt as DisposerChain, ct as normalizeAddonInitResult, dt as emitReadiness, i as deviceOpsCapability, j as ReadinessRegistry, k as parseJsonUnknown, m as expandCapMethods, o as adminUiCapability, s as createDeviceProxy, st as BaseAddon, t as sleep, w as asJsonObject, x as DeviceType, yt as EventCategory } from "./sleep-DJaTV2D7.mjs";
2
2
  import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
3
- export { BaseAddon, DATAPLANE_SECRET_HEADER, DeviceType, DisposerChain, EventCategory, ReadinessRegistry, ReadinessTimeoutError, adminUiCapability, asJsonObject, asString, createDeviceProxy, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods, normalizeAddonInitResult, parseJsonUnknown, scopeKey, sleep };
3
+ export { BaseAddon, DATAPLANE_SECRET_HEADER, DeviceType, DisposerChain, EventCategory, ReadinessRegistry, ReadinessTimeoutError, adminUiCapability, asJsonObject, asString, createDeviceProxy, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods, normalizeAddonInitResult, parseJsonUnknown, scopeKey, sleep, viewerUiCapability };
@@ -98,6 +98,7 @@ declare const WidgetMetadataSchema: z.ZodObject<{
98
98
  deviceContext: z.ZodDefault<z.ZodBoolean>;
99
99
  integrationContext: z.ZodDefault<z.ZodBoolean>;
100
100
  }, z.core.$strip>;
101
+ preAuth: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
101
102
  defaultSize: z.ZodDefault<z.ZodEnum<{
102
103
  xs: "xs";
103
104
  sm: "sm";
@@ -145,6 +146,7 @@ export declare const addonWidgetsSourceCapability: {
145
146
  deviceContext: z.ZodDefault<z.ZodBoolean>;
146
147
  integrationContext: z.ZodDefault<z.ZodBoolean>;
147
148
  }, z.core.$strip>;
149
+ preAuth: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
148
150
  defaultSize: z.ZodDefault<z.ZodEnum<{
149
151
  xs: "xs";
150
152
  sm: "sm";
@@ -40,6 +40,7 @@ declare const EnrichedWidgetMetadataSchema: z.ZodObject<{
40
40
  deviceContext: z.ZodDefault<z.ZodBoolean>;
41
41
  integrationContext: z.ZodDefault<z.ZodBoolean>;
42
42
  }, z.core.$strip>;
43
+ preAuth: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
43
44
  defaultSize: z.ZodDefault<z.ZodEnum<{
44
45
  xs: "xs";
45
46
  sm: "sm";
@@ -88,6 +89,7 @@ export declare const addonWidgetsCapability: {
88
89
  deviceContext: z.ZodDefault<z.ZodBoolean>;
89
90
  integrationContext: z.ZodDefault<z.ZodBoolean>;
90
91
  }, z.core.$strip>;
92
+ preAuth: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
91
93
  defaultSize: z.ZodDefault<z.ZodEnum<{
92
94
  xs: "xs";
93
95
  sm: "sm";
@@ -24,6 +24,8 @@ export type { IAddonWidgetsSourceProvider, WidgetMetadata } from './addon-widget
24
24
  export { addonWidgetsSourceCapability, WidgetHostEnum, WidgetMetadataSchema, WidgetRemoteSchema, WidgetSizeEnum, } from './addon-widgets-source.cap.js';
25
25
  export type { IAdminUiProvider } from './admin-ui.cap.js';
26
26
  export { adminUiCapability } from './admin-ui.cap.js';
27
+ export type { IViewerUiProvider } from './viewer-ui.cap.js';
28
+ export { viewerUiCapability } from './viewer-ui.cap.js';
27
29
  export type { IAdvancedNotifierProvider } from './advanced-notifier.cap.js';
28
30
  export { advancedNotifierCapability, NotificationHistoryEntrySchema, NotificationRuleSchema, } from './advanced-notifier.cap.js';
29
31
  export type { Alert, AlertSeverity, AlertStatus } from './alerts.cap.js';
@@ -33,6 +35,8 @@ export type { AudioAnalyzerGlobalConfig, AudioBackendChoice, IAudioAnalyzerProvi
33
35
  export { AUDIO_BACKEND_CHOICES, AudioAnalysisResultSchema, AudioAnalysisSettingsSchema, AudioClassificationResultSchema, audioAnalyzerCapability, DEFAULT_AUDIO_ANALYZER_CONFIG, } from './audio-analyzer.cap.js';
34
36
  export { AudioCodecInfoSchema, AudioDecodeSessionConfigSchema, AudioEncodedChunkSchema, AudioEncodeSessionConfigSchema, AudioPcmChunkSchema, audioCodecCapability, type IAudioCodecCapProvider, PcmSampleFormatSchema, } from './audio-codec.cap.js';
35
37
  export { AuthResultSchema, authProviderCapability } from './auth-provider.cap.js';
38
+ export { loginMethodCapability, LoginStageEnum, RedirectLoginMethodSchema, WidgetLoginMethodSchema, LoginMethodContributionSchema, } from './login-method.cap.js';
39
+ export type { ILoginMethodProvider, LoginMethodContribution, RedirectLoginMethod, WidgetLoginMethod, LoginStage, } from './login-method.cap.js';
36
40
  export { ArchiveEntrySchema, ArchiveManifestSchema, BackupDestinationInfoSchema, BackupEntrySchema, backupCapability, type IBackupProvider, LocationStatSchema, } from './backup.cap.js';
37
41
  export { BrokerAddInputSchema, BrokerGetStateInputSchema, type BrokerInfo as UnifiedBrokerInfo, BrokerInfoSchema as UnifiedBrokerInfoSchema, type BrokerProviderInfo, BrokerProviderInfoSchema, BrokerPublishInputSchema, BrokerRegistryStatusSchema, type BrokerStatus as UnifiedBrokerStatus, BrokerStatusEnum, BrokerSubscribeInputSchema, BrokerSubscribeResultSchema, BrokerTestConnectionResultSchema, BrokerUnsubscribeInputSchema, brokerCapability, type IBrokerProvider, } from './broker.cap.js';
38
42
  export { cameraPipelineConfigCapability, type ICameraPipelineConfigProvider, } from './camera-pipeline-config.cap.js';
@@ -81,6 +85,7 @@ export { AudioChunkInputSchema, AudioClassificationLabelSchema, AudioLevelSchema
81
85
  export { CameraMetricsSchema, CameraMetricsWithDeviceIdSchema, OrchestratorMetricsSchema, } from './schemas/orchestrator-metrics.js';
82
86
  export type { CameraStream, CamProfile, CamStreamKind, DecodedAudioChunkWire, FrameHandleFormat, ProfileRtspEntry, ProfileSlot, ProfileSlotStatus, SubscribeAudioChunksInput, SubscribeAudioChunksResult, SubscribeFramesInput, SubscribeFramesResult, } from './schemas/streaming-shared.js';
83
87
  export { BrokerStatsSchema, BrokerStatusSchema, CAM_PROFILE_ORDER, CameraStreamSchema, CamProfileSchema, CamStreamKindSchema, CamStreamResolutionSchema, DecodedAudioChunkSchema, DecodedFrameSchema, EncodedPacketSchema, FrameHandleFormatSchema, FrameHandleSchema, makeProfileBrokerId, makeSourceBrokerId, ProfileRtspEntrySchema, ProfileSlotSchema, ProfileSlotStatusSchema, parseProfileBrokerId, StreamSourceEntrySchema, StreamSourceSchema, SubscribeAudioChunksInputSchema, SubscribeAudioChunksResultSchema, SubscribeFramesInputSchema, SubscribeFramesResultSchema, selectAssignedProfileSlots, } from './schemas/streaming-shared.js';
88
+ export { type IServerManagementProvider, type ServerBootMode, ServerBootModeSchema, serverManagementCapability, type ServerPackageStatus, ServerPackageStatusSchema, type ServerRollbackInfo, ServerRollbackInfoSchema, type ServerUpdateActionResult, ServerUpdateActionResultSchema, type ServerUpdateCheckResult, ServerUpdateCheckResultSchema, type ServerUpdateState, ServerUpdateStateSchema, } from './server-management.cap.js';
84
89
  export { type CollectionColumn, CollectionColumnSchema, type CollectionIndex, CollectionIndexSchema, type ISettingsStoreProvider, QueryFilterSchema, SettingsRecordSchema, type SettingsStoreClient, settingsStoreCapability, } from './settings-store.cap.js';
85
90
  export type { ISmtpProvider } from './smtp-provider.cap.js';
86
91
  export { SendEmailInputSchema, SendEmailResultSchema, SmtpStatusSchema, smtpProviderCapability, } from './smtp-provider.cap.js';
@@ -194,6 +199,7 @@ import type { addonWidgetsCapability } from './addon-widgets.cap.js';
194
199
  import type { addonWidgetsSourceCapability } from './addon-widgets-source.cap.js';
195
200
  import type { addonsCapability } from './addons.cap.js';
196
201
  import type { adminUiCapability } from './admin-ui.cap.js';
202
+ import type { viewerUiCapability } from './viewer-ui.cap.js';
197
203
  import type { advancedNotifierCapability } from './advanced-notifier.cap.js';
198
204
  import type { airQualitySensorCapability } from './air-quality-sensor.cap.js';
199
205
  import type { alarmPanelCapability } from './alarm-panel.cap.js';
@@ -204,6 +210,7 @@ import type { audioAnalyzerCapability } from './audio-analyzer.cap.js';
204
210
  import type { audioCodecCapability } from './audio-codec.cap.js';
205
211
  import type { audioMetricsCapability } from './audio-metrics.cap.js';
206
212
  import type { authProviderCapability } from './auth-provider.cap.js';
213
+ import type { loginMethodCapability } from './login-method.cap.js';
207
214
  import type { automationControlCapability } from './automation-control.cap.js';
208
215
  import type { backupCapability } from './backup.cap.js';
209
216
  import type { binaryCapability } from './binary.cap.js';
@@ -278,6 +285,7 @@ import type { ptzAutotrackCapability } from './ptz-autotrack.cap.js';
278
285
  import type { rebootCapability } from './reboot.cap.js';
279
286
  import type { recordingCapability } from './recording.cap.js';
280
287
  import type { scriptRunnerCapability } from './script-runner.cap.js';
288
+ import type { serverManagementCapability } from './server-management.cap.js';
281
289
  import type { settingsStoreCapability } from './settings-store.cap.js';
282
290
  import type { smokeCapability } from './smoke.cap.js';
283
291
  import type { smtpProviderCapability } from './smtp-provider.cap.js';
@@ -305,6 +313,6 @@ import type { webrtcSessionCapability } from './webrtc-session.cap.js';
305
313
  import type { zoneAnalyticsCapability } from './zone-analytics.cap.js';
306
314
  import type { zoneRulesCapability } from './zone-rules.cap.js';
307
315
  import type { zonesCapability } from './zones.cap.js';
308
- type AnyCapability = typeof addonSettingsCapability | typeof alertsCapability | typeof storageCapability | typeof storageProviderCapability | typeof storageEvictableCapability | typeof filesystemBrowseCapability | typeof backupCapability | typeof settingsStoreCapability | typeof logDestinationCapability | typeof adminUiCapability | typeof ssoBridgeCapability | typeof userPasskeysCapability | typeof smtpProviderCapability | typeof mqttBrokerCapability | typeof brokerCapability | typeof deviceAdoptionCapability | typeof deviceExportCapability | typeof addonPagesCapability | typeof addonPagesSourceCapability | typeof addonWidgetsCapability | typeof addonWidgetsSourceCapability | typeof customModelRegistryCapability | typeof modelDistributorCapability | typeof modelConvertCapability | typeof addonRoutesCapability | typeof streamBrokerCapability | typeof decoderCapability | typeof webrtcSessionCapability | typeof cameraStreamsCapability | typeof motionDetectionCapability | typeof pipelineExecutorCapability | typeof detectionPipelineCapability | typeof cameraPipelineConfigCapability | typeof pipelineRunnerCapability | typeof pipelineOrchestratorCapability | typeof audioAnalyzerCapability | typeof audioAnalysisCapability | typeof audioCodecCapability | typeof embeddingEncoderCapability | typeof deviceProviderCapability | typeof deviceManagerCapability | typeof deviceStateCapability | typeof authProviderCapability | typeof networkAccessCapability | typeof turnProviderCapability | typeof snapshotCapability | typeof notificationOutputCapability | typeof advancedNotifierCapability | typeof pipelineAnalyticsCapability | typeof metricsProviderCapability | typeof ptzCapability | typeof ptzAutotrackCapability | typeof consumablesCapability | typeof rebootCapability | typeof deviceDiscoveryCapability | typeof brightnessCapability | typeof colorCapability | typeof climateControlCapability | typeof coverCapability | typeof valveCapability | typeof humidifierCapability | typeof waterHeaterCapability | typeof weatherCapability | typeof imageCapability | typeof lockControlCapability | typeof vacuumControlCapability | typeof petFeederCapability | typeof lawnMowerControlCapability | typeof fanControlCapability | typeof controlCapability | typeof notifierCapability | typeof mediaPlayerCapability | typeof alarmPanelCapability | typeof presenceCapability | typeof scriptRunnerCapability | typeof automationControlCapability | typeof motionTriggerCapability | typeof eventsCapability | typeof zonesCapability | typeof zoneRulesCapability | typeof zoneAnalyticsCapability | typeof audioMetricsCapability | typeof motionCapability | typeof contactCapability | typeof floodCapability | typeof smokeCapability | typeof carbonMonoxideCapability | typeof gasCapability | typeof tamperCapability | typeof vibrationCapability | typeof connectivityCapability | typeof binaryCapability | typeof temperatureSensorCapability | typeof humiditySensorCapability | typeof ambientLightSensorCapability | typeof pressureSensorCapability | typeof powerMeterCapability | typeof airQualitySensorCapability | typeof numericSensorCapability | typeof enumSensorCapability | typeof recordingCapability | typeof deviceOpsCapability | typeof platformProbeCapability | typeof localNetworkCapability | typeof meshNetworkCapability | typeof userManagementCapability | typeof systemCapability | typeof networkQualityCapability | typeof toastCapability | typeof nodesCapability | typeof integrationsCapability | typeof addonsCapability | typeof oauthIntegrationCapability | typeof streamParamsCapability | typeof streamCatalogCapability | typeof motionZonesCapability | typeof privacyMaskCapability | typeof dayNightCapability | typeof imageSettingsCapability;
316
+ type AnyCapability = typeof addonSettingsCapability | typeof alertsCapability | typeof storageCapability | typeof storageProviderCapability | typeof storageEvictableCapability | typeof filesystemBrowseCapability | typeof backupCapability | typeof settingsStoreCapability | typeof logDestinationCapability | typeof adminUiCapability | typeof viewerUiCapability | typeof ssoBridgeCapability | typeof userPasskeysCapability | typeof smtpProviderCapability | typeof mqttBrokerCapability | typeof brokerCapability | typeof deviceAdoptionCapability | typeof deviceExportCapability | typeof addonPagesCapability | typeof addonPagesSourceCapability | typeof addonWidgetsCapability | typeof addonWidgetsSourceCapability | typeof customModelRegistryCapability | typeof modelDistributorCapability | typeof modelConvertCapability | typeof addonRoutesCapability | typeof streamBrokerCapability | typeof decoderCapability | typeof webrtcSessionCapability | typeof cameraStreamsCapability | typeof motionDetectionCapability | typeof pipelineExecutorCapability | typeof detectionPipelineCapability | typeof cameraPipelineConfigCapability | typeof pipelineRunnerCapability | typeof pipelineOrchestratorCapability | typeof audioAnalyzerCapability | typeof audioAnalysisCapability | typeof audioCodecCapability | typeof embeddingEncoderCapability | typeof deviceProviderCapability | typeof deviceManagerCapability | typeof deviceStateCapability | typeof authProviderCapability | typeof loginMethodCapability | typeof networkAccessCapability | typeof turnProviderCapability | typeof snapshotCapability | typeof notificationOutputCapability | typeof advancedNotifierCapability | typeof pipelineAnalyticsCapability | typeof metricsProviderCapability | typeof ptzCapability | typeof ptzAutotrackCapability | typeof consumablesCapability | typeof rebootCapability | typeof deviceDiscoveryCapability | typeof brightnessCapability | typeof colorCapability | typeof climateControlCapability | typeof coverCapability | typeof valveCapability | typeof humidifierCapability | typeof waterHeaterCapability | typeof weatherCapability | typeof imageCapability | typeof lockControlCapability | typeof vacuumControlCapability | typeof petFeederCapability | typeof lawnMowerControlCapability | typeof fanControlCapability | typeof controlCapability | typeof notifierCapability | typeof mediaPlayerCapability | typeof alarmPanelCapability | typeof presenceCapability | typeof scriptRunnerCapability | typeof automationControlCapability | typeof motionTriggerCapability | typeof eventsCapability | typeof zonesCapability | typeof zoneRulesCapability | typeof zoneAnalyticsCapability | typeof audioMetricsCapability | typeof motionCapability | typeof contactCapability | typeof floodCapability | typeof smokeCapability | typeof carbonMonoxideCapability | typeof gasCapability | typeof tamperCapability | typeof vibrationCapability | typeof connectivityCapability | typeof binaryCapability | typeof temperatureSensorCapability | typeof humiditySensorCapability | typeof ambientLightSensorCapability | typeof pressureSensorCapability | typeof powerMeterCapability | typeof airQualitySensorCapability | typeof numericSensorCapability | typeof enumSensorCapability | typeof recordingCapability | typeof deviceOpsCapability | typeof platformProbeCapability | typeof localNetworkCapability | typeof meshNetworkCapability | typeof userManagementCapability | typeof systemCapability | typeof networkQualityCapability | typeof toastCapability | typeof nodesCapability | typeof serverManagementCapability | typeof integrationsCapability | typeof addonsCapability | typeof oauthIntegrationCapability | typeof streamParamsCapability | typeof streamCatalogCapability | typeof motionZonesCapability | typeof privacyMaskCapability | typeof dayNightCapability | typeof imageSettingsCapability;
309
317
  export type CapabilityName = AnyCapability['name'];
310
318
  export type ITypedReadinessRegistry = IReadinessRegistry<CapabilityName>;
@@ -0,0 +1,146 @@
1
+ import { z } from 'zod';
2
+ import { type InferProvider } from './capability-definition.js';
3
+ /**
4
+ * `login-method` — collection cap through which auth addons contribute
5
+ * their pre-auth login surfaces to the login page. This is the SINGLE,
6
+ * generic mechanism that supersedes the dead `auth.listProviders` reader:
7
+ * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
8
+ * `login-method` provider and the PUBLIC `auth.listLoginMethods`
9
+ * procedure aggregates them for the unauthenticated login page.
10
+ *
11
+ * A contribution is a discriminated union on `kind`:
12
+ *
13
+ * - `redirect` — a declarative button. The login page renders a generic
14
+ * button that navigates to `startUrl` (an addon-owned HTTP route).
15
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
16
+ * ZERO shell-side JS. A future SSO addon plugs in the same way — the
17
+ * login page needs NO change.
18
+ *
19
+ * - `widget` — a Module-Federation widget the login page mounts (via
20
+ * `loadRemoteBundle`) for an in-page ceremony. Covers the passkey
21
+ * login ceremony, which must run `@simplewebauthn/browser` INSIDE the
22
+ * addon bundle. The referenced widget also declares `preAuth: true` in
23
+ * its `addon-widgets-source` catalog entry. `auth.listLoginMethods`
24
+ * stamps a public `bundleUrl` from `addonId` + `bundle`.
25
+ *
26
+ * Every contribution carries a `stage`:
27
+ * - `primary` — shown on the first credentials screen (OIDC /
28
+ * magic-link buttons; a future usernameless passkey).
29
+ * - `second-factor` — shown AFTER the password leg, gated on the
30
+ * returned `factors` (passkey-as-2FA today).
31
+ *
32
+ * `mount: skip` — the cap is read server-side by the core auth router
33
+ * (`registry.getCollection('login-method')`), never mounted as its own
34
+ * tRPC router.
35
+ */
36
+ /** When a login method renders in the two-phase login flow. */
37
+ export declare const LoginStageEnum: z.ZodEnum<{
38
+ primary: "primary";
39
+ "second-factor": "second-factor";
40
+ }>;
41
+ /**
42
+ * A declarative redirect button — the login page navigates to `startUrl`.
43
+ * OIDC and magic-link contribute this; a future SSO addon does too.
44
+ */
45
+ export declare const RedirectLoginMethodSchema: z.ZodObject<{
46
+ kind: z.ZodLiteral<"redirect">;
47
+ id: z.ZodString;
48
+ label: z.ZodString;
49
+ icon: z.ZodOptional<z.ZodString>;
50
+ startUrl: z.ZodString;
51
+ stage: z.ZodEnum<{
52
+ primary: "primary";
53
+ "second-factor": "second-factor";
54
+ }>;
55
+ }, z.core.$strip>;
56
+ /**
57
+ * A Module-Federation widget the login page mounts for an in-page
58
+ * ceremony. `bundle` + `addonId` let `auth.listLoginMethods` stamp a
59
+ * public `bundleUrl`; `remote` is the MF descriptor `loadRemoteBundle`
60
+ * consumes. No `bundleUrl` here — it is server-stamped on the public
61
+ * output so the addon never encodes the static-route scheme.
62
+ */
63
+ export declare const WidgetLoginMethodSchema: z.ZodObject<{
64
+ kind: z.ZodLiteral<"widget">;
65
+ id: z.ZodString;
66
+ addonId: z.ZodString;
67
+ bundle: z.ZodString;
68
+ remote: z.ZodObject<{
69
+ remoteName: z.ZodString;
70
+ exposedModule: z.ZodString;
71
+ componentKey: z.ZodOptional<z.ZodString>;
72
+ }, z.core.$strip>;
73
+ stage: z.ZodEnum<{
74
+ primary: "primary";
75
+ "second-factor": "second-factor";
76
+ }>;
77
+ }, z.core.$strip>;
78
+ /** One login-method contribution — redirect button OR pre-auth widget. */
79
+ export declare const LoginMethodContributionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
80
+ kind: z.ZodLiteral<"redirect">;
81
+ id: z.ZodString;
82
+ label: z.ZodString;
83
+ icon: z.ZodOptional<z.ZodString>;
84
+ startUrl: z.ZodString;
85
+ stage: z.ZodEnum<{
86
+ primary: "primary";
87
+ "second-factor": "second-factor";
88
+ }>;
89
+ }, z.core.$strip>, z.ZodObject<{
90
+ kind: z.ZodLiteral<"widget">;
91
+ id: z.ZodString;
92
+ addonId: z.ZodString;
93
+ bundle: z.ZodString;
94
+ remote: z.ZodObject<{
95
+ remoteName: z.ZodString;
96
+ exposedModule: z.ZodString;
97
+ componentKey: z.ZodOptional<z.ZodString>;
98
+ }, z.core.$strip>;
99
+ stage: z.ZodEnum<{
100
+ primary: "primary";
101
+ "second-factor": "second-factor";
102
+ }>;
103
+ }, z.core.$strip>], "kind">;
104
+ export declare const loginMethodCapability: {
105
+ readonly name: "login-method";
106
+ readonly scope: "system";
107
+ readonly mode: "collection";
108
+ readonly internal: true;
109
+ readonly methods: {
110
+ readonly getLoginMethods: import("./capability-definition.js").CapabilityMethodSchema<z.ZodVoid, z.ZodReadonly<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
111
+ kind: z.ZodLiteral<"redirect">;
112
+ id: z.ZodString;
113
+ label: z.ZodString;
114
+ icon: z.ZodOptional<z.ZodString>;
115
+ startUrl: z.ZodString;
116
+ stage: z.ZodEnum<{
117
+ primary: "primary";
118
+ "second-factor": "second-factor";
119
+ }>;
120
+ }, z.core.$strip>, z.ZodObject<{
121
+ kind: z.ZodLiteral<"widget">;
122
+ id: z.ZodString;
123
+ addonId: z.ZodString;
124
+ bundle: z.ZodString;
125
+ remote: z.ZodObject<{
126
+ remoteName: z.ZodString;
127
+ exposedModule: z.ZodString;
128
+ componentKey: z.ZodOptional<z.ZodString>;
129
+ }, z.core.$strip>;
130
+ stage: z.ZodEnum<{
131
+ primary: "primary";
132
+ "second-factor": "second-factor";
133
+ }>;
134
+ }, z.core.$strip>], "kind">>>, import("./capability-definition.js").CapabilityMethodKind>;
135
+ };
136
+ /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
137
+ readonly mount: {
138
+ readonly kind: "skip";
139
+ };
140
+ };
141
+ export type ILoginMethodProvider = InferProvider<typeof loginMethodCapability>;
142
+ /** A single login-method contribution (redirect | widget). */
143
+ export type LoginMethodContribution = z.infer<typeof LoginMethodContributionSchema>;
144
+ export type RedirectLoginMethod = z.infer<typeof RedirectLoginMethodSchema>;
145
+ export type WidgetLoginMethod = z.infer<typeof WidgetLoginMethodSchema>;
146
+ export type LoginStage = z.infer<typeof LoginStageEnum>;
@@ -32,6 +32,16 @@ declare const TopologyProcessSchema: z.ZodObject<{
32
32
  }, z.core.$strip>>>;
33
33
  groupId: z.ZodOptional<z.ZodString>;
34
34
  }, z.core.$strip>;
35
+ /**
36
+ * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
37
+ * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
38
+ * version visibility for the Server management surface. Nullable: offline
39
+ * rows and pre-phase-2 nodes report none.
40
+ */
41
+ declare const TopologyRootPackageSchema: z.ZodObject<{
42
+ name: z.ZodString;
43
+ version: z.ZodString;
44
+ }, z.core.$strip>;
35
45
  declare const TopologyNodeSchema: z.ZodObject<{
36
46
  id: z.ZodString;
37
47
  name: z.ZodString;
@@ -79,6 +89,10 @@ declare const TopologyNodeSchema: z.ZodObject<{
79
89
  memoryRss: z.ZodNumber;
80
90
  }, z.core.$strip>>>;
81
91
  }, z.core.$strip>>>;
92
+ rootPackage: z.ZodNullable<z.ZodObject<{
93
+ name: z.ZodString;
94
+ version: z.ZodString;
95
+ }, z.core.$strip>>;
82
96
  }, z.core.$strip>;
83
97
  declare const ClusterAddonNodeDeploymentSchema: z.ZodObject<{
84
98
  nodeId: z.ZodString;
@@ -168,6 +182,10 @@ export declare const nodesCapability: {
168
182
  memoryRss: z.ZodNumber;
169
183
  }, z.core.$strip>>>;
170
184
  }, z.core.$strip>>>;
185
+ rootPackage: z.ZodNullable<z.ZodObject<{
186
+ name: z.ZodString;
187
+ version: z.ZodString;
188
+ }, z.core.$strip>>;
171
189
  }, z.core.$strip>>>, import("./capability-definition.js").CapabilityMethodKind>;
172
190
  readonly deployAddon: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
173
191
  nodeId: z.ZodString;
@@ -266,4 +284,4 @@ export declare const nodesCapability: {
266
284
  };
267
285
  };
268
286
  export type INodesProvider = InferProvider<typeof nodesCapability>;
269
- export { TopologyNodeSchema, TopologyProcessSchema, TopologyServiceSchema, ClusterAddonStatusEntrySchema, ClusterAddonNodeDeploymentSchema, NodeAddonEntrySchema, };
287
+ export { TopologyNodeSchema, TopologyProcessSchema, TopologyRootPackageSchema, TopologyServiceSchema, ClusterAddonStatusEntrySchema, ClusterAddonNodeDeploymentSchema, NodeAddonEntrySchema, };
@@ -0,0 +1,194 @@
1
+ import { z } from 'zod';
2
+ import { type InferProvider } from './capability-definition.js';
3
+ /**
4
+ * server-management — per-NODE singleton capability for a node's ROOT
5
+ * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
6
+ * agents).
7
+ *
8
+ * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
9
+ * on agents) carries the whole software stack in its npm dep tree, so ONE
10
+ * version describes the node. Updates install into
11
+ * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
12
+ * starter (probation boot + auto-rollback to N-1).
13
+ *
14
+ * Providers:
15
+ * - HUB: `ServerUpdateService` behind the `server-provided` mount
16
+ * (`buildServerProviders` in trpc.router.ts) — the default target for
17
+ * unpinned calls.
18
+ * - AGENT: `AgentUpdateService` registered by the agent bootstrap under
19
+ * the synthetic `agent-runtime` addonId and declared in the agent's
20
+ * `$hub.registerNode` manifest.
21
+ *
22
+ * Node routing: singleton caps get the codegen/runtime-builder `nodeId`
23
+ * injection on every method — `input.nodeId` (or `nodePin(nodeId)` from the
24
+ * SDK) routes the call to that node's provider via the standard remote
25
+ * proxy (`createCapabilityProxy` → `$agent-cap-fwd` → the agent's
26
+ * in-process provider lookup). No `nodeId` → the hub's own provider.
27
+ *
28
+ * Spec: docs/superpowers/specs/2026-07-12-runtime-updatable-node-packages-design.md
29
+ */
30
+ /**
31
+ * Where the running hub's code was loaded from:
32
+ * - `workspace` — dev checkout (tsx / workspace dist); the starter defers to
33
+ * plain resolution and runtime updates are refused.
34
+ * - `baked` — the immutable image seed closure (no data-dir root active).
35
+ * - `data-root` — the runtime-updatable `<dataDir>/server-root` closure.
36
+ */
37
+ declare const ServerBootModeSchema: z.ZodEnum<{
38
+ workspace: "workspace";
39
+ baked: "baked";
40
+ "data-root": "data-root";
41
+ }>;
42
+ /**
43
+ * Update lifecycle state:
44
+ * - `idle` / `checking` / `staging` — steady / in-flight registry work.
45
+ * - `pending-restart` — a version is staged and the node has NOT yet
46
+ * restarted onto it (still running the OLD version).
47
+ * - `awaiting-confirmation` — the node HAS restarted onto the staged version
48
+ * (it is the active probation boot) and is waiting to confirm boot-health.
49
+ * Apply/rollback are refused in this state and the node must NOT be
50
+ * manually restarted, or the probation boot auto-rolls-back.
51
+ */
52
+ declare const ServerUpdateStateSchema: z.ZodEnum<{
53
+ idle: "idle";
54
+ checking: "checking";
55
+ staging: "staging";
56
+ "pending-restart": "pending-restart";
57
+ "awaiting-confirmation": "awaiting-confirmation";
58
+ }>;
59
+ declare const ServerRollbackInfoSchema: z.ZodObject<{
60
+ fromVersion: z.ZodString;
61
+ toVersion: z.ZodNullable<z.ZodString>;
62
+ atMs: z.ZodNumber;
63
+ reason: z.ZodString;
64
+ }, z.core.$strip>;
65
+ declare const ServerPackageStatusSchema: z.ZodObject<{
66
+ packageName: z.ZodString;
67
+ runningVersion: z.ZodNullable<z.ZodString>;
68
+ nodeRuntimeVersion: z.ZodNullable<z.ZodString>;
69
+ activeVersion: z.ZodNullable<z.ZodString>;
70
+ previousVersion: z.ZodNullable<z.ZodString>;
71
+ seedVersion: z.ZodNullable<z.ZodString>;
72
+ latestVersion: z.ZodNullable<z.ZodString>;
73
+ updateAvailable: z.ZodBoolean;
74
+ bootMode: z.ZodEnum<{
75
+ workspace: "workspace";
76
+ baked: "baked";
77
+ "data-root": "data-root";
78
+ }>;
79
+ updateState: z.ZodEnum<{
80
+ idle: "idle";
81
+ checking: "checking";
82
+ staging: "staging";
83
+ "pending-restart": "pending-restart";
84
+ "awaiting-confirmation": "awaiting-confirmation";
85
+ }>;
86
+ pendingVersion: z.ZodNullable<z.ZodString>;
87
+ rolledBack: z.ZodNullable<z.ZodObject<{
88
+ fromVersion: z.ZodString;
89
+ toVersion: z.ZodNullable<z.ZodString>;
90
+ atMs: z.ZodNumber;
91
+ reason: z.ZodString;
92
+ }, z.core.$strip>>;
93
+ stateFileCorrupt: z.ZodBoolean;
94
+ lastCheckedAtMs: z.ZodNullable<z.ZodNumber>;
95
+ }, z.core.$strip>;
96
+ declare const ServerUpdateCheckResultSchema: z.ZodObject<{
97
+ packageName: z.ZodString;
98
+ runningVersion: z.ZodNullable<z.ZodString>;
99
+ latestVersion: z.ZodNullable<z.ZodString>;
100
+ updateAvailable: z.ZodBoolean;
101
+ checkedAtMs: z.ZodNumber;
102
+ error: z.ZodNullable<z.ZodString>;
103
+ }, z.core.$strip>;
104
+ declare const ServerUpdateActionResultSchema: z.ZodObject<{
105
+ accepted: z.ZodBoolean;
106
+ targetVersion: z.ZodNullable<z.ZodString>;
107
+ restarting: z.ZodBoolean;
108
+ message: z.ZodString;
109
+ }, z.core.$strip>;
110
+ export declare const serverManagementCapability: {
111
+ readonly name: "server-management";
112
+ readonly scope: "system";
113
+ readonly mode: "singleton";
114
+ readonly methods: {
115
+ readonly getServerPackageStatus: import("./capability-definition.js").CapabilityMethodSchema<z.ZodVoid, z.ZodObject<{
116
+ packageName: z.ZodString;
117
+ runningVersion: z.ZodNullable<z.ZodString>;
118
+ nodeRuntimeVersion: z.ZodNullable<z.ZodString>;
119
+ activeVersion: z.ZodNullable<z.ZodString>;
120
+ previousVersion: z.ZodNullable<z.ZodString>;
121
+ seedVersion: z.ZodNullable<z.ZodString>;
122
+ latestVersion: z.ZodNullable<z.ZodString>;
123
+ updateAvailable: z.ZodBoolean;
124
+ bootMode: z.ZodEnum<{
125
+ workspace: "workspace";
126
+ baked: "baked";
127
+ "data-root": "data-root";
128
+ }>;
129
+ updateState: z.ZodEnum<{
130
+ idle: "idle";
131
+ checking: "checking";
132
+ staging: "staging";
133
+ "pending-restart": "pending-restart";
134
+ "awaiting-confirmation": "awaiting-confirmation";
135
+ }>;
136
+ pendingVersion: z.ZodNullable<z.ZodString>;
137
+ rolledBack: z.ZodNullable<z.ZodObject<{
138
+ fromVersion: z.ZodString;
139
+ toVersion: z.ZodNullable<z.ZodString>;
140
+ atMs: z.ZodNumber;
141
+ reason: z.ZodString;
142
+ }, z.core.$strip>>;
143
+ stateFileCorrupt: z.ZodBoolean;
144
+ lastCheckedAtMs: z.ZodNullable<z.ZodNumber>;
145
+ }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
146
+ readonly checkServerUpdate: import("./capability-definition.js").CapabilityMethodSchema<z.ZodVoid, z.ZodObject<{
147
+ packageName: z.ZodString;
148
+ runningVersion: z.ZodNullable<z.ZodString>;
149
+ latestVersion: z.ZodNullable<z.ZodString>;
150
+ updateAvailable: z.ZodBoolean;
151
+ checkedAtMs: z.ZodNumber;
152
+ error: z.ZodNullable<z.ZodString>;
153
+ }, z.core.$strip>, "mutation">;
154
+ readonly applyServerUpdate: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
155
+ version: z.ZodOptional<z.ZodString>;
156
+ }, z.core.$strip>, z.ZodObject<{
157
+ accepted: z.ZodBoolean;
158
+ targetVersion: z.ZodNullable<z.ZodString>;
159
+ restarting: z.ZodBoolean;
160
+ message: z.ZodString;
161
+ }, z.core.$strip>, "mutation">;
162
+ readonly rollbackServerUpdate: import("./capability-definition.js").CapabilityMethodSchema<z.ZodVoid, z.ZodObject<{
163
+ accepted: z.ZodBoolean;
164
+ targetVersion: z.ZodNullable<z.ZodString>;
165
+ restarting: z.ZodBoolean;
166
+ message: z.ZodString;
167
+ }, z.core.$strip>, "mutation">;
168
+ /**
169
+ * Plain process restart of the node's root process — no version change.
170
+ * The supervisor (docker restart policy / launchd / Electron main)
171
+ * relaunches and the starter loads the SAME active version. Refused while
172
+ * a stage is in flight or a version is already staged awaiting restart
173
+ * (use apply/rollback instead, so the pending version is not skipped).
174
+ */
175
+ readonly restartServer: import("./capability-definition.js").CapabilityMethodSchema<z.ZodVoid, z.ZodObject<{
176
+ accepted: z.ZodBoolean;
177
+ targetVersion: z.ZodNullable<z.ZodString>;
178
+ restarting: z.ZodBoolean;
179
+ message: z.ZodString;
180
+ }, z.core.$strip>, "mutation">;
181
+ };
182
+ /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
183
+ readonly mount: {
184
+ readonly kind: "server-provided";
185
+ };
186
+ };
187
+ export type IServerManagementProvider = InferProvider<typeof serverManagementCapability>;
188
+ export type ServerBootMode = z.infer<typeof ServerBootModeSchema>;
189
+ export type ServerUpdateState = z.infer<typeof ServerUpdateStateSchema>;
190
+ export type ServerRollbackInfo = z.infer<typeof ServerRollbackInfoSchema>;
191
+ export type ServerPackageStatus = z.infer<typeof ServerPackageStatusSchema>;
192
+ export type ServerUpdateCheckResult = z.infer<typeof ServerUpdateCheckResultSchema>;
193
+ export type ServerUpdateActionResult = z.infer<typeof ServerUpdateActionResultSchema>;
194
+ export { ServerBootModeSchema, ServerUpdateStateSchema, ServerRollbackInfoSchema, ServerPackageStatusSchema, ServerUpdateCheckResultSchema, ServerUpdateActionResultSchema, };
@@ -23,6 +23,19 @@ import { type InferProvider } from './capability-definition.js';
23
23
  * b. `finishAuthentication({userId, response})` → server verifies
24
24
  * the assertion, bumps the credential counter, returns ok.
25
25
  *
26
+ * 2b. Usernameless (discoverable-credential) authentication — the
27
+ * passkey IS the primary factor, no password leg:
28
+ * a. `beginDiscoverableAuthentication({})` → assertion options with
29
+ * EMPTY `allowCredentials` (the browser offers every resident
30
+ * passkey it holds for this RP) + `userVerification: 'required'`
31
+ * (the passkey replaces both factors, so UV is mandatory).
32
+ * The challenge is stored server-side, NOT bound to any user.
33
+ * b. `finishDiscoverableAuthentication({response})` → the provider
34
+ * resolves the credential by the response's credential id,
35
+ * verifies the assertion against the stored challenge + that
36
+ * credential's public key/counter, and returns the OWNING
37
+ * `userId` — the caller (core auth router) mints the session.
38
+ *
26
39
  * 3. Management:
27
40
  * - `listPasskeys({userId})` — enumerate user's enrolled credentials.
28
41
  * - `removePasskey({userId, credentialId})` — revoke one credential.
@@ -70,6 +83,15 @@ export declare const userPasskeysCapability: {
70
83
  }, z.core.$strip>, z.ZodObject<{
71
84
  verified: z.ZodBoolean;
72
85
  }, z.core.$strip>, "mutation">;
86
+ readonly beginDiscoverableAuthentication: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
87
+ optionsJSON: z.ZodRecord<z.ZodString, z.ZodUnknown>;
88
+ }, z.core.$strip>, "mutation">;
89
+ readonly finishDiscoverableAuthentication: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
90
+ response: z.ZodRecord<z.ZodString, z.ZodUnknown>;
91
+ }, z.core.$strip>, z.ZodObject<{
92
+ verified: z.ZodBoolean;
93
+ userId: z.ZodNullable<z.ZodString>;
94
+ }, z.core.$strip>, "mutation">;
73
95
  readonly listPasskeys: import("./capability-definition.js").CapabilityMethodSchema<z.ZodObject<{
74
96
  userId: z.ZodString;
75
97
  }, z.core.$strip>, z.ZodArray<z.ZodObject<{
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ import { type InferProvider } from './capability-definition.js';
3
+ /**
4
+ * viewer-ui — serves the CamStack VIEWER web build (the Expo/React-Native
5
+ * universal client's PWA export) from the hub, alongside admin-ui. Mirrors
6
+ * `admin-ui` exactly: a singleton, server-internal cap exposing the static
7
+ * dist directory + build version so `main.ts` can mount the SPA under a
8
+ * dedicated prefix.
9
+ */
10
+ export declare const viewerUiCapability: {
11
+ readonly name: "viewer-ui";
12
+ readonly scope: "system";
13
+ readonly mode: "singleton";
14
+ readonly internal: true;
15
+ readonly methods: {
16
+ readonly getStaticDir: import("./capability-definition.js").CapabilityMethodSchema<z.ZodVoid, z.ZodObject<{
17
+ staticDir: z.ZodString;
18
+ }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
19
+ readonly getVersion: import("./capability-definition.js").CapabilityMethodSchema<z.ZodVoid, z.ZodObject<{
20
+ version: z.ZodString;
21
+ }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
22
+ };
23
+ };
24
+ export type IViewerUiProvider = InferProvider<typeof viewerUiCapability>;