@camstack/addon-auth 1.2.127 → 1.2.128

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.
@@ -10578,57 +10578,15 @@ var ClipSearchStrictnessSchema = _enum([
10578
10578
  "balanced",
10579
10579
  "strict"
10580
10580
  ]);
10581
- new Set([
10582
- {
10583
- id: "person",
10584
- name: "Person"
10585
- },
10586
- {
10587
- id: "vehicle",
10588
- name: "Vehicle"
10589
- },
10590
- {
10591
- id: "animal",
10592
- name: "Animal"
10593
- },
10594
- {
10595
- id: "package",
10596
- name: "Package"
10597
- }
10598
- ].map((l) => l.id));
10599
- var COCO_TO_MACRO = {
10600
- mapping: {
10601
- person: "person",
10602
- bicycle: "vehicle",
10603
- car: "vehicle",
10604
- motorcycle: "vehicle",
10605
- airplane: "vehicle",
10606
- bus: "vehicle",
10607
- train: "vehicle",
10608
- truck: "vehicle",
10609
- boat: "vehicle",
10610
- bird: "animal",
10611
- cat: "animal",
10612
- dog: "animal",
10613
- horse: "animal",
10614
- sheep: "animal",
10615
- cow: "animal",
10616
- elephant: "animal",
10617
- bear: "animal",
10618
- zebra: "animal",
10619
- giraffe: "animal",
10620
- suitcase: "package",
10621
- backpack: "package",
10622
- handbag: "package"
10623
- },
10624
- preserveOriginal: false
10625
- };
10626
- /** Steps a root detector may declare it fills. */
10627
- var FILLABLE_STEP_IDS = [
10581
+ /** Steps whose effect a root label can BE. */
10582
+ var LABEL_SUPPLY_STEP_IDS = [
10628
10583
  "animal-classifier",
10629
10584
  "vehicle-classifier",
10630
10585
  "package-detection"
10631
10586
  ];
10587
+ /** Steps whose box a root detection can BE. */
10588
+ var CROP_SUPPLY_STEP_IDS = ["plate-detection", "face-detection"];
10589
+ [...LABEL_SUPPLY_STEP_IDS, ...CROP_SUPPLY_STEP_IDS];
10632
10590
  var MODEL_FORMATS = [
10633
10591
  "onnx",
10634
10592
  "coreml",
@@ -10761,12 +10719,35 @@ var ModelLicenseSchema = preprocess((value) => typeof value === "string" ? { wei
10761
10719
  /** True when the weights or their data forbid commercial use. */
10762
10720
  nonCommercial: boolean().optional()
10763
10721
  }));
10764
- /** One `fillsClassifierEffects` entry — see `ModelCatalogEntry.fillsClassifierEffects`. */
10765
- var FillsClassifierEffectSchema = object({
10766
- stepId: _enum(FILLABLE_STEP_IDS),
10722
+ /**
10723
+ * One step a ROOT detector can supply from its own output (D730) — see
10724
+ * `ModelCatalogEntry.suppliesSteps`.
10725
+ *
10726
+ * - `label`: the root's raw class IS the step's answer. `labelToEffect` maps
10727
+ * the root's label to the step's vocabulary; `uncovered` is the vocabulary
10728
+ * the root cannot produce (shown as unavailable, never a blocker).
10729
+ * - `crop`: the root draws the box the step would have found (`license_plate`
10730
+ * for plate-detection, `face` for face-detection). The box becomes a detail
10731
+ * child of the `parentMacro` detection that contains it — never a track.
10732
+ */
10733
+ var RootStepSupplySchema = discriminatedUnion("kind", [object({
10734
+ kind: literal("label"),
10735
+ stepId: _enum(LABEL_SUPPLY_STEP_IDS),
10767
10736
  labelToEffect: record(string(), string()),
10768
10737
  uncovered: array(string()).readonly()
10769
- });
10738
+ }), object({
10739
+ kind: literal("crop"),
10740
+ stepId: _enum(CROP_SUPPLY_STEP_IDS),
10741
+ rootLabels: array(string()).readonly(),
10742
+ parentMacro: _enum(["vehicle", "person"]),
10743
+ childClass: _enum(["plate", "face"]),
10744
+ /**
10745
+ * The root's smaller input side, stamped on read by `rootSuppliesOf` from
10746
+ * the model entry — what a step's `minRootInputPx` gate judges. Never
10747
+ * stored by an import.
10748
+ */
10749
+ rootInputPx: number().int().positive().optional()
10750
+ })]);
10770
10751
  var ModelCatalogEntrySchema = object({
10771
10752
  id: string(),
10772
10753
  name: string(),
@@ -10893,15 +10874,15 @@ var ModelCatalogEntrySchema = object({
10893
10874
  */
10894
10875
  classMap: DetectionCatalogClassMapSchema.optional(),
10895
10876
  /**
10896
- * The pipeline steps this ROOT detector already does the work of (D715):
10897
- * its labels name the effect the step exists to produce (`deer` for
10898
- * `animal-classifier`, `package` for `package-detection`). Derived from the
10899
- * labelmap by `deriveClassifierFills`, never hand-written; a COCO model
10900
- * declares none. Whether a declaration is honoured is the step's own
10901
- * `labelLink` policy (`resolveLabelLink`). `labelToEffect` values are in
10902
- * `FILLABLE_STEP_VOCABULARIES` (guard `check-label-link-vocabulary`).
10877
+ * The pipeline steps this ROOT detector can supply from its own output
10878
+ * (D730): its labels name a step's effect (`deer` for `animal-classifier`)
10879
+ * or draw a step's box (`license_plate` for `plate-detection`). Computed at
10880
+ * import from THIS model's labelmap by `deriveRootSupplies`, never written
10881
+ * by hand and never assumed per family; a row without it is derived on read
10882
+ * (`rootSuppliesOf`). Whether a camera uses it is the step's own
10883
+ * `useRootModel` flag (`resolveRootSupply`).
10903
10884
  */
10904
- fillsClassifierEffects: array(FillsClassifierEffectSchema).readonly().optional(),
10885
+ suppliesSteps: array(RootStepSupplySchema).readonly().optional(),
10905
10886
  /**
10906
10887
  * The model's CLIP feature-space contract (text encoder, dimension, vector
10907
10888
  * index, token window, search floor) — see `clip-model.ts`. Present ONLY on a
@@ -17882,6 +17863,51 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
17882
17863
  kind: "mutation",
17883
17864
  auth: "admin"
17884
17865
  });
17866
+ new Set([
17867
+ {
17868
+ id: "person",
17869
+ name: "Person"
17870
+ },
17871
+ {
17872
+ id: "vehicle",
17873
+ name: "Vehicle"
17874
+ },
17875
+ {
17876
+ id: "animal",
17877
+ name: "Animal"
17878
+ },
17879
+ {
17880
+ id: "package",
17881
+ name: "Package"
17882
+ }
17883
+ ].map((l) => l.id));
17884
+ var COCO_TO_MACRO = {
17885
+ mapping: {
17886
+ person: "person",
17887
+ bicycle: "vehicle",
17888
+ car: "vehicle",
17889
+ motorcycle: "vehicle",
17890
+ airplane: "vehicle",
17891
+ bus: "vehicle",
17892
+ train: "vehicle",
17893
+ truck: "vehicle",
17894
+ boat: "vehicle",
17895
+ bird: "animal",
17896
+ cat: "animal",
17897
+ dog: "animal",
17898
+ horse: "animal",
17899
+ sheep: "animal",
17900
+ cow: "animal",
17901
+ elephant: "animal",
17902
+ bear: "animal",
17903
+ zebra: "animal",
17904
+ giraffe: "animal",
17905
+ suitcase: "package",
17906
+ backpack: "package",
17907
+ handbag: "package"
17908
+ },
17909
+ preserveOriginal: false
17910
+ };
17885
17911
  var AUDIO_MACRO_LABELS = [
17886
17912
  {
17887
17913
  id: "speech",
@@ -18639,6 +18665,8 @@ var NcSystemEventKindSchema = _enum([
18639
18665
  "stream-offline",
18640
18666
  "node-online",
18641
18667
  "node-offline",
18668
+ "node-restarting",
18669
+ "node-updating",
18642
18670
  "node-inference-unavailable",
18643
18671
  "detection-blind",
18644
18672
  "addon-crash-loop",
@@ -23156,6 +23184,34 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
23156
23184
  timestamp: number()
23157
23185
  });
23158
23186
  /**
23187
+ * A root model's boxes standing in for one crop-kind step's own inference
23188
+ * (D730) — see `runPipeline.suppliedRoot`.
23189
+ */
23190
+ var SuppliedRootOutputSchema = object({
23191
+ stepId: string(),
23192
+ /** The root model that drew the boxes — stamped on the result. */
23193
+ modelId: string(),
23194
+ detections: array(object({
23195
+ /** `[x1, y1, x2, y2]` in the pixels of the call's image. */
23196
+ bbox: tuple([
23197
+ number(),
23198
+ number(),
23199
+ number(),
23200
+ number()
23201
+ ]),
23202
+ score: number(),
23203
+ /**
23204
+ * Five facial landmarks in the same pixels — a face the step's own
23205
+ * detector already re-found inside a root face box (D730), so its
23206
+ * embedder child aligns it exactly as it aligns any detected face.
23207
+ */
23208
+ landmarks: array(object({
23209
+ x: number(),
23210
+ y: number()
23211
+ })).optional()
23212
+ })).min(1)
23213
+ });
23214
+ /**
23159
23215
  * Reference to the frame's retained NATIVE surface + the parent crop's placement
23160
23216
  * within the frame, so the executor can re-cut a leaf child ROI at native
23161
23217
  * resolution on the detail plane. See the `runPipeline` `nativeCropRef` field.
@@ -23286,7 +23342,7 @@ var PipelineModelOptionSchema = object({
23286
23342
  legacy: boolean().optional(),
23287
23343
  provider: ModelProviderIdSchema.optional(),
23288
23344
  defaultConfidence: number().optional(),
23289
- fillsClassifierEffects: array(FillsClassifierEffectSchema).readonly().optional()
23345
+ suppliesSteps: array(RootStepSupplySchema).readonly().optional()
23290
23346
  });
23291
23347
  var ConfigFieldBridge = custom();
23292
23348
  var PipelineAddonSchemaSchema = object({
@@ -23554,7 +23610,16 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
23554
23610
  * `device-not-servable`), and nothing reaches the camera's live
23555
23611
  * trace stream. Absent ⇒ unchanged behaviour.
23556
23612
  */
23557
- replay: literal(true).optional()
23613
+ replay: literal(true).optional(),
23614
+ /**
23615
+ * Root-supplied detections for the tree's ROOT step (D730). Set by
23616
+ * `runDetailSubtree` when the camera's root model supplies a crop-kind
23617
+ * step (a Frigate+ `license_plate` for `plate-detection`): the step is
23618
+ * NOT inferred, these boxes are its output, and its children (the plate
23619
+ * reader) run on them through their own crop policy. Boxes are in the
23620
+ * PIXELS of the image this call carries. Absent ⇒ the root step runs.
23621
+ */
23622
+ suppliedRoot: SuppliedRootOutputSchema.optional()
23558
23623
  }), PipelineRunResultBridge, { kind: "mutation" }), method(object({
23559
23624
  steps: array(PipelineStepInputSchema).min(1),
23560
23625
  frames: array(FrameInputSchema).min(1).max(255),
@@ -24656,7 +24721,22 @@ method(RunnerCameraConfigSchema, object({ success: literal(true) }), { kind: "mu
24656
24721
  */
24657
24722
  cropJpeg: string().optional(),
24658
24723
  parent: DetailParentSchema,
24659
- steps: array(string()).optional()
24724
+ steps: array(string()).optional(),
24725
+ /**
24726
+ * The camera's root model already drew this step's boxes (D730): a
24727
+ * `license_plate` inside the parent vehicle. The named step is NOT
24728
+ * inferred — these FRAME-space boxes are its output — and its
24729
+ * requested children (the plate reader) run on them. Absent ⇒ every
24730
+ * requested step infers as before.
24731
+ */
24732
+ supplied: object({
24733
+ stepId: string(),
24734
+ modelId: string(),
24735
+ boxes: array(object({
24736
+ bbox: NativeCropBboxSchema,
24737
+ score: number()
24738
+ })).min(1)
24739
+ }).optional()
24660
24740
  }), object({ details: array(DetailResultSchema) }).nullable(), { kind: "mutation" }), method(object({
24661
24741
  /** Catalog step id, e.g. `clip-embedding`. */
24662
24742
  stepId: string(),
@@ -30769,6 +30849,27 @@ var ViewerEndpointsSchema = object({
30769
30849
  /** What the ranking currently resolves to (may be empty if nothing is up). */
30770
30850
  resolved: array(string()).readonly()
30771
30851
  });
30852
+ /**
30853
+ * One audience's hub address (see `hub-address.ts`): the operator's stored
30854
+ * override, the address in use, and where it came from.
30855
+ */
30856
+ var HubAddressSnapshotSchema = object({
30857
+ /** The operator's override, or null for automatic. */
30858
+ override: string().nullable(),
30859
+ /** The address in use, or null when nothing qualifies (never loopback). */
30860
+ resolved: string().nullable(),
30861
+ source: _enum([
30862
+ "override",
30863
+ "auto",
30864
+ "none"
30865
+ ])
30866
+ });
30867
+ var HubAddressesSchema = object({
30868
+ /** "Hub address for agents" — agents' bundle/model pulls, LAN devices. */
30869
+ cluster: HubAddressSnapshotSchema,
30870
+ /** "Public address for sign-in links" — e-mail links, OIDC, WebAuthn, OAuth2. */
30871
+ browser: HubAddressSnapshotSchema
30872
+ });
30772
30873
  var AllowedAddressesSchema = object({
30773
30874
  /**
30774
30875
  * Allowlist of interface addresses operators have explicitly opted
@@ -30815,7 +30916,13 @@ method(_void(), ListResultSchema), method(_void(), PreferredSchema), method(obje
30815
30916
  * an address notification links can be flagged with, not a hub
30816
30917
  * route. Default `false`: racers and rankers never see it. */
30817
30918
  includeAppLink: boolean().optional()
30818
- }), GetConnectionEndpointsResultSchema), method(_void(), NotificationEndpointSchema), method(object({ baseUrl: string().nullable() }), NotificationEndpointSchema, { kind: "mutation" }), method(_void(), ViewerEndpointsSchema), method(object({ baseUrls: array(string()).readonly() }), ViewerEndpointsSchema, { kind: "mutation" }), method(_void(), AllowedAddressesSchema), method(AllowedAddressesSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), AllowedAddressesSchema, { kind: "mutation" }), method(_void(), TlsStatusSchema), method(object({ reason: string().optional() }), TlsStatusSchema, {
30919
+ }), GetConnectionEndpointsResultSchema), method(_void(), NotificationEndpointSchema), method(object({ baseUrl: string().nullable() }), NotificationEndpointSchema, { kind: "mutation" }), method(_void(), ViewerEndpointsSchema), method(object({ baseUrls: array(string()).readonly() }), ViewerEndpointsSchema, { kind: "mutation" }), method(_void(), HubAddressesSchema), method(object({
30920
+ audience: _enum(["cluster", "browser"]),
30921
+ baseUrl: string().nullable()
30922
+ }), HubAddressesSchema, {
30923
+ kind: "mutation",
30924
+ auth: "admin"
30925
+ }), method(_void(), AllowedAddressesSchema), method(AllowedAddressesSchema, object({ success: literal(true) }), { kind: "mutation" }), method(_void(), AllowedAddressesSchema, { kind: "mutation" }), method(_void(), TlsStatusSchema), method(object({ reason: string().optional() }), TlsStatusSchema, {
30819
30926
  kind: "mutation",
30820
30927
  auth: "admin"
30821
30928
  }), method(object({
@@ -31205,7 +31312,8 @@ object({
31205
31312
  * writes this slice (not even a boot seed), and neither does the runner's
31206
31313
  * phase machine: its phase is "a session is attached" for every on-motion
31207
31314
  * session, not motion, and it now has its own `DetectionPhaseTransition`.
31208
- * A provider's `isDetected` answers from the hub's slice.
31315
+ * A provider's `isDetected` and `getStatus` answer from the hub's slice
31316
+ * (`hubMotionNativeProvider`).
31209
31317
  * - **Sensors** (Home Assistant binary sensors, Homematic, Matter, Alexa
31210
31318
  * imports) — the provider pushes both edges itself, from the upstream
31211
31319
  * system's own state change. That is the sensor's own fact.
@@ -39282,6 +39390,12 @@ Object.freeze({
39282
39390
  addonId: null,
39283
39391
  access: "view"
39284
39392
  },
39393
+ "localNetwork.getHubAddresses": {
39394
+ capName: "local-network",
39395
+ capScope: "system",
39396
+ addonId: null,
39397
+ access: "view"
39398
+ },
39285
39399
  "localNetwork.getNotificationEndpoint": {
39286
39400
  capName: "local-network",
39287
39401
  capScope: "system",
@@ -39336,6 +39450,12 @@ Object.freeze({
39336
39450
  addonId: null,
39337
39451
  access: "create"
39338
39452
  },
39453
+ "localNetwork.setHubAddress": {
39454
+ capName: "local-network",
39455
+ capScope: "system",
39456
+ addonId: null,
39457
+ access: "create"
39458
+ },
39339
39459
  "localNetwork.setNotificationEndpoint": {
39340
39460
  capName: "local-network",
39341
39461
  capScope: "system",
@@ -47735,6 +47855,8 @@ new Map(Object.entries({
47735
47855
  "detection-blind": "device-events",
47736
47856
  "node-online": "system",
47737
47857
  "node-offline": "system",
47858
+ "node-restarting": "system",
47859
+ "node-updating": "system",
47738
47860
  "node-inference-unavailable": "system",
47739
47861
  "addon-crash-loop": "system",
47740
47862
  "addon-update-available": "system",
@@ -47812,6 +47934,7 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
47812
47934
  kinds: [
47813
47935
  "node-offline",
47814
47936
  "node-online",
47937
+ "node-restarting",
47815
47938
  "node-inference-unavailable"
47816
47939
  ]
47817
47940
  },
@@ -47833,6 +47956,7 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
47833
47956
  label: "Server & container updates",
47834
47957
  kinds: [
47835
47958
  "server-update-available",
47959
+ "node-updating",
47836
47960
  "server-updated",
47837
47961
  "wrapper-update-available"
47838
47962
  ]
@@ -47980,6 +48104,7 @@ var STATE_SUMMARY_SECTION_VARS = [
47980
48104
  kinds: [
47981
48105
  "node-offline",
47982
48106
  "node-online",
48107
+ "node-restarting",
47983
48108
  "node-inference-unavailable"
47984
48109
  ]
47985
48110
  },
@@ -48001,6 +48126,7 @@ var STATE_SUMMARY_SECTION_VARS = [
48001
48126
  example: "server 1.2.377 → 1.2.378",
48002
48127
  kinds: [
48003
48128
  "server-update-available",
48129
+ "node-updating",
48004
48130
  "server-updated",
48005
48131
  "wrapper-update-available"
48006
48132
  ]
@@ -48033,7 +48159,7 @@ var STATE_SUMMARY_VARS = [
48033
48159
  {
48034
48160
  name: "summarySection",
48035
48161
  label: "Summary: this section",
48036
- description: "The section a per-section summary row is about (D698); on a summary sent as one message, every section it reports, comma-separated.",
48162
+ description: "The section a per-section summary row is about; on a summary sent as one message, every section it reports, comma-separated.",
48037
48163
  example: "Batterie scariche",
48038
48164
  group: "system",
48039
48165
  families: ["rule"],
@@ -48640,6 +48766,16 @@ DEFAULT_NATIVE_LEASE_SETTINGS.admission;
48640
48766
  var MB = 1024 * 1024;
48641
48767
  1024 * MB, 3072 * MB;
48642
48768
  //#endregion
48769
+ //#region src/hub-browser-origin.ts
48770
+ async function hubBrowserOrigin(localNetwork, logger) {
48771
+ try {
48772
+ return (await localNetwork.getHubAddresses.query()).browser.resolved;
48773
+ } catch (err) {
48774
+ logger.warn("hub address unavailable from local-network — using the localhost default", { meta: { error: err instanceof Error ? err.message : String(err) } });
48775
+ return null;
48776
+ }
48777
+ }
48778
+ //#endregion
48643
48779
  Object.defineProperty(exports, "BaseAddon", {
48644
48780
  enumerable: true,
48645
48781
  get: function() {
@@ -48688,6 +48824,12 @@ Object.defineProperty(exports, "errMsg", {
48688
48824
  return errMsg;
48689
48825
  }
48690
48826
  });
48827
+ Object.defineProperty(exports, "hubBrowserOrigin", {
48828
+ enumerable: true,
48829
+ get: function() {
48830
+ return hubBrowserOrigin;
48831
+ }
48832
+ });
48691
48833
  Object.defineProperty(exports, "loginMethodCapability", {
48692
48834
  enumerable: true,
48693
48835
  get: function() {
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../chunk-Cek0wNdY.js");
6
- const require_dist = require("../dist-CrTS14S8.js");
6
+ const require_hub_browser_origin = require("../hub-browser-origin-XYN-h9Iy.js");
7
7
  //#region src/magic-link/auth-magic-link.addon.ts
8
8
  /**
9
9
  * Magic-link authentication addon.
@@ -38,7 +38,7 @@ var DEFAULT_CONFIG = {
38
38
  defaultRole: "viewer",
39
39
  ttlSec: 600
40
40
  };
41
- var AuthMagicLinkAddon = class extends require_dist.BaseAddon {
41
+ var AuthMagicLinkAddon = class extends require_hub_browser_origin.BaseAddon {
42
42
  constructor() {
43
43
  super({ ...DEFAULT_CONFIG });
44
44
  }
@@ -53,7 +53,7 @@ var AuthMagicLinkAddon = class extends require_dist.BaseAddon {
53
53
  throw new Error("Magic link does not use callback — the email link redirects to /api/auth/sso/finish directly");
54
54
  }
55
55
  };
56
- const routeProvider = require_dist.buildAddonRouteProvider("auth-magic-link", [
56
+ const routeProvider = require_hub_browser_origin.buildAddonRouteProvider("auth-magic-link", [
57
57
  {
58
58
  method: "GET",
59
59
  path: "/start",
@@ -80,15 +80,15 @@ var AuthMagicLinkAddon = class extends require_dist.BaseAddon {
80
80
  this.ctx.logger.info("Magic-link auth provider initialized", { meta: { deliveryMode: this.config.deliveryMode } });
81
81
  return [
82
82
  {
83
- capability: require_dist.authProviderCapability,
83
+ capability: require_hub_browser_origin.authProviderCapability,
84
84
  provider: authProvider
85
85
  },
86
86
  {
87
- capability: require_dist.addonRoutesCapability,
87
+ capability: require_hub_browser_origin.addonRoutesCapability,
88
88
  provider: routeProvider
89
89
  },
90
90
  {
91
- capability: require_dist.loginMethodCapability,
91
+ capability: require_hub_browser_origin.loginMethodCapability,
92
92
  provider: loginMethodProvider
93
93
  }
94
94
  ];
@@ -134,7 +134,7 @@ var AuthMagicLinkAddon = class extends require_dist.BaseAddon {
134
134
  type: "text",
135
135
  key: "publicOrigin",
136
136
  label: "Public origin",
137
- description: "Where the email link points. Empty = read CAMSTACK_HUB_PUBLIC_URL env var.",
137
+ description: "Where the email link points. Empty = the hub address from Network (public tunnel, then mesh, then LAN).",
138
138
  default: ""
139
139
  }),
140
140
  this.field({
@@ -174,17 +174,17 @@ var AuthMagicLinkAddon = class extends require_dist.BaseAddon {
174
174
  ]
175
175
  }] });
176
176
  }
177
- buildPublicOrigin() {
177
+ async buildPublicOrigin() {
178
178
  const configured = this.config.publicOrigin?.trim();
179
179
  if (configured) return configured.replace(/\/+$/, "");
180
- return (process.env["CAMSTACK_HUB_PUBLIC_URL"] || "").replace(/\/+$/, "") || "https://localhost:4443";
180
+ return await require_hub_browser_origin.hubBrowserOrigin(this.ctx.api.localNetwork, this.ctx.logger) ?? "https://localhost:4443";
181
181
  }
182
182
  async findUserByEmail(email) {
183
183
  let users;
184
184
  try {
185
185
  users = await this.ctx.api.userManagement.listUsers.query();
186
186
  } catch (err) {
187
- this.ctx.logger.warn("Magic-link user lookup failed (user-management cap unavailable)", { meta: { message: require_dist.errMsg(err) } });
187
+ this.ctx.logger.warn("Magic-link user lookup failed (user-management cap unavailable)", { meta: { message: require_hub_browser_origin.errMsg(err) } });
188
188
  return null;
189
189
  }
190
190
  const needle = email.trim().toLowerCase();
@@ -273,12 +273,12 @@ var AuthMagicLinkAddon = class extends require_dist.BaseAddon {
273
273
  ttlSec: this.config.ttlSec || DEFAULT_CONFIG.ttlSec
274
274
  }));
275
275
  } catch (err) {
276
- this.ctx.logger.error("Magic-link bridge-token minting failed (sso-bridge unavailable)", { meta: { message: require_dist.errMsg(err) } });
276
+ this.ctx.logger.error("Magic-link bridge-token minting failed (sso-bridge unavailable)", { meta: { message: require_hub_browser_origin.errMsg(err) } });
277
277
  reply.code(503);
278
278
  reply.send({ error: "sso-bridge capability unavailable" });
279
279
  return;
280
280
  }
281
- const link = `${this.buildPublicOrigin()}/addon/auth-magic-link/login?bridge=${encodeURIComponent(token)}`;
281
+ const link = `${await this.buildPublicOrigin()}/addon/auth-magic-link/login?bridge=${encodeURIComponent(token)}`;
282
282
  if (this.config.deliveryMode === "log-only") this.ctx.logger.warn("Magic link generated (log-only mode — NOT delivered via email)", { meta: {
283
283
  email,
284
284
  link,
@@ -294,7 +294,7 @@ var AuthMagicLinkAddon = class extends require_dist.BaseAddon {
294
294
  reply.code(500);
295
295
  reply.send({
296
296
  error: "Magic-link request failed",
297
- message: require_dist.errMsg(err)
297
+ message: require_hub_browser_origin.errMsg(err)
298
298
  });
299
299
  }
300
300
  }
@@ -1,4 +1,4 @@
1
- import { a as loginMethodCapability, c as BaseAddon, i as buildAddonRouteProvider, r as authProviderCapability, s as errMsg, t as addonRoutesCapability } from "../dist-UznM2RaH.mjs";
1
+ import { a as buildAddonRouteProvider, c as errMsg, i as authProviderCapability, l as BaseAddon, n as addonRoutesCapability, o as loginMethodCapability, t as hubBrowserOrigin } from "../hub-browser-origin-DmRqQVDn.mjs";
2
2
  //#region src/magic-link/auth-magic-link.addon.ts
3
3
  /**
4
4
  * Magic-link authentication addon.
@@ -129,7 +129,7 @@ var AuthMagicLinkAddon = class extends BaseAddon {
129
129
  type: "text",
130
130
  key: "publicOrigin",
131
131
  label: "Public origin",
132
- description: "Where the email link points. Empty = read CAMSTACK_HUB_PUBLIC_URL env var.",
132
+ description: "Where the email link points. Empty = the hub address from Network (public tunnel, then mesh, then LAN).",
133
133
  default: ""
134
134
  }),
135
135
  this.field({
@@ -169,10 +169,10 @@ var AuthMagicLinkAddon = class extends BaseAddon {
169
169
  ]
170
170
  }] });
171
171
  }
172
- buildPublicOrigin() {
172
+ async buildPublicOrigin() {
173
173
  const configured = this.config.publicOrigin?.trim();
174
174
  if (configured) return configured.replace(/\/+$/, "");
175
- return (process.env["CAMSTACK_HUB_PUBLIC_URL"] || "").replace(/\/+$/, "") || "https://localhost:4443";
175
+ return await hubBrowserOrigin(this.ctx.api.localNetwork, this.ctx.logger) ?? "https://localhost:4443";
176
176
  }
177
177
  async findUserByEmail(email) {
178
178
  let users;
@@ -273,7 +273,7 @@ var AuthMagicLinkAddon = class extends BaseAddon {
273
273
  reply.send({ error: "sso-bridge capability unavailable" });
274
274
  return;
275
275
  }
276
- const link = `${this.buildPublicOrigin()}/addon/auth-magic-link/login?bridge=${encodeURIComponent(token)}`;
276
+ const link = `${await this.buildPublicOrigin()}/addon/auth-magic-link/login?bridge=${encodeURIComponent(token)}`;
277
277
  if (this.config.deliveryMode === "log-only") this.ctx.logger.warn("Magic link generated (log-only mode — NOT delivered via email)", { meta: {
278
278
  email,
279
279
  link,