@camstack/addon-auth 1.1.1 → 1.1.3

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 (21) hide show
  1. package/dist/{dist-JmuFs-U5.mjs → dist-mmJDfwXE.js} +335 -8
  2. package/dist/{dist-CXCR7sEk.js → dist-suALViLT.mjs} +276 -37
  3. package/dist/magic-link/auth-magic-link.addon.js +104 -30
  4. package/dist/magic-link/auth-magic-link.addon.mjs +104 -30
  5. package/dist/oidc/auth-oidc.addon.js +36 -8
  6. package/dist/oidc/auth-oidc.addon.mjs +36 -8
  7. package/dist/webauthn/_stub.js +568 -0
  8. package/dist/webauthn/_virtual_mf-localSharedImportMap___mfe_internal__addon_auth_webauthn_widgets-Bg_T1-iY.mjs +156 -0
  9. package/dist/webauthn/_virtual_mf___mfe_internal__addon_auth_webauthn_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-EnxrfqY5.mjs +26 -0
  10. package/dist/webauthn/_virtual_mf___mfe_internal__addon_auth_webauthn_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-CQ-aEQ9b.mjs +26 -0
  11. package/dist/webauthn/_virtual_mf___mfe_internal__addon_auth_webauthn_widgets__loadShare__react__loadShare__.js-BIIa6vDX.mjs +26 -0
  12. package/dist/webauthn/_virtual_mf___mfe_internal__addon_auth_webauthn_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-BL2etuqg.mjs +26 -0
  13. package/dist/webauthn/auth-webauthn.addon.js +141 -5
  14. package/dist/webauthn/auth-webauthn.addon.mjs +136 -37
  15. package/dist/webauthn/dist-CYZr2fwk.mjs +2726 -0
  16. package/dist/webauthn/hostInit-Boe91Eeg.mjs +129 -0
  17. package/dist/webauthn/remoteEntry.js +134 -0
  18. package/dist/webauthn/remoteEntry.ssr.js +33 -0
  19. package/dist/webauthn/virtualExposes-Ckj56FAf.mjs +27 -0
  20. package/dist/webauthn/virtual_mf-exposes-ssr___mfe_internal__addon_auth_webauthn_widgets__remoteEntry_js-C5AzEzK5.mjs +10 -0
  21. package/package.json +30 -5
@@ -4627,7 +4627,7 @@ function _instanceof(cls, params = {}) {
4627
4627
  return inst;
4628
4628
  }
4629
4629
  //#endregion
4630
- //#region ../types/dist/sleep-DiQ8xW1M.mjs
4630
+ //#region ../types/dist/sleep-DJaTV2D7.mjs
4631
4631
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4632
4632
  EventCategory["SystemBoot"] = "system.boot";
4633
4633
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -5348,10 +5348,6 @@ function hydrateField(field, values) {
5348
5348
  };
5349
5349
  }
5350
5350
  const rawValue = storedValue !== void 0 ? storedValue : defaultValue !== void 0 ? defaultValue : null;
5351
- if (field.type === "password") return {
5352
- ...field,
5353
- value: ""
5354
- };
5355
5351
  const value = field.type === "textarea" && field.isJson && rawValue !== null && typeof rawValue === "object" ? JSON.stringify(rawValue, null, 2) : rawValue;
5356
5352
  return {
5357
5353
  ...field,
@@ -6735,6 +6731,9 @@ function method(input, output, options) {
6735
6731
  timeoutMs: options?.timeoutMs
6736
6732
  };
6737
6733
  }
6734
+ var StaticDirOutputSchema$1 = object({ staticDir: string() });
6735
+ var VersionOutputSchema$1 = object({ version: string() });
6736
+ method(_void(), StaticDirOutputSchema$1), method(_void(), VersionOutputSchema$1);
6738
6737
  var StaticDirOutputSchema = object({ staticDir: string() });
6739
6738
  var VersionOutputSchema = object({ version: string() });
6740
6739
  method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
@@ -12625,6 +12624,17 @@ var WidgetMetadataSchema = object({
12625
12624
  deviceContext: boolean().default(false),
12626
12625
  integrationContext: boolean().default(false)
12627
12626
  }),
12627
+ /**
12628
+ * Loadable BEFORE authentication. The normal widget registry listing
12629
+ * (`addon-widgets.listWidgets`) is auth-gated, so a pre-auth surface
12630
+ * (the login page) cannot discover a widget through it. A widget that
12631
+ * declares `preAuth: true` marks itself as safe to mount on a pre-auth
12632
+ * screen — it is surfaced through the PUBLIC `auth.listLoginMethods`
12633
+ * login-method contribution channel (see `login-method.cap.ts`) rather
12634
+ * than the authenticated registry, and its bundle is served by the
12635
+ * public `/api/addon-widgets/:addonId/*` static route. Defaults false.
12636
+ */
12637
+ preAuth: boolean().optional().default(false),
12628
12638
  /** Dashboard placement HINTS (operator can override per instance). */
12629
12639
  defaultSize: WidgetSizeEnum.default("md"),
12630
12640
  allowedSizes: array(WidgetSizeEnum).readonly().default([
@@ -12635,7 +12645,13 @@ var WidgetMetadataSchema = object({
12635
12645
  defaultColumns: number().int().min(1).max(12).default(6),
12636
12646
  defaultRows: number().int().min(1).max(12).default(1)
12637
12647
  });
12638
- method(_void(), array(WidgetMetadataSchema).readonly());
12648
+ var addonWidgetsSourceCapability = {
12649
+ name: "addon-widgets-source",
12650
+ scope: "system",
12651
+ mode: "collection",
12652
+ internal: true,
12653
+ methods: { listWidgets: method(_void(), array(WidgetMetadataSchema).readonly()) }
12654
+ };
12639
12655
  /**
12640
12656
  * `addon-widgets` — system-scoped singleton aggregator cap. Public-facing
12641
12657
  * surface that admin-ui consumes through `useAddonWidgetsListWidgets()`.
@@ -12939,6 +12955,74 @@ var authProviderCapability = {
12939
12955
  mount: { kind: "skip" }
12940
12956
  };
12941
12957
  /**
12958
+ * `login-method` — collection cap through which auth addons contribute
12959
+ * their pre-auth login surfaces to the login page. This is the SINGLE,
12960
+ * generic mechanism that supersedes the dead `auth.listProviders` reader:
12961
+ * every auth addon (OIDC, magic-link, WebAuthn/passkey) registers a
12962
+ * `login-method` provider and the PUBLIC `auth.listLoginMethods`
12963
+ * procedure aggregates them for the unauthenticated login page.
12964
+ *
12965
+ * A contribution is a discriminated union on `kind`:
12966
+ *
12967
+ * - `redirect` — a declarative button. The login page renders a generic
12968
+ * button that navigates to `startUrl` (an addon-owned HTTP route).
12969
+ * Covers OIDC (`/addon/auth-oidc/<id>/start`) and magic-link with
12970
+ * ZERO shell-side JS. A future SSO addon plugs in the same way — the
12971
+ * login page needs NO change.
12972
+ *
12973
+ * - `widget` — a Module-Federation widget the login page mounts (via
12974
+ * `loadRemoteBundle`) for an in-page ceremony. Covers the passkey
12975
+ * login ceremony, which must run `@simplewebauthn/browser` INSIDE the
12976
+ * addon bundle. The referenced widget also declares `preAuth: true` in
12977
+ * its `addon-widgets-source` catalog entry. `auth.listLoginMethods`
12978
+ * stamps a public `bundleUrl` from `addonId` + `bundle`.
12979
+ *
12980
+ * Every contribution carries a `stage`:
12981
+ * - `primary` — shown on the first credentials screen (OIDC /
12982
+ * magic-link buttons; a future usernameless passkey).
12983
+ * - `second-factor` — shown AFTER the password leg, gated on the
12984
+ * returned `factors` (passkey-as-2FA today).
12985
+ *
12986
+ * `mount: skip` — the cap is read server-side by the core auth router
12987
+ * (`registry.getCollection('login-method')`), never mounted as its own
12988
+ * tRPC router.
12989
+ */
12990
+ /** When a login method renders in the two-phase login flow. */
12991
+ var LoginStageEnum = _enum(["primary", "second-factor"]);
12992
+ /** One login-method contribution — redirect button OR pre-auth widget. */
12993
+ var LoginMethodContributionSchema = discriminatedUnion("kind", [object({
12994
+ kind: literal("redirect"),
12995
+ /** Stable id within the login-method set (e.g. `auth-oidc/google`). */
12996
+ id: string(),
12997
+ /** Operator-facing button label. */
12998
+ label: string(),
12999
+ /** lucide-react icon name. */
13000
+ icon: string().optional(),
13001
+ /** Addon-owned HTTP route the button navigates to (GET). */
13002
+ startUrl: string(),
13003
+ stage: LoginStageEnum
13004
+ }), object({
13005
+ kind: literal("widget"),
13006
+ /** Stable id within the login-method set (e.g. `auth-webauthn/passkey-login`). */
13007
+ id: string(),
13008
+ /** Owning addon id — drives the public bundle URL + the MF namespace. */
13009
+ addonId: string(),
13010
+ /** Bundle filename inside the addon's dist dir (`remoteEntry.js`). */
13011
+ bundle: string(),
13012
+ /** MF remote descriptor — `{ remoteName, exposedModule, componentKey }`. */
13013
+ remote: WidgetRemoteSchema,
13014
+ stage: LoginStageEnum
13015
+ })]);
13016
+ var loginMethodCapability = {
13017
+ name: "login-method",
13018
+ scope: "system",
13019
+ mode: "collection",
13020
+ internal: true,
13021
+ methods: { getLoginMethods: method(_void(), array(LoginMethodContributionSchema).readonly()) },
13022
+ /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
13023
+ mount: { kind: "skip" }
13024
+ };
13025
+ /**
12942
13026
  * Orchestrator-side destination metadata. The orchestrator computes
12943
13027
  * `id = <addonId>:<subId>` from its provider lookup so consumers
12944
13028
  * (admin UI, restore flow) see one canonical key.
@@ -15640,6 +15724,131 @@ method(object({
15640
15724
  auth: "admin"
15641
15725
  });
15642
15726
  /**
15727
+ * server-management — per-NODE singleton capability for a node's ROOT
15728
+ * package lifecycle (runtime-updatable node packages, phase 2: hub + docker
15729
+ * agents).
15730
+ *
15731
+ * Each node's root package (`@camstack/server` on the hub, `@camstack/agent`
15732
+ * on agents) carries the whole software stack in its npm dep tree, so ONE
15733
+ * version describes the node. Updates install into
15734
+ * `<dataDir>/server-root/versions/<v>/` and apply on restart via the baked
15735
+ * starter (probation boot + auto-rollback to N-1).
15736
+ *
15737
+ * Providers:
15738
+ * - HUB: `ServerUpdateService` behind the `server-provided` mount
15739
+ * (`buildServerProviders` in trpc.router.ts) — the default target for
15740
+ * unpinned calls.
15741
+ * - AGENT: `AgentUpdateService` registered by the agent bootstrap under
15742
+ * the synthetic `agent-runtime` addonId and declared in the agent's
15743
+ * `$hub.registerNode` manifest.
15744
+ *
15745
+ * Node routing: singleton caps get the codegen/runtime-builder `nodeId`
15746
+ * injection on every method — `input.nodeId` (or `nodePin(nodeId)` from the
15747
+ * SDK) routes the call to that node's provider via the standard remote
15748
+ * proxy (`createCapabilityProxy` → `$agent-cap-fwd` → the agent's
15749
+ * in-process provider lookup). No `nodeId` → the hub's own provider.
15750
+ *
15751
+ * Spec: docs/superpowers/specs/2026-07-12-runtime-updatable-node-packages-design.md
15752
+ */
15753
+ /**
15754
+ * Where the running hub's code was loaded from:
15755
+ * - `workspace` — dev checkout (tsx / workspace dist); the starter defers to
15756
+ * plain resolution and runtime updates are refused.
15757
+ * - `baked` — the immutable image seed closure (no data-dir root active).
15758
+ * - `data-root` — the runtime-updatable `<dataDir>/server-root` closure.
15759
+ */
15760
+ var ServerBootModeSchema = _enum([
15761
+ "workspace",
15762
+ "baked",
15763
+ "data-root"
15764
+ ]);
15765
+ /**
15766
+ * Update lifecycle state:
15767
+ * - `idle` / `checking` / `staging` — steady / in-flight registry work.
15768
+ * - `pending-restart` — a version is staged and the node has NOT yet
15769
+ * restarted onto it (still running the OLD version).
15770
+ * - `awaiting-confirmation` — the node HAS restarted onto the staged version
15771
+ * (it is the active probation boot) and is waiting to confirm boot-health.
15772
+ * Apply/rollback are refused in this state and the node must NOT be
15773
+ * manually restarted, or the probation boot auto-rolls-back.
15774
+ */
15775
+ var ServerUpdateStateSchema = _enum([
15776
+ "idle",
15777
+ "checking",
15778
+ "staging",
15779
+ "pending-restart",
15780
+ "awaiting-confirmation"
15781
+ ]);
15782
+ var ServerRollbackInfoSchema = object({
15783
+ /** The version that failed (or was manually rolled back). */
15784
+ fromVersion: string(),
15785
+ /** The version rolled back to; null = the baked seed. */
15786
+ toVersion: string().nullable(),
15787
+ atMs: number(),
15788
+ reason: string()
15789
+ });
15790
+ var ServerPackageStatusSchema = object({
15791
+ /** Root package name (`@camstack/server` on the hub). */
15792
+ packageName: string(),
15793
+ /** Version of the code the running process ACTUALLY loaded. */
15794
+ runningVersion: string().nullable(),
15795
+ /** Node.js runtime version the node's process runs on (`process.versions.node`). */
15796
+ nodeRuntimeVersion: string().nullable(),
15797
+ /** Active data-dir root version; null when booted from seed/workspace. */
15798
+ activeVersion: string().nullable(),
15799
+ /** N-1 version kept for rollback; null when no previous version exists. */
15800
+ previousVersion: string().nullable(),
15801
+ /** Version of the immutable baked seed closure (image fallback). */
15802
+ seedVersion: string().nullable(),
15803
+ /** Latest registry version from the most recent check (null = never checked). */
15804
+ latestVersion: string().nullable(),
15805
+ updateAvailable: boolean(),
15806
+ bootMode: ServerBootModeSchema,
15807
+ updateState: ServerUpdateStateSchema,
15808
+ /** Version staged + awaiting its probation boot, when one is pending. */
15809
+ pendingVersion: string().nullable(),
15810
+ /** Set when the last freshly-activated version failed its boot health-check. */
15811
+ rolledBack: ServerRollbackInfoSchema.nullable(),
15812
+ /**
15813
+ * True when `server-root/state.json` EXISTS but is unreadable/corrupt — the
15814
+ * hub is running from the baked seed (or workspace) while installed data-dir
15815
+ * versions are being IGNORED. Surfaced as a warning in the UI.
15816
+ */
15817
+ stateFileCorrupt: boolean(),
15818
+ lastCheckedAtMs: number().nullable()
15819
+ });
15820
+ var ServerUpdateCheckResultSchema = object({
15821
+ packageName: string(),
15822
+ runningVersion: string().nullable(),
15823
+ latestVersion: string().nullable(),
15824
+ updateAvailable: boolean(),
15825
+ checkedAtMs: number(),
15826
+ /** Non-null when the registry lookup failed (offline, bad registry, …). */
15827
+ error: string().nullable()
15828
+ });
15829
+ var ServerUpdateActionResultSchema = object({
15830
+ accepted: boolean(),
15831
+ targetVersion: string().nullable(),
15832
+ /** True when a graceful restart was scheduled to apply the change. */
15833
+ restarting: boolean(),
15834
+ message: string()
15835
+ });
15836
+ method(_void(), ServerPackageStatusSchema, { auth: "admin" }), method(_void(), ServerUpdateCheckResultSchema, {
15837
+ kind: "mutation",
15838
+ auth: "admin"
15839
+ }), method(object({
15840
+ /** Explicit target version; omitted = latest from the registry. */
15841
+ version: string().optional() }), ServerUpdateActionResultSchema, {
15842
+ kind: "mutation",
15843
+ auth: "admin"
15844
+ }), method(_void(), ServerUpdateActionResultSchema, {
15845
+ kind: "mutation",
15846
+ auth: "admin"
15847
+ }), method(_void(), ServerUpdateActionResultSchema, {
15848
+ kind: "mutation",
15849
+ auth: "admin"
15850
+ });
15851
+ /**
15643
15852
  * Query filter for settings-store collections.
15644
15853
  */
15645
15854
  var QueryFilterSchema = object({
@@ -17639,6 +17848,16 @@ var TopologyCategorySchema = object({
17639
17848
  healthy: number(),
17640
17849
  addons: array(TopologyCategoryAddonSchema).readonly()
17641
17850
  });
17851
+ /**
17852
+ * The node's runtime-updatable ROOT package (`@camstack/server` on the hub,
17853
+ * `@camstack/agent` on agents) as reported by its `registerNode` manifest —
17854
+ * version visibility for the Server management surface. Nullable: offline
17855
+ * rows and pre-phase-2 nodes report none.
17856
+ */
17857
+ var TopologyRootPackageSchema = object({
17858
+ name: string(),
17859
+ version: string()
17860
+ });
17642
17861
  var TopologyNodeSchema = object({
17643
17862
  id: string(),
17644
17863
  name: string(),
@@ -17662,7 +17881,8 @@ var TopologyNodeSchema = object({
17662
17881
  status: string()
17663
17882
  })).readonly(),
17664
17883
  processes: array(TopologyProcessSchema).readonly(),
17665
- categories: array(TopologyCategorySchema).readonly()
17884
+ categories: array(TopologyCategorySchema).readonly(),
17885
+ rootPackage: TopologyRootPackageSchema.nullable()
17666
17886
  });
17667
17887
  var CapUsageEdgeSchema = object({
17668
17888
  callerAddonId: string(),
@@ -20462,6 +20682,12 @@ Object.freeze({
20462
20682
  addonId: null,
20463
20683
  access: "create"
20464
20684
  },
20685
+ "loginMethod.getLoginMethods": {
20686
+ capName: "login-method",
20687
+ capScope: "system",
20688
+ addonId: null,
20689
+ access: "view"
20690
+ },
20465
20691
  "mediaPlayer.next": {
20466
20692
  capName: "media-player",
20467
20693
  capScope: "device",
@@ -21824,6 +22050,36 @@ Object.freeze({
21824
22050
  addonId: null,
21825
22051
  access: "create"
21826
22052
  },
22053
+ "serverManagement.applyServerUpdate": {
22054
+ capName: "server-management",
22055
+ capScope: "system",
22056
+ addonId: null,
22057
+ access: "create"
22058
+ },
22059
+ "serverManagement.checkServerUpdate": {
22060
+ capName: "server-management",
22061
+ capScope: "system",
22062
+ addonId: null,
22063
+ access: "create"
22064
+ },
22065
+ "serverManagement.getServerPackageStatus": {
22066
+ capName: "server-management",
22067
+ capScope: "system",
22068
+ addonId: null,
22069
+ access: "view"
22070
+ },
22071
+ "serverManagement.restartServer": {
22072
+ capName: "server-management",
22073
+ capScope: "system",
22074
+ addonId: null,
22075
+ access: "create"
22076
+ },
22077
+ "serverManagement.rollbackServerUpdate": {
22078
+ capName: "server-management",
22079
+ capScope: "system",
22080
+ addonId: null,
22081
+ access: "create"
22082
+ },
21827
22083
  "settingsStore.count": {
21828
22084
  capName: "settings-store",
21829
22085
  capScope: "system",
@@ -22688,6 +22944,18 @@ Object.freeze({
22688
22944
  addonId: null,
22689
22945
  access: "view"
22690
22946
  },
22947
+ "viewerUi.getStaticDir": {
22948
+ capName: "viewer-ui",
22949
+ capScope: "system",
22950
+ addonId: null,
22951
+ access: "view"
22952
+ },
22953
+ "viewerUi.getVersion": {
22954
+ capName: "viewer-ui",
22955
+ capScope: "system",
22956
+ addonId: null,
22957
+ access: "view"
22958
+ },
22691
22959
  "waterHeater.setAway": {
22692
22960
  capName: "water-heater",
22693
22961
  capScope: "device",
@@ -22856,4 +23124,63 @@ object({
22856
23124
  schemaVersion: literal(1)
22857
23125
  });
22858
23126
  //#endregion
22859
- export { BaseAddon as a, errMsg as i, authProviderCapability as n, userPasskeysCapability as r, addonRoutesCapability as t };
23127
+ Object.defineProperty(exports, "BaseAddon", {
23128
+ enumerable: true,
23129
+ get: function() {
23130
+ return BaseAddon;
23131
+ }
23132
+ });
23133
+ Object.defineProperty(exports, "addonRoutesCapability", {
23134
+ enumerable: true,
23135
+ get: function() {
23136
+ return addonRoutesCapability;
23137
+ }
23138
+ });
23139
+ Object.defineProperty(exports, "addonWidgetsSourceCapability", {
23140
+ enumerable: true,
23141
+ get: function() {
23142
+ return addonWidgetsSourceCapability;
23143
+ }
23144
+ });
23145
+ Object.defineProperty(exports, "array", {
23146
+ enumerable: true,
23147
+ get: function() {
23148
+ return array;
23149
+ }
23150
+ });
23151
+ Object.defineProperty(exports, "authProviderCapability", {
23152
+ enumerable: true,
23153
+ get: function() {
23154
+ return authProviderCapability;
23155
+ }
23156
+ });
23157
+ Object.defineProperty(exports, "errMsg", {
23158
+ enumerable: true,
23159
+ get: function() {
23160
+ return errMsg;
23161
+ }
23162
+ });
23163
+ Object.defineProperty(exports, "loginMethodCapability", {
23164
+ enumerable: true,
23165
+ get: function() {
23166
+ return loginMethodCapability;
23167
+ }
23168
+ });
23169
+ Object.defineProperty(exports, "object", {
23170
+ enumerable: true,
23171
+ get: function() {
23172
+ return object;
23173
+ }
23174
+ });
23175
+ Object.defineProperty(exports, "string", {
23176
+ enumerable: true,
23177
+ get: function() {
23178
+ return string;
23179
+ }
23180
+ });
23181
+ Object.defineProperty(exports, "userPasskeysCapability", {
23182
+ enumerable: true,
23183
+ get: function() {
23184
+ return userPasskeysCapability;
23185
+ }
23186
+ });