@hansenexus/hud 0.1.1 → 0.3.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.
- package/README.md +106 -25
- package/dist/define-hud-BHQR8Lbv.d.ts +31 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +1198 -0
- package/dist/next.d.ts +48 -0
- package/dist/next.js +77 -0
- package/dist/plugins/vitals.d.ts +25 -0
- package/dist/plugins/vitals.js +109 -0
- package/dist/plugins-1QmTmZyL.d.ts +76 -0
- package/dist/plugins-CzUiTn_r.js +68 -0
- package/dist/server.d.ts +39 -0
- package/dist/server.js +106 -0
- package/package.json +55 -133
- package/chunk-20zke7cs.js +0 -574
- package/chunk-24vrg16w.js +0 -39
- package/chunk-50pq4sg6.js +0 -41
- package/chunk-5gtx3pza.js +0 -9
- package/chunk-6cdpasm9.js +0 -79
- package/chunk-6jt8yg4m.js +0 -117
- package/chunk-6ngkpwz7.js +0 -127
- package/chunk-71se605m.js +0 -85
- package/chunk-82nm9wcg.js +0 -316
- package/chunk-9hw5r9y1.js +0 -67
- package/chunk-c5y856ad.js +0 -98
- package/chunk-edq4jqch.js +0 -89
- package/chunk-emfnvz4p.js +0 -166
- package/chunk-h0hmjdqa.js +0 -264
- package/chunk-hc2g0n35.js +0 -24
- package/chunk-hex3wqag.js +0 -179
- package/chunk-kvxve0hx.js +0 -140
- package/chunk-kyeb6qeq.js +0 -95
- package/chunk-mz55rvw3.js +0 -172
- package/chunk-nm82wr8r.js +0 -58
- package/chunk-q15xwpy8.js +0 -48
- package/chunk-q96mkjve.js +0 -68
- package/chunk-tczzx083.js +0 -26
- package/chunk-tf774c4w.js +0 -115
- package/chunk-v086j53b.js +0 -19
- package/chunk-vjh0d29g.js +0 -52
- package/chunk-xezxydm3.js +0 -47
- package/chunk-xztw0xyt.js +0 -113
- package/chunk-yn1d38pb.js +0 -172
- package/core/access.d.mts +0 -53
- package/core/access.js +0 -27
- package/core/api-types.d.mts +0 -146
- package/core/api-types.js +0 -9
- package/core/capabilities.d.mts +0 -27
- package/core/capabilities.js +0 -14
- package/core/capture-buffer.d.mts +0 -37
- package/core/capture-buffer.js +0 -9
- package/core/force-state.d.mts +0 -68
- package/core/force-state.js +0 -21
- package/core/mock-cookie.d.mts +0 -30
- package/core/mock-cookie.js +0 -15
- package/core/types.d.mts +0 -59
- package/core/types.js +0 -9
- package/hud-provider.d.mts +0 -38
- package/hud-provider.js +0 -15
- package/hud.d.mts +0 -15
- package/hud.js +0 -18
- package/index.d.mts +0 -94
- package/index.js +0 -170
- package/lazy-panel.d.mts +0 -28
- package/lazy-panel.js +0 -11
- package/panels/cicd-panel.d.mts +0 -9
- package/panels/cicd-panel.js +0 -13
- package/panels/debug-info-panel.d.mts +0 -21
- package/panels/debug-info-panel.js +0 -9
- package/panels/dispatch-panel.d.mts +0 -10
- package/panels/dispatch-panel.js +0 -14
- package/panels/env-info-panel.d.mts +0 -9
- package/panels/env-info-panel.js +0 -12
- package/panels/feature-flags-panel.d.mts +0 -26
- package/panels/feature-flags-panel.js +0 -9
- package/panels/force-state-panel.d.mts +0 -11
- package/panels/force-state-panel.js +0 -113
- package/panels/info-row.d.mts +0 -21
- package/panels/info-row.js +0 -14
- package/panels/mock-seed-panel.d.mts +0 -15
- package/panels/mock-seed-panel.js +0 -14
- package/panels/network-console-panel.d.mts +0 -6
- package/panels/network-console-panel.js +0 -9
- package/panels/role-switcher-panel.d.mts +0 -28
- package/panels/role-switcher-panel.js +0 -9
- package/panels/sessions-panel.d.mts +0 -6
- package/panels/sessions-panel.js +0 -13
- package/panels/tokens-panel.d.mts +0 -38
- package/panels/tokens-panel.js +0 -9
- package/panels/unlock-panel.d.mts +0 -33
- package/panels/unlock-panel.js +0 -14
- package/panels/variants-panel.d.mts +0 -51
- package/panels/variants-panel.js +0 -12
- package/panels/vitals-panel.d.mts +0 -11
- package/panels/vitals-panel.js +0 -15
- package/server/guard.d.mts +0 -42
- package/server/guard.js +0 -12
- package/server/unlock.d.mts +0 -28
- package/server/unlock.js +0 -108
- package/state-boundary.d.mts +0 -25
- package/state-boundary.js +0 -54
package/core/api-types.d.mts
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Response shapes of the hud hub routes (served by console under /api/hud/*,
|
|
3
|
-
* thin proxies over console's src/lib clients — see the hud architecture
|
|
4
|
-
* decision). Shared so panels and routes cannot drift apart.
|
|
5
|
-
*/
|
|
6
|
-
interface HudSignozResponse {
|
|
7
|
-
ok: boolean;
|
|
8
|
-
service: string;
|
|
9
|
-
range: string;
|
|
10
|
-
/** "mock" when SIGNOZ_QUERY_URL is unset — the client generates demo data. */
|
|
11
|
-
source: "signoz" | "mock";
|
|
12
|
-
errorRate: number | null;
|
|
13
|
-
p95Latency: number | null;
|
|
14
|
-
requestCount: number | null;
|
|
15
|
-
}
|
|
16
|
-
interface HudCicdRun {
|
|
17
|
-
id: number;
|
|
18
|
-
name: string;
|
|
19
|
-
title: string;
|
|
20
|
-
status: string;
|
|
21
|
-
conclusion?: string | null;
|
|
22
|
-
branch?: string;
|
|
23
|
-
sha?: string;
|
|
24
|
-
url?: string;
|
|
25
|
-
startedAt?: string;
|
|
26
|
-
source: "github";
|
|
27
|
-
}
|
|
28
|
-
interface HudCicdDeployed {
|
|
29
|
-
image: string;
|
|
30
|
-
/** Prod image tags are the deployed commit sha (deploy-production.yml). */
|
|
31
|
-
sha: string;
|
|
32
|
-
lastGoodTag?: string;
|
|
33
|
-
ready: string;
|
|
34
|
-
}
|
|
35
|
-
interface HudCicdResponse {
|
|
36
|
-
ok: boolean;
|
|
37
|
-
app: string;
|
|
38
|
-
/** null when no deployment exists for the app (e.g. deploy: false apps). */
|
|
39
|
-
deployed: HudCicdDeployed | null;
|
|
40
|
-
runs: HudCicdRun[];
|
|
41
|
-
githubUnconfigured?: boolean;
|
|
42
|
-
}
|
|
43
|
-
/** Grabbed-element anchor — same shape as console's designReviewComments anchor. */
|
|
44
|
-
interface HudAnchor {
|
|
45
|
-
selector: string;
|
|
46
|
-
label: string;
|
|
47
|
-
/** Rect in viewport percentages, so it survives viewport changes. */
|
|
48
|
-
x: number;
|
|
49
|
-
y: number;
|
|
50
|
-
width: number;
|
|
51
|
-
height: number;
|
|
52
|
-
}
|
|
53
|
-
interface HudComponentHint {
|
|
54
|
-
name: string;
|
|
55
|
-
path: string;
|
|
56
|
-
}
|
|
57
|
-
interface HudDispatchPayload {
|
|
58
|
-
app: string;
|
|
59
|
-
env: string;
|
|
60
|
-
route: string;
|
|
61
|
-
anchor: HudAnchor;
|
|
62
|
-
/** Best-effort source guesses (route manifest / component manifest). */
|
|
63
|
-
componentHints: HudComponentHint[];
|
|
64
|
-
/** Tail of captured console warns/errors — PII-scrubbed by truncation. */
|
|
65
|
-
recentErrors: string[];
|
|
66
|
-
vitals: Record<string, number>;
|
|
67
|
-
grabbedAt: string;
|
|
68
|
-
}
|
|
69
|
-
type HudDispatchTarget = "docket" | "queue" | "hermes";
|
|
70
|
-
interface HudDispatchRequest {
|
|
71
|
-
target: HudDispatchTarget;
|
|
72
|
-
note: string;
|
|
73
|
-
payload: HudDispatchPayload;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* A plain work order, no HUD grab attached (#424 PR3). This is what the
|
|
77
|
-
* kommandant desktop cockpit sends: a board card (or a hand-typed form)
|
|
78
|
-
* becomes a docket dispatch without any DOM anchor to point at. Always goes
|
|
79
|
-
* through docket; there is no queue fallback for orders.
|
|
80
|
-
*/
|
|
81
|
-
interface HudOrderDispatchRequest {
|
|
82
|
-
target: "docket";
|
|
83
|
-
order: {
|
|
84
|
-
title: string;
|
|
85
|
-
app?: string;
|
|
86
|
-
/** Comma-free strings — the docket CLI's `--criteria` splits on commas. */
|
|
87
|
-
criteria?: string[];
|
|
88
|
-
/** Extra context, written into the run dir as prompt.md. */
|
|
89
|
-
prompt?: string;
|
|
90
|
-
/** Forge issue to link: order links.issue + draft PR `Closes #N`. */
|
|
91
|
-
issue?: number;
|
|
92
|
-
/** Also spawn the headless agent. Default false: a human drives. */
|
|
93
|
-
agent?: boolean;
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
type HudDispatchBody = HudDispatchRequest | HudOrderDispatchRequest;
|
|
97
|
-
declare function isOrderDispatch(body: HudDispatchBody): body is HudOrderDispatchRequest;
|
|
98
|
-
interface HudDispatchResponse {
|
|
99
|
-
ok: boolean;
|
|
100
|
-
target: HudDispatchTarget;
|
|
101
|
-
/** docket run id, when target=docket. */
|
|
102
|
-
runId?: string;
|
|
103
|
-
/** repo-relative queue marker path, when target=queue. */
|
|
104
|
-
markerPath?: string;
|
|
105
|
-
error?: string;
|
|
106
|
-
}
|
|
107
|
-
interface HudBridgeInfo {
|
|
108
|
-
port: number;
|
|
109
|
-
token: string;
|
|
110
|
-
}
|
|
111
|
-
interface HudSessionInfo {
|
|
112
|
-
sessionId: string;
|
|
113
|
-
name?: string;
|
|
114
|
-
branch?: string;
|
|
115
|
-
toplevel?: string;
|
|
116
|
-
kind?: string;
|
|
117
|
-
/** Seconds since the registry file's mtime — the liveness signal. */
|
|
118
|
-
idleSeconds: number;
|
|
119
|
-
startedAt?: string;
|
|
120
|
-
}
|
|
121
|
-
/** One app-provided seed action, offered as a button in the mock/seed panel. */
|
|
122
|
-
interface HudSeedDescriptor {
|
|
123
|
-
id: string;
|
|
124
|
-
label: string;
|
|
125
|
-
/** Convex function ref, `module:fn` (subdirs as `dir/module:fn`). */
|
|
126
|
-
fn: string;
|
|
127
|
-
args?: Record<string, unknown>;
|
|
128
|
-
/** Append `--local` (app runs a local `convex dev --local` backend). */
|
|
129
|
-
local?: boolean;
|
|
130
|
-
description?: string;
|
|
131
|
-
}
|
|
132
|
-
interface HudSeedRequest {
|
|
133
|
-
app: string;
|
|
134
|
-
fn: string;
|
|
135
|
-
args?: Record<string, unknown>;
|
|
136
|
-
local?: boolean;
|
|
137
|
-
}
|
|
138
|
-
interface HudSeedResponse {
|
|
139
|
-
ok: boolean;
|
|
140
|
-
fn: string;
|
|
141
|
-
/** Trimmed tail of the convex CLI output. */
|
|
142
|
-
output?: string;
|
|
143
|
-
error?: string;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export { type HudAnchor, type HudBridgeInfo, type HudCicdDeployed, type HudCicdResponse, type HudCicdRun, type HudComponentHint, type HudDispatchBody, type HudDispatchPayload, type HudDispatchRequest, type HudDispatchResponse, type HudDispatchTarget, type HudOrderDispatchRequest, type HudSeedDescriptor, type HudSeedRequest, type HudSeedResponse, type HudSessionInfo, type HudSignozResponse, isOrderDispatch };
|
package/core/api-types.js
DELETED
package/core/capabilities.d.mts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { HudEnv, HudCapability } from './types.mjs';
|
|
2
|
-
import 'lucide-react';
|
|
3
|
-
import 'react';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Default-deny capability matrix (see the hud plan). Client-side filtering is
|
|
7
|
-
* convenience only — every server route re-checks its env, and estate calls
|
|
8
|
-
* are additionally scoped by the console hub's token. Staging's
|
|
9
|
-
* `auth.impersonate` is further flag-gated server-side.
|
|
10
|
-
*/
|
|
11
|
-
declare const CAPABILITY_MATRIX: Record<HudEnv, readonly HudCapability[]>;
|
|
12
|
-
/**
|
|
13
|
-
* Env ladder, following `resolveDevRoutesAccess()` in @hn-monorepo/dev-routes:
|
|
14
|
-
* explicit kill switch → NODE_ENV (inlined by Next, so prod bundles tree-shake
|
|
15
|
-
* the dev branch) → explicit NEXT_PUBLIC_HUD_ENV (k8s overlays; k3s has no
|
|
16
|
-
* VERCEL_ENV) → VERCEL_ENV heuristic → production.
|
|
17
|
-
*/
|
|
18
|
-
declare function resolveHudEnv(): HudEnv;
|
|
19
|
-
/**
|
|
20
|
-
* Whether the hud renders at all. Outside development this requires the
|
|
21
|
-
* explicit opt-in flag — deployed envs get the hud only when their overlay
|
|
22
|
-
* turns it on (staging/preview in M6, production read-only in M7).
|
|
23
|
-
*/
|
|
24
|
-
declare function isHudVisible(env?: HudEnv): boolean;
|
|
25
|
-
declare function hasCapability(env: HudEnv, capability: HudCapability): boolean;
|
|
26
|
-
|
|
27
|
-
export { CAPABILITY_MATRIX, hasCapability, isHudVisible, resolveHudEnv };
|
package/core/capabilities.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CAPABILITY_MATRIX,
|
|
3
|
-
hasCapability,
|
|
4
|
-
isHudVisible,
|
|
5
|
-
resolveHudEnv
|
|
6
|
-
} from "../chunk-vjh0d29g.js";
|
|
7
|
-
import"../chunk-v086j53b.js";
|
|
8
|
-
import"../chunk-5gtx3pza.js";
|
|
9
|
-
export {
|
|
10
|
-
resolveHudEnv,
|
|
11
|
-
isHudVisible,
|
|
12
|
-
hasCapability,
|
|
13
|
-
CAPABILITY_MATRIX
|
|
14
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
type CaptureKind = "log" | "warn" | "error" | "fetch" | "longtask";
|
|
2
|
-
interface CaptureEntry {
|
|
3
|
-
id: number;
|
|
4
|
-
ts: number;
|
|
5
|
-
kind: CaptureKind;
|
|
6
|
-
text: string;
|
|
7
|
-
status?: number;
|
|
8
|
-
durationMs?: number;
|
|
9
|
-
}
|
|
10
|
-
interface CaptureEntryInput {
|
|
11
|
-
kind: CaptureKind;
|
|
12
|
-
text: string;
|
|
13
|
-
status?: number;
|
|
14
|
-
durationMs?: number;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Fixed-size ring buffer with a referentially-stable snapshot, shaped for
|
|
18
|
-
* `useSyncExternalStore`: the snapshot array is replaced on every mutation
|
|
19
|
-
* and reused between mutations.
|
|
20
|
-
*/
|
|
21
|
-
declare class CaptureBuffer {
|
|
22
|
-
private entries;
|
|
23
|
-
private snapshot;
|
|
24
|
-
private listeners;
|
|
25
|
-
private nextId;
|
|
26
|
-
private readonly maxEntries;
|
|
27
|
-
constructor(maxEntries?: number);
|
|
28
|
-
push(input: CaptureEntryInput): CaptureEntry;
|
|
29
|
-
clear(): void;
|
|
30
|
-
getSnapshot: () => readonly CaptureEntry[];
|
|
31
|
-
subscribe: (listener: () => void) => (() => void);
|
|
32
|
-
private emit;
|
|
33
|
-
}
|
|
34
|
-
/** Shared buffer the capture patches write into and the net panel reads from. */
|
|
35
|
-
declare const captureBuffer: CaptureBuffer;
|
|
36
|
-
|
|
37
|
-
export { CaptureBuffer, type CaptureEntry, type CaptureEntryInput, type CaptureKind, captureBuffer };
|
package/core/capture-buffer.js
DELETED
package/core/force-state.d.mts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Force-state store: lets a reviewer (HUD panel) or an agent (`?__state=`)
|
|
3
|
-
* render any registered state boundary as loading, empty or error without
|
|
4
|
-
* faking data (PRD #2110, issue #2117).
|
|
5
|
-
*
|
|
6
|
-
* Development only. The only importer outside the hud is `state-boundary.tsx`,
|
|
7
|
-
* which reaches this module behind a `NODE_ENV === "development"` constant, so
|
|
8
|
-
* production builds drop it; `scripts/ci/assert-no-hud-in-bundle.sh` greps the
|
|
9
|
-
* client chunks for FORCE_STATE_MARKER to prove it.
|
|
10
|
-
*/
|
|
11
|
-
declare const FORCED_STATES: readonly ["loading", "empty", "error"];
|
|
12
|
-
type ForcedState = (typeof FORCED_STATES)[number];
|
|
13
|
-
/** `?__state=loading` forces top-level boundaries; `?__state=<id>:error` one boundary. */
|
|
14
|
-
declare const FORCE_STATE_PARAM = "__state";
|
|
15
|
-
/**
|
|
16
|
-
* globalThis key of the store singleton, and the bundle-gate marker. Holding
|
|
17
|
-
* the store on globalThis keeps one instance even if the module is evaluated
|
|
18
|
-
* twice (HMR, or a second copy resolved through another node_modules path).
|
|
19
|
-
*/
|
|
20
|
-
declare const FORCE_STATE_MARKER = "__HN_FORCE_STATE__";
|
|
21
|
-
interface ForceStateParam {
|
|
22
|
-
state: ForcedState;
|
|
23
|
-
/** Boundary id the param targets; null = every top-level boundary. */
|
|
24
|
-
target: string | null;
|
|
25
|
-
}
|
|
26
|
-
interface StateBoundaryInfo {
|
|
27
|
-
id: string;
|
|
28
|
-
/** Id of the enclosing boundary; null for a top-level one. */
|
|
29
|
-
parentId: string | null;
|
|
30
|
-
}
|
|
31
|
-
interface ForceStateSnapshot {
|
|
32
|
-
boundaries: readonly StateBoundaryInfo[];
|
|
33
|
-
overrides: Readonly<Record<string, ForcedState>>;
|
|
34
|
-
param: ForceStateParam | null;
|
|
35
|
-
}
|
|
36
|
-
/** Parses the value of `?__state=`; anything unrecognised is ignored (null). */
|
|
37
|
-
declare function parseForceStateParam(value: string | null | undefined): ForceStateParam | null;
|
|
38
|
-
/** Reads the param out of a `location.search` string. */
|
|
39
|
-
declare function forceStateParamFromSearch(search: string): ForceStateParam | null;
|
|
40
|
-
/**
|
|
41
|
-
* The state a boundary renders. A panel override for the boundary wins; else
|
|
42
|
-
* the URL param applies to its target, or, untargeted, to the nearest
|
|
43
|
-
* boundaries: the top-level ones. Forcing an outer boundary unmounts the
|
|
44
|
-
* inner ones anyway, so the page-level state is what a screenshot wants.
|
|
45
|
-
*/
|
|
46
|
-
declare function resolveForcedState(snapshot: ForceStateSnapshot, boundary: StateBoundaryInfo): ForcedState | null;
|
|
47
|
-
type Listener = () => void;
|
|
48
|
-
declare class ForceStateStore {
|
|
49
|
-
private registrations;
|
|
50
|
-
private overrides;
|
|
51
|
-
private search;
|
|
52
|
-
private snapshot;
|
|
53
|
-
private listeners;
|
|
54
|
-
getSnapshot: () => ForceStateSnapshot;
|
|
55
|
-
subscribe: (listener: Listener) => (() => void);
|
|
56
|
-
/** Registers a mounted boundary; the returned function unregisters it. Mounts are counted. */
|
|
57
|
-
register(id: string, parentId: string | null): () => void;
|
|
58
|
-
/** Forces one boundary (panel toggle); null returns it to auto. */
|
|
59
|
-
force(id: string, state: ForcedState | null): void;
|
|
60
|
-
clearOverrides(): void;
|
|
61
|
-
/** Feeds the current `location.search`; a no-op when it did not change. */
|
|
62
|
-
syncSearch(search: string): void;
|
|
63
|
-
private emit;
|
|
64
|
-
}
|
|
65
|
-
/** The page's store, created on first use. */
|
|
66
|
-
declare function getForceStateStore(): ForceStateStore;
|
|
67
|
-
|
|
68
|
-
export { FORCED_STATES, FORCE_STATE_MARKER, FORCE_STATE_PARAM, type ForceStateParam, type ForceStateSnapshot, ForceStateStore, type ForcedState, type StateBoundaryInfo, forceStateParamFromSearch, getForceStateStore, parseForceStateParam, resolveForcedState };
|
package/core/force-state.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
};
|
package/core/mock-cookie.d.mts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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 };
|
package/core/mock-cookie.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
};
|
package/core/types.d.mts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
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
DELETED
package/hud-provider.d.mts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
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 };
|
package/hud-provider.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
HudProvider,
|
|
3
|
-
useHud,
|
|
4
|
-
useHudSafe,
|
|
5
|
-
useRegisterHudPanels
|
|
6
|
-
} from "./chunk-9hw5r9y1.js";
|
|
7
|
-
import"./chunk-vjh0d29g.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
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Hud
|
|
3
|
-
} from "./chunk-20zke7cs.js";
|
|
4
|
-
import"./chunk-82nm9wcg.js";
|
|
5
|
-
import"./chunk-24vrg16w.js";
|
|
6
|
-
import"./chunk-yn1d38pb.js";
|
|
7
|
-
import"./chunk-xezxydm3.js";
|
|
8
|
-
import"./chunk-kvxve0hx.js";
|
|
9
|
-
import"./chunk-6cdpasm9.js";
|
|
10
|
-
import"./chunk-9hw5r9y1.js";
|
|
11
|
-
import"./chunk-kyeb6qeq.js";
|
|
12
|
-
import"./chunk-xztw0xyt.js";
|
|
13
|
-
import"./chunk-vjh0d29g.js";
|
|
14
|
-
import"./chunk-v086j53b.js";
|
|
15
|
-
import"./chunk-5gtx3pza.js";
|
|
16
|
-
export {
|
|
17
|
-
Hud
|
|
18
|
-
};
|
package/index.d.mts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
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 };
|