@hansenexus/hud 0.1.0

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 (90) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +48 -0
  3. package/chunk-0cj8dkk7.js +127 -0
  4. package/chunk-1atxwdhw.js +48 -0
  5. package/chunk-24vrg16w.js +39 -0
  6. package/chunk-3j9sm249.js +26 -0
  7. package/chunk-50pq4sg6.js +41 -0
  8. package/chunk-5gtx3pza.js +9 -0
  9. package/chunk-6gw4x08j.js +264 -0
  10. package/chunk-6jt8yg4m.js +117 -0
  11. package/chunk-71se605m.js +85 -0
  12. package/chunk-82nm9wcg.js +316 -0
  13. package/chunk-8tam7r3h.js +68 -0
  14. package/chunk-babjpqkb.js +52 -0
  15. package/chunk-c5y856ad.js +98 -0
  16. package/chunk-ghxh8926.js +172 -0
  17. package/chunk-hc2g0n35.js +24 -0
  18. package/chunk-k0vr8dsy.js +179 -0
  19. package/chunk-k50yfp5d.js +166 -0
  20. package/chunk-kyeb6qeq.js +95 -0
  21. package/chunk-msqkkqw7.js +140 -0
  22. package/chunk-nm82wr8r.js +58 -0
  23. package/chunk-r06bpmy6.js +79 -0
  24. package/chunk-t9eh4t0b.js +89 -0
  25. package/chunk-tf774c4w.js +115 -0
  26. package/chunk-v086j53b.js +19 -0
  27. package/chunk-wspz08q7.js +67 -0
  28. package/chunk-xezxydm3.js +47 -0
  29. package/chunk-xjn0896g.js +574 -0
  30. package/chunk-xztw0xyt.js +113 -0
  31. package/chunk-zzrpd92r.js +172 -0
  32. package/core/access.d.mts +53 -0
  33. package/core/access.js +27 -0
  34. package/core/api-types.d.mts +146 -0
  35. package/core/api-types.js +9 -0
  36. package/core/capabilities.d.mts +27 -0
  37. package/core/capabilities.js +14 -0
  38. package/core/capture-buffer.d.mts +37 -0
  39. package/core/capture-buffer.js +9 -0
  40. package/core/force-state.d.mts +68 -0
  41. package/core/force-state.js +21 -0
  42. package/core/mock-cookie.d.mts +30 -0
  43. package/core/mock-cookie.js +15 -0
  44. package/core/types.d.mts +59 -0
  45. package/core/types.js +9 -0
  46. package/hud-provider.d.mts +38 -0
  47. package/hud-provider.js +15 -0
  48. package/hud.d.mts +15 -0
  49. package/hud.js +18 -0
  50. package/index.d.mts +94 -0
  51. package/index.js +170 -0
  52. package/lazy-panel.d.mts +28 -0
  53. package/lazy-panel.js +11 -0
  54. package/package.json +153 -0
  55. package/panels/cicd-panel.d.mts +9 -0
  56. package/panels/cicd-panel.js +13 -0
  57. package/panels/debug-info-panel.d.mts +21 -0
  58. package/panels/debug-info-panel.js +9 -0
  59. package/panels/dispatch-panel.d.mts +10 -0
  60. package/panels/dispatch-panel.js +14 -0
  61. package/panels/env-info-panel.d.mts +9 -0
  62. package/panels/env-info-panel.js +12 -0
  63. package/panels/feature-flags-panel.d.mts +26 -0
  64. package/panels/feature-flags-panel.js +9 -0
  65. package/panels/force-state-panel.d.mts +11 -0
  66. package/panels/force-state-panel.js +113 -0
  67. package/panels/info-row.d.mts +21 -0
  68. package/panels/info-row.js +14 -0
  69. package/panels/mock-seed-panel.d.mts +15 -0
  70. package/panels/mock-seed-panel.js +14 -0
  71. package/panels/network-console-panel.d.mts +6 -0
  72. package/panels/network-console-panel.js +9 -0
  73. package/panels/role-switcher-panel.d.mts +28 -0
  74. package/panels/role-switcher-panel.js +9 -0
  75. package/panels/sessions-panel.d.mts +6 -0
  76. package/panels/sessions-panel.js +13 -0
  77. package/panels/tokens-panel.d.mts +38 -0
  78. package/panels/tokens-panel.js +9 -0
  79. package/panels/unlock-panel.d.mts +33 -0
  80. package/panels/unlock-panel.js +14 -0
  81. package/panels/variants-panel.d.mts +51 -0
  82. package/panels/variants-panel.js +12 -0
  83. package/panels/vitals-panel.d.mts +11 -0
  84. package/panels/vitals-panel.js +15 -0
  85. package/server/guard.d.mts +42 -0
  86. package/server/guard.js +12 -0
  87. package/server/unlock.d.mts +28 -0
  88. package/server/unlock.js +108 -0
  89. package/state-boundary.d.mts +25 -0
  90. package/state-boundary.js +54 -0
@@ -0,0 +1,21 @@
1
+ import {
2
+ FORCED_STATES,
3
+ FORCE_STATE_MARKER,
4
+ FORCE_STATE_PARAM,
5
+ ForceStateStore,
6
+ forceStateParamFromSearch,
7
+ getForceStateStore,
8
+ parseForceStateParam,
9
+ resolveForcedState
10
+ } from "../chunk-c5y856ad.js";
11
+ import"../chunk-5gtx3pza.js";
12
+ export {
13
+ resolveForcedState,
14
+ parseForceStateParam,
15
+ getForceStateStore,
16
+ forceStateParamFromSearch,
17
+ ForceStateStore,
18
+ FORCE_STATE_PARAM,
19
+ FORCE_STATE_MARKER,
20
+ FORCED_STATES
21
+ };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * hud-mock cookie — the runtime mock-Convex toggle.
3
+ *
4
+ * SSR-consistency contract: the SERVER layout reads the cookie (next/headers)
5
+ * and passes the decision down as a `forceMock` prop to the app's
6
+ * ConvexClientProvider. The client never re-derives it during hydration, so
7
+ * server HTML and client render always agree. `isHudMockEnabled` is the single
8
+ * decision function both the layout (server) and any tooling use.
9
+ */
10
+ declare const HUD_MOCK_COOKIE = "hud-mock";
11
+ interface HudMockEnv {
12
+ /** process.env.NODE_ENV of the reading side. */
13
+ nodeEnv?: string;
14
+ /** NEXT_PUBLIC_HUD_ENABLED — the deployed-env opt-in flag. */
15
+ hudEnabled?: string;
16
+ }
17
+ /**
18
+ * Whether the mock override is active. The cookie only counts where the hud
19
+ * itself can exist (dev, or a deployment that explicitly opted in) — a stray
20
+ * cookie on production without the flag must be inert.
21
+ */
22
+ declare function isHudMockEnabled(cookieValue: string | undefined, env: HudMockEnv): boolean;
23
+ /** Serialized Set-Cookie/document.cookie string for the toggle. */
24
+ declare function hudMockCookieString(enabled: boolean): string;
25
+ /** Client-side read of the raw cookie value (panel display only, never render-gating). */
26
+ declare function readHudMockCookie(): string | undefined;
27
+ /** Client-side toggle. Takes effect on the next full load (the server re-reads it). */
28
+ declare function setHudMockCookie(enabled: boolean): void;
29
+
30
+ export { HUD_MOCK_COOKIE, type HudMockEnv, hudMockCookieString, isHudMockEnabled, readHudMockCookie, setHudMockCookie };
@@ -0,0 +1,15 @@
1
+ import {
2
+ HUD_MOCK_COOKIE,
3
+ hudMockCookieString,
4
+ isHudMockEnabled,
5
+ readHudMockCookie,
6
+ setHudMockCookie
7
+ } from "../chunk-hc2g0n35.js";
8
+ import"../chunk-5gtx3pza.js";
9
+ export {
10
+ setHudMockCookie,
11
+ readHudMockCookie,
12
+ isHudMockEnabled,
13
+ hudMockCookieString,
14
+ HUD_MOCK_COOKIE
15
+ };
@@ -0,0 +1,59 @@
1
+ import { LucideIcon } from 'lucide-react';
2
+ import { ReactNode } from 'react';
3
+
4
+ /**
5
+ * Where the hud believes it is running. Resolved by `resolveHudEnv()` —
6
+ * explicit `NEXT_PUBLIC_HUD_ENV` wins over heuristics because k3s deploys
7
+ * have no `VERCEL_ENV` (staging is only detectable if the overlay says so).
8
+ */
9
+ type HudEnv = "development" | "preview" | "staging" | "production" | "disabled";
10
+ /**
11
+ * Literal the CI bundle gate greps for in every app's client chunks
12
+ * (`scripts/ci/assert-no-hud-in-bundle.sh`). It is rendered as an attribute
13
+ * on the hud's chrome so a bundler cannot drop it while keeping the hud, and
14
+ * so the check has a marker that is unmistakably deliberate rather than an
15
+ * incidental string that a refactor could rename away.
16
+ */
17
+ declare const HUD_BUNDLE_MARKER = "__HN_HUD_BUNDLE_MARKER__";
18
+ declare const HUD_CAPABILITIES: readonly ["observe.app", "observe.estate", "cicd.read", "cicd.trigger", "inject.seed", "mock.toggle", "auth.impersonate", "dispatch.local", "dispatch.hermes", "variants.switch", "variants.vote", "variants.generate", "state.force"];
19
+ type HudCapability = (typeof HUD_CAPABILITIES)[number];
20
+ interface HudPanel {
21
+ id: string;
22
+ label: string;
23
+ icon: LucideIcon;
24
+ /** Required capability — the panel is dropped when the env's matrix denies it. */
25
+ capability: HudCapability;
26
+ content: ReactNode;
27
+ /** Lower sorts first in the tab bar. Default 0. */
28
+ order?: number;
29
+ }
30
+ interface HudConfig {
31
+ /** App slug as used in k8s/app-config.json (e.g. "console"). */
32
+ appSlug: string;
33
+ /** Toolbar display name. Working title until the naming vote lands. */
34
+ name?: string;
35
+ /** localStorage key for drawer height/tab persistence. Default `${appSlug}-hud`. */
36
+ storageKey?: string;
37
+ /** Drawer hotkey (Cmd/Ctrl+Shift+<key>). Default "h"; null disables. */
38
+ shortcutKey?: string | null;
39
+ /** Base path of the hud hub routes. Default "/api/hud" (same-origin proxy). */
40
+ apiBase?: string;
41
+ /**
42
+ * Source guesses for the element grabber (e.g. from the app's dev-routes
43
+ * or variant-preview manifest). Hints only — the dispatched session does
44
+ * the real lookup.
45
+ */
46
+ componentHints?: Array<{
47
+ name: string;
48
+ path: string;
49
+ }>;
50
+ /** FAB/drawer visual theme, passed through to @hn-monorepo/dev-tools. */
51
+ appearance?: "default" | "bauhaus";
52
+ /**
53
+ * Render the hud's own FAB (default true). Apps that already run a
54
+ * FloatingDockProvider set this false and register a dock item instead.
55
+ */
56
+ showFab?: boolean;
57
+ }
58
+
59
+ export { HUD_BUNDLE_MARKER, HUD_CAPABILITIES, type HudCapability, type HudConfig, type HudEnv, type HudPanel };
package/core/types.js ADDED
@@ -0,0 +1,9 @@
1
+ import {
2
+ HUD_BUNDLE_MARKER,
3
+ HUD_CAPABILITIES
4
+ } from "../chunk-v086j53b.js";
5
+ import"../chunk-5gtx3pza.js";
6
+ export {
7
+ HUD_CAPABILITIES,
8
+ HUD_BUNDLE_MARKER
9
+ };
@@ -0,0 +1,38 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { HudConfig, HudEnv, HudPanel, HudCapability } from './core/types.mjs';
4
+ import 'lucide-react';
5
+
6
+ interface HudPanelSource {
7
+ panels: HudPanel[];
8
+ /** Lower sorts first. Default 0. */
9
+ order?: number;
10
+ }
11
+ interface HudContextValue {
12
+ config: HudConfig;
13
+ env: HudEnv;
14
+ name: string;
15
+ can: (capability: HudCapability) => boolean;
16
+ /** Capability-filtered, order-sorted union of prop panels + registered sources. */
17
+ panels: HudPanel[];
18
+ registerSource: (id: string, source: HudPanelSource) => void;
19
+ unregisterSource: (id: string) => void;
20
+ }
21
+ interface HudProviderProps {
22
+ config: HudConfig;
23
+ env: HudEnv;
24
+ panels?: HudPanel[];
25
+ children: ReactNode;
26
+ }
27
+ declare function HudProvider({ config, env, panels: basePanels, children }: HudProviderProps): react.JSX.Element;
28
+ declare function useHud(): HudContextValue;
29
+ declare function useHudSafe(): HudContextValue | null;
30
+ /**
31
+ * Contribute panels from any layout/page below the provider — mirrors
32
+ * dev-tools' `useRegisterDockItems`. Pass a memo-stable `panels` array; the
33
+ * source is replaced on change and removed on unmount, so calling with an
34
+ * empty array is safe (rules-of-hooks friendly).
35
+ */
36
+ declare function useRegisterHudPanels(id: string, panels: HudPanel[], order?: number): void;
37
+
38
+ export { HudProvider, type HudProviderProps, useHud, useHudSafe, useRegisterHudPanels };
@@ -0,0 +1,15 @@
1
+ import {
2
+ HudProvider,
3
+ useHud,
4
+ useHudSafe,
5
+ useRegisterHudPanels
6
+ } from "./chunk-wspz08q7.js";
7
+ import"./chunk-babjpqkb.js";
8
+ import"./chunk-v086j53b.js";
9
+ import"./chunk-5gtx3pza.js";
10
+ export {
11
+ useRegisterHudPanels,
12
+ useHudSafe,
13
+ useHud,
14
+ HudProvider
15
+ };
package/hud.d.mts ADDED
@@ -0,0 +1,15 @@
1
+ import * as react from 'react';
2
+ import { HudConfig, HudPanel } from './core/types.mjs';
3
+ import 'lucide-react';
4
+
5
+ interface HudProps {
6
+ config: HudConfig;
7
+ panels?: HudPanel[];
8
+ }
9
+ /**
10
+ * The hud shell: env gate → drawer state → FAB + tabbed drawer. Mount once
11
+ * per app via a `ssr: false` dynamic import (see console's hud-loader).
12
+ */
13
+ declare function Hud({ config, panels }: HudProps): react.JSX.Element | null;
14
+
15
+ export { Hud, type HudProps };
package/hud.js ADDED
@@ -0,0 +1,18 @@
1
+ import {
2
+ Hud
3
+ } from "./chunk-xjn0896g.js";
4
+ import"./chunk-msqkkqw7.js";
5
+ import"./chunk-82nm9wcg.js";
6
+ import"./chunk-ghxh8926.js";
7
+ import"./chunk-xezxydm3.js";
8
+ import"./chunk-24vrg16w.js";
9
+ import"./chunk-r06bpmy6.js";
10
+ import"./chunk-wspz08q7.js";
11
+ import"./chunk-kyeb6qeq.js";
12
+ import"./chunk-xztw0xyt.js";
13
+ import"./chunk-babjpqkb.js";
14
+ import"./chunk-v086j53b.js";
15
+ import"./chunk-5gtx3pza.js";
16
+ export {
17
+ Hud
18
+ };
package/index.d.mts ADDED
@@ -0,0 +1,94 @@
1
+ import { HudBridgeInfo, HudDispatchPayload, HudAnchor, HudComponentHint } from './core/api-types.mjs';
2
+ export { HudCicdDeployed, HudCicdResponse, HudCicdRun, HudDispatchRequest, HudDispatchResponse, HudDispatchTarget, HudSeedDescriptor, HudSeedRequest, HudSeedResponse, HudSessionInfo, HudSignozResponse } from './core/api-types.mjs';
3
+ export { HUD_UNLOCK_COOKIE, HudAccess, hudRequiresUnlock, hudUnlockTtlMs, resolveHudAccess } from './core/access.mjs';
4
+ export { CAPABILITY_MATRIX, hasCapability, isHudVisible, resolveHudEnv } from './core/capabilities.mjs';
5
+ export { CaptureBuffer, CaptureEntry, CaptureKind, captureBuffer } from './core/capture-buffer.mjs';
6
+ export { HUD_MOCK_COOKIE, hudMockCookieString, isHudMockEnabled, readHudMockCookie, setHudMockCookie } from './core/mock-cookie.mjs';
7
+ import { HudConfig, HudEnv } from './core/types.mjs';
8
+ export { HUD_BUNDLE_MARKER, HUD_CAPABILITIES, HudCapability, HudPanel } from './core/types.mjs';
9
+ export { Hud, HudProps } from './hud.mjs';
10
+ export { HudProvider, HudProviderProps, useHud, useHudSafe, useRegisterHudPanels } from './hud-provider.mjs';
11
+ export { HudPanelMeta, hudLazyPanel } from './lazy-panel.mjs';
12
+ export { CicdPanel } from './panels/cicd-panel.mjs';
13
+ export { DebugInfoPanel, DebugInfoPanelProps, HudUserInfo } from './panels/debug-info-panel.mjs';
14
+ export { DispatchPanel } from './panels/dispatch-panel.mjs';
15
+ export { EnvInfoPanel } from './panels/env-info-panel.mjs';
16
+ export { FeatureFlagsPanel, HudFlagDescriptor, HudFlagsAdapter } from './panels/feature-flags-panel.mjs';
17
+ export { InfoRow, LoadingSpinner, PanelSection, ShortcutRow } from './panels/info-row.mjs';
18
+ export { MockSeedPanel } from './panels/mock-seed-panel.mjs';
19
+ export { NetworkConsolePanel } from './panels/network-console-panel.mjs';
20
+ export { HudRoleAdapter, HudRoleDescriptor, RoleSwitcherPanel } from './panels/role-switcher-panel.mjs';
21
+ export { SessionsPanel } from './panels/sessions-panel.mjs';
22
+ export { HudTokenDescriptor, HudTokenGroup, HudTokensAdapter, TokensPanel } from './panels/tokens-panel.mjs';
23
+ export { HudUnlockPanel, HudUnlockPanelProps, HudUnlockState, useHudUnlock } from './panels/unlock-panel.mjs';
24
+ export { HudGenerateRequest, HudGenerateResult, HudVariantCategory, HudVariantsAdapter, VariantsPanel } from './panels/variants-panel.mjs';
25
+ export { VitalsPanel, getVitalsSnapshot } from './panels/vitals-panel.mjs';
26
+ import 'lucide-react';
27
+ import 'react';
28
+
29
+ declare function getBridgeInfo(apiBase: string): Promise<HudBridgeInfo | null>;
30
+ declare function resetBridgeInfo(): void;
31
+ declare function bridgeFetch(info: HudBridgeInfo, path: string, init?: RequestInit): Promise<Response>;
32
+
33
+ declare function installCapture(): void;
34
+ declare function uninstallCapture(): void;
35
+
36
+ /**
37
+ * Module-level grabber state. Lives outside React because the drawer (and
38
+ * with it every panel) unmounts while grabbing — the dispatch panel closes
39
+ * the drawer, the controller in the always-mounted shell does the DOM work,
40
+ * and the payload must survive the round trip.
41
+ */
42
+ interface GrabberState {
43
+ mode: "idle" | "grabbing";
44
+ payload: HudDispatchPayload | null;
45
+ }
46
+ declare function getGrabberState(): GrabberState;
47
+ declare function subscribeGrabber(listener: () => void): () => void;
48
+ declare function startGrab(): void;
49
+ declare function cancelGrab(): void;
50
+ declare function completeGrab(payload: HudDispatchPayload): void;
51
+ declare function clearGrabbedPayload(): void;
52
+
53
+ /**
54
+ * CSS-ish path from `root` down to `el` — originally console's design-comments,
55
+ * by way of the HUD grabber. Canonical home; `@hn-monorepo/hud` re-exports it.
56
+ */
57
+ declare function buildAnchorSelector(el: Element, root: Element): string;
58
+
59
+ /**
60
+ * Viewport-relative anchor for a grab that is dispatched immediately.
61
+ *
62
+ * Correct here and only here: the payload is sent within the second, so the
63
+ * scroll offset it was measured at is still the one on screen. Anything that
64
+ * PERSISTS a position needs `capturePinAnchor` from
65
+ * `@hn-monorepo/review-kit/anchor`, which stores document-relative fractions —
66
+ * reload at a different scroll offset and these percentages point elsewhere.
67
+ */
68
+ declare function buildAnchor(el: Element): HudAnchor;
69
+ /**
70
+ * Score manifest entries against the current route + anchor label. Pure
71
+ * token overlap — a hint, not a resolution; the dispatched session does the
72
+ * real source lookup (console's design-review dispatch proves that works).
73
+ */
74
+ declare function matchComponentHints(hints: HudComponentHint[] | undefined, route: string, label: string, max?: number): HudComponentHint[];
75
+ declare function buildDispatchPayload(input: {
76
+ config: HudConfig;
77
+ env: HudEnv;
78
+ anchor: HudAnchor;
79
+ vitals: Record<string, number>;
80
+ }): HudDispatchPayload;
81
+
82
+ interface PollState<T> {
83
+ data?: T;
84
+ error?: string;
85
+ loading: boolean;
86
+ }
87
+ /**
88
+ * Minimal JSON polling for hud panels — deliberately not SWR to keep the
89
+ * package dependency-light. Pauses while the tab is hidden; a redirect
90
+ * (auth wall) or non-JSON response surfaces as a readable error.
91
+ */
92
+ declare function usePoll<T>(url: string | null, intervalMs?: number): PollState<T>;
93
+
94
+ export { HudAnchor, HudBridgeInfo, HudComponentHint, HudConfig, HudDispatchPayload, HudEnv, bridgeFetch, buildAnchor, buildAnchorSelector, buildDispatchPayload, cancelGrab, clearGrabbedPayload, completeGrab, getBridgeInfo, getGrabberState, installCapture, matchComponentHints, resetBridgeInfo, startGrab, subscribeGrabber, uninstallCapture, usePoll };
package/index.js ADDED
@@ -0,0 +1,170 @@
1
+ import {
2
+ EnvInfoPanel
3
+ } from "./chunk-0cj8dkk7.js";
4
+ import {
5
+ DispatchPanel
6
+ } from "./chunk-6gw4x08j.js";
7
+ import {
8
+ SessionsPanel
9
+ } from "./chunk-t9eh4t0b.js";
10
+ import {
11
+ NetworkConsolePanel
12
+ } from "./chunk-tf774c4w.js";
13
+ import {
14
+ FeatureFlagsPanel
15
+ } from "./chunk-71se605m.js";
16
+ import {
17
+ MockSeedPanel
18
+ } from "./chunk-k0vr8dsy.js";
19
+ import {
20
+ bridgeFetch,
21
+ getBridgeInfo,
22
+ resetBridgeInfo
23
+ } from "./chunk-50pq4sg6.js";
24
+ import {
25
+ CicdPanel
26
+ } from "./chunk-zzrpd92r.js";
27
+ import {
28
+ VariantsPanel
29
+ } from "./chunk-k50yfp5d.js";
30
+ import {
31
+ TokensPanel
32
+ } from "./chunk-nm82wr8r.js";
33
+ import {
34
+ RoleSwitcherPanel
35
+ } from "./chunk-6jt8yg4m.js";
36
+ import {
37
+ DebugInfoPanel
38
+ } from "./chunk-8tam7r3h.js";
39
+ import {
40
+ Hud,
41
+ buildAnchor,
42
+ buildAnchorSelector,
43
+ buildDispatchPayload,
44
+ installCapture,
45
+ matchComponentHints,
46
+ uninstallCapture
47
+ } from "./chunk-xjn0896g.js";
48
+ import {
49
+ HudUnlockPanel,
50
+ useHudUnlock
51
+ } from "./chunk-msqkkqw7.js";
52
+ import {
53
+ cancelGrab,
54
+ clearGrabbedPayload,
55
+ completeGrab,
56
+ getGrabberState,
57
+ startGrab,
58
+ subscribeGrabber
59
+ } from "./chunk-82nm9wcg.js";
60
+ import {
61
+ VitalsPanel,
62
+ getVitalsSnapshot
63
+ } from "./chunk-ghxh8926.js";
64
+ import {
65
+ usePoll
66
+ } from "./chunk-xezxydm3.js";
67
+ import {
68
+ CaptureBuffer,
69
+ captureBuffer
70
+ } from "./chunk-24vrg16w.js";
71
+ import {
72
+ HUD_UNLOCK_COOKIE,
73
+ hudRequiresUnlock,
74
+ hudUnlockTtlMs,
75
+ resolveHudAccess
76
+ } from "./chunk-r06bpmy6.js";
77
+ import {
78
+ HudProvider,
79
+ useHud,
80
+ useHudSafe,
81
+ useRegisterHudPanels
82
+ } from "./chunk-wspz08q7.js";
83
+ import {
84
+ hudLazyPanel
85
+ } from "./chunk-3j9sm249.js";
86
+ import {
87
+ InfoRow,
88
+ LoadingSpinner,
89
+ PanelSection,
90
+ ShortcutRow
91
+ } from "./chunk-kyeb6qeq.js";
92
+ import"./chunk-xztw0xyt.js";
93
+ import {
94
+ HUD_MOCK_COOKIE,
95
+ hudMockCookieString,
96
+ isHudMockEnabled,
97
+ readHudMockCookie,
98
+ setHudMockCookie
99
+ } from "./chunk-hc2g0n35.js";
100
+ import {
101
+ CAPABILITY_MATRIX,
102
+ hasCapability,
103
+ isHudVisible,
104
+ resolveHudEnv
105
+ } from "./chunk-babjpqkb.js";
106
+ import {
107
+ HUD_BUNDLE_MARKER,
108
+ HUD_CAPABILITIES
109
+ } from "./chunk-v086j53b.js";
110
+ import"./chunk-5gtx3pza.js";
111
+ export {
112
+ useRegisterHudPanels,
113
+ usePoll,
114
+ useHudUnlock,
115
+ useHudSafe,
116
+ useHud,
117
+ uninstallCapture,
118
+ subscribeGrabber,
119
+ startGrab,
120
+ setHudMockCookie,
121
+ resolveHudEnv,
122
+ resolveHudAccess,
123
+ resetBridgeInfo,
124
+ readHudMockCookie,
125
+ matchComponentHints,
126
+ isHudVisible,
127
+ isHudMockEnabled,
128
+ installCapture,
129
+ hudUnlockTtlMs,
130
+ hudRequiresUnlock,
131
+ hudMockCookieString,
132
+ hudLazyPanel,
133
+ hasCapability,
134
+ getVitalsSnapshot,
135
+ getGrabberState,
136
+ getBridgeInfo,
137
+ completeGrab,
138
+ clearGrabbedPayload,
139
+ captureBuffer,
140
+ cancelGrab,
141
+ buildDispatchPayload,
142
+ buildAnchorSelector,
143
+ buildAnchor,
144
+ bridgeFetch,
145
+ VitalsPanel,
146
+ VariantsPanel,
147
+ TokensPanel,
148
+ ShortcutRow,
149
+ SessionsPanel,
150
+ RoleSwitcherPanel,
151
+ PanelSection,
152
+ NetworkConsolePanel,
153
+ MockSeedPanel,
154
+ LoadingSpinner,
155
+ InfoRow,
156
+ HudUnlockPanel,
157
+ HudProvider,
158
+ Hud,
159
+ HUD_UNLOCK_COOKIE,
160
+ HUD_MOCK_COOKIE,
161
+ HUD_CAPABILITIES,
162
+ HUD_BUNDLE_MARKER,
163
+ FeatureFlagsPanel,
164
+ EnvInfoPanel,
165
+ DispatchPanel,
166
+ DebugInfoPanel,
167
+ CicdPanel,
168
+ CaptureBuffer,
169
+ CAPABILITY_MATRIX
170
+ };
@@ -0,0 +1,28 @@
1
+ import { ComponentType } from 'react';
2
+ import { HudPanel, HudEnv } from './core/types.mjs';
3
+ import 'lucide-react';
4
+
5
+ type HudPanelMeta = Omit<HudPanel, "content">;
6
+ /**
7
+ * Declare a panel whose code is only fetched where its capability is granted.
8
+ *
9
+ * The provider already drops panels the tier denies, but that happens at
10
+ * render, and the panel's module is still in the graph, so an observe-only
11
+ * production hud downloads the dispatch, seed and impersonation panels it can
12
+ * never open. Returning `null` here instead keeps `lazy()`'s `import()`
13
+ * unreached, so the bundler emits those panels as separate chunks and the
14
+ * browser never asks for them.
15
+ *
16
+ * Callers spread the result and filter: the array shape stays declarative.
17
+ *
18
+ * ```tsx
19
+ * const PANELS = [
20
+ * { id: "env", ..., content: <EnvInfoPanel /> },
21
+ * hudLazyPanel(HUD_ENV, { id: "dispatch", ..., capability: "dispatch.hermes" },
22
+ * () => import("@hn-monorepo/hud/panels/dispatch-panel").then((m) => m.DispatchPanel)),
23
+ * ].filter((panel): panel is HudPanel => panel !== null);
24
+ * ```
25
+ */
26
+ declare function hudLazyPanel(meta: HudPanelMeta, load: () => Promise<ComponentType>, env?: HudEnv): HudPanel | null;
27
+
28
+ export { type HudPanelMeta, hudLazyPanel };
package/lazy-panel.js ADDED
@@ -0,0 +1,11 @@
1
+ import {
2
+ hudLazyPanel
3
+ } from "./chunk-3j9sm249.js";
4
+ import"./chunk-kyeb6qeq.js";
5
+ import"./chunk-xztw0xyt.js";
6
+ import"./chunk-babjpqkb.js";
7
+ import"./chunk-v086j53b.js";
8
+ import"./chunk-5gtx3pza.js";
9
+ export {
10
+ hudLazyPanel
11
+ };