@hansenexus/hud 0.3.0 → 0.5.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 (172) hide show
  1. package/README.md +782 -6
  2. package/dist/a11y-B5DUaiCs.js +246 -0
  3. package/dist/a11y-panel-p_t4eD7p.js +207 -0
  4. package/dist/access-C7zlaqj6.js +100 -0
  5. package/dist/access-D_ewAEJG.d.ts +61 -0
  6. package/dist/access-panel-CEfTr9ZI.js +123 -0
  7. package/dist/adapter-BYoxPYTI.d.ts +33 -0
  8. package/dist/adapter-hcwmJtNx.js +65 -0
  9. package/dist/auto/runtime.d.ts +65 -0
  10. package/dist/auto/runtime.js +50 -0
  11. package/dist/auto.d.ts +15 -0
  12. package/dist/auto.js +33 -0
  13. package/dist/capabilities-rDSKjXpq.js +110 -0
  14. package/dist/capture-CwrIwLqi.js +300 -0
  15. package/dist/capture-buffer-Bbbo6omF.d.ts +35 -0
  16. package/dist/cli.d.ts +1 -0
  17. package/dist/cli.js +275 -0
  18. package/dist/data-panel-DhxAmP91.js +817 -0
  19. package/dist/data-store-ChF1td_P.js +164 -0
  20. package/dist/define-hud-CHPedaQ5.d.ts +50 -0
  21. package/dist/design-D0kGgPoP.js +87 -0
  22. package/dist/detect-BxHZ0pxW.d.ts +25 -0
  23. package/dist/detect-CHZiSeZs.js +63 -0
  24. package/dist/dispatch-panel-B-xr_Giy.js +279 -0
  25. package/dist/env-CApnbI0r.d.ts +19 -0
  26. package/dist/env-CaiFPIhF.js +31 -0
  27. package/dist/file-xdSaQ2uR.js +103 -0
  28. package/dist/flags-DVtaJ8pQ.d.ts +58 -0
  29. package/dist/flags.d.ts +2 -0
  30. package/dist/flags.js +82 -0
  31. package/dist/force-state-BaqWsmrf.js +153 -0
  32. package/dist/force-state-CCqoTfVB.d.ts +23 -0
  33. package/dist/force-state-panel-_otVYh9i.js +97 -0
  34. package/dist/generate-C8lQl3Eh.js +53 -0
  35. package/dist/handler-BpVhxEmU.js +106 -0
  36. package/dist/handler-DtYVCZY6.d.ts +39 -0
  37. package/dist/index-BAV_1W8a.d.ts +43 -0
  38. package/dist/index-BJ26pse9.d.ts +70 -0
  39. package/dist/index-BnQ0dTZf.d.ts +19 -0
  40. package/dist/index-CwfX-W87.d.ts +72 -0
  41. package/dist/index-DcH9V3cU.d.ts +48 -0
  42. package/dist/index-DqOyNf1u.d.ts +65 -0
  43. package/dist/index-DstI_ike.d.ts +66 -0
  44. package/dist/index-Dxz4fn4j.d.ts +42 -0
  45. package/dist/index-Hhh7OXzU.d.ts +129 -0
  46. package/dist/index-ReFbhQ9p.d.ts +25 -0
  47. package/dist/index-RgXfMBuW.d.ts +48 -0
  48. package/dist/index-gCZBO53s.d.ts +73 -0
  49. package/dist/index.d.ts +6 -36
  50. package/dist/index.js +798 -240
  51. package/dist/inspect-C9Ft8fqn.js +142 -0
  52. package/dist/inspect-root-BkaupBMp.js +429 -0
  53. package/dist/marker-C66LxOhJ.d.ts +9 -0
  54. package/dist/marker-CMrvxPmS.d.ts +12 -0
  55. package/dist/marker-DjeGvL-F.js +9 -0
  56. package/dist/marker-uZYPOJ4M.js +12 -0
  57. package/dist/markers.d.ts +3 -0
  58. package/dist/markers.js +3 -0
  59. package/dist/meta-Bv0sEao3.js +6 -0
  60. package/dist/meta-C_G7MB5w.d.ts +49 -0
  61. package/dist/mocks-CA-wM2SB.d.ts +109 -0
  62. package/dist/mocks-ESiRqk9o.js +150 -0
  63. package/dist/msw-browser-wjaYgkB7.d.ts +31 -0
  64. package/dist/next/config.d.ts +52 -0
  65. package/dist/next/config.js +78 -0
  66. package/dist/next.d.ts +14 -19
  67. package/dist/next.js +7 -30
  68. package/dist/observe-CdDnDBRP.js +89 -0
  69. package/dist/observe-panel-Cgp1M8oT.js +347 -0
  70. package/dist/ops-panel-CEqDe_UT.js +234 -0
  71. package/dist/payload-MUQ9ciER.d.ts +92 -0
  72. package/dist/plugins/a11y.d.ts +2 -0
  73. package/dist/plugins/a11y.js +2 -0
  74. package/dist/plugins/access/server.d.ts +122 -0
  75. package/dist/plugins/access/server.js +340 -0
  76. package/dist/plugins/access.d.ts +41 -0
  77. package/dist/plugins/access.js +51 -0
  78. package/dist/plugins/agent/server.d.ts +94 -0
  79. package/dist/plugins/agent/server.js +455 -0
  80. package/dist/plugins/agent.d.ts +37 -0
  81. package/dist/plugins/agent.js +69 -0
  82. package/dist/plugins/capture/server.d.ts +92 -0
  83. package/dist/plugins/capture/server.js +248 -0
  84. package/dist/plugins/capture.d.ts +24 -0
  85. package/dist/plugins/capture.js +70 -0
  86. package/dist/plugins/data/msw-browser.d.ts +2 -0
  87. package/dist/plugins/data/msw-browser.js +39 -0
  88. package/dist/plugins/data/msw-node.d.ts +36 -0
  89. package/dist/plugins/data/msw-node.js +68 -0
  90. package/dist/plugins/data/server.d.ts +257 -0
  91. package/dist/plugins/data/server.js +717 -0
  92. package/dist/plugins/data.d.ts +6 -0
  93. package/dist/plugins/data.js +51 -0
  94. package/dist/plugins/design/server.d.ts +54 -0
  95. package/dist/plugins/design/server.js +198 -0
  96. package/dist/plugins/design.d.ts +5 -0
  97. package/dist/plugins/design.js +4 -0
  98. package/dist/plugins/inspect/convex.d.ts +2 -0
  99. package/dist/plugins/inspect/convex.js +486 -0
  100. package/dist/plugins/inspect/react-query.d.ts +2 -0
  101. package/dist/plugins/inspect/react-query.js +225 -0
  102. package/dist/plugins/inspect/sockets.d.ts +51 -0
  103. package/dist/plugins/inspect/sockets.js +397 -0
  104. package/dist/plugins/inspect/swr.d.ts +2 -0
  105. package/dist/plugins/inspect/swr.js +218 -0
  106. package/dist/plugins/inspect.d.ts +4 -0
  107. package/dist/plugins/inspect.js +3 -0
  108. package/dist/plugins/observe.d.ts +4 -0
  109. package/dist/plugins/observe.js +2 -0
  110. package/dist/plugins/ops/server.d.ts +82 -0
  111. package/dist/plugins/ops/server.js +381 -0
  112. package/dist/plugins/ops.d.ts +27 -0
  113. package/dist/plugins/ops.js +41 -0
  114. package/dist/plugins/routes/server.d.ts +88 -0
  115. package/dist/plugins/routes/server.js +62 -0
  116. package/dist/plugins/routes.d.ts +3 -0
  117. package/dist/plugins/routes.js +216 -0
  118. package/dist/plugins/seo.d.ts +2 -0
  119. package/dist/plugins/seo.js +2 -0
  120. package/dist/plugins/vitals.d.ts +2 -25
  121. package/dist/plugins/vitals.js +4 -86
  122. package/dist/plugins-BZvDqGx5.d.ts +144 -0
  123. package/dist/{plugins-CzUiTn_r.js → plugins-DVy_vaYr.js} +3 -1
  124. package/dist/poll-CjKsWZi8.js +89 -0
  125. package/dist/requests-BwD6MKEq.js +282 -0
  126. package/dist/requests-CJrUf465.d.ts +50 -0
  127. package/dist/review.d.ts +181 -0
  128. package/dist/review.js +1017 -0
  129. package/dist/same-origin-BGet22CC.js +21 -0
  130. package/dist/scan-DzJNXqOk.js +165 -0
  131. package/dist/selector-NSYSe7AZ.js +28 -0
  132. package/dist/seo-Dq9q_QkO.js +551 -0
  133. package/dist/seo-panel-CfiY-TnT.js +124 -0
  134. package/dist/server.d.ts +3 -39
  135. package/dist/server.js +2 -105
  136. package/dist/sessions-panel-COvhPAzv.js +98 -0
  137. package/dist/shortcut-s_mjGeU8.js +179 -0
  138. package/dist/state-CjjZPjPJ.js +40 -0
  139. package/dist/state-boundary.d.ts +26 -0
  140. package/dist/state-boundary.js +61 -0
  141. package/dist/store/convex.d.ts +33 -0
  142. package/dist/store/convex.js +52 -0
  143. package/dist/store-CQqIIKTc.js +59 -0
  144. package/dist/store-Ync9eb1G.js +67 -0
  145. package/dist/store.d.ts +76 -0
  146. package/dist/store.js +188 -0
  147. package/dist/styles-BA8ueHoV.js +342 -0
  148. package/dist/styles-DKU_P8MH.js +139 -0
  149. package/dist/styles-DPpDPmzi.js +68 -0
  150. package/dist/tokens-panel-CbMQfasZ.js +142 -0
  151. package/dist/types-B-ulf2Jp.js +8 -0
  152. package/dist/types-BIgGf-0C.d.ts +25 -0
  153. package/dist/types-BIkI-qN8.js +30 -0
  154. package/dist/types-Cxh4twqc.d.ts +50 -0
  155. package/dist/types-DIdPfjtV.js +6 -0
  156. package/dist/types-DaJcsEjO.d.ts +44 -0
  157. package/dist/types-Dn68psVz.d.ts +118 -0
  158. package/dist/types-f3jlNxzw.d.ts +92 -0
  159. package/dist/types-szkr2QOF.d.ts +39 -0
  160. package/dist/unlock-store-4V3vR4Eg.js +96 -0
  161. package/dist/variant-groups-TIfO3NIj.js +137 -0
  162. package/dist/variant-groups-aAIrcNK5.d.ts +36 -0
  163. package/dist/variants-panel-BDoSkwBJ.js +457 -0
  164. package/dist/variants-types-CcRf119M.d.ts +63 -0
  165. package/dist/variants.d.ts +43 -0
  166. package/dist/variants.js +83 -0
  167. package/dist/vitals-panel-BCmMUntW.js +30 -0
  168. package/dist/vite.d.ts +37 -0
  169. package/dist/vite.js +134 -0
  170. package/package.json +85 -5
  171. package/dist/define-hud-BHQR8Lbv.d.ts +0 -31
  172. package/dist/plugins-1QmTmZyL.d.ts +0 -76
@@ -0,0 +1,282 @@
1
+ //#region src/plugins/observe/capture-buffer.ts
2
+ /**
3
+ * Fixed-size ring buffer with a referentially-stable snapshot, shaped for
4
+ * `useSyncExternalStore`: the snapshot array is replaced on every mutation
5
+ * and reused between mutations. Entries get an increasing `id` and a `ts`.
6
+ */
7
+ var RingBuffer = class {
8
+ entries = [];
9
+ snapshot = [];
10
+ listeners = /* @__PURE__ */ new Set();
11
+ nextId = 1;
12
+ maxEntries;
13
+ constructor(maxEntries = 500) {
14
+ this.maxEntries = maxEntries;
15
+ }
16
+ push(input) {
17
+ const entry = {
18
+ id: this.nextId++,
19
+ ts: Date.now(),
20
+ ...input
21
+ };
22
+ this.entries.push(entry);
23
+ if (this.entries.length > this.maxEntries) this.entries.splice(0, this.entries.length - this.maxEntries);
24
+ this.emit();
25
+ return entry;
26
+ }
27
+ /** Merges `patch` into the entry with `id`; a no-op once the ring has dropped it. */
28
+ update(id, patch) {
29
+ const index = this.entries.findIndex((entry) => entry.id === id);
30
+ if (index === -1) return;
31
+ this.entries[index] = {
32
+ ...this.entries[index],
33
+ ...patch
34
+ };
35
+ this.emit();
36
+ }
37
+ clear() {
38
+ if (this.entries.length === 0) return;
39
+ this.entries = [];
40
+ this.emit();
41
+ }
42
+ getSnapshot = () => this.snapshot;
43
+ subscribe = (listener) => {
44
+ this.listeners.add(listener);
45
+ return () => this.listeners.delete(listener);
46
+ };
47
+ emit() {
48
+ this.snapshot = [...this.entries];
49
+ for (const listener of this.listeners) listener();
50
+ }
51
+ };
52
+ var CaptureBuffer = class extends RingBuffer {};
53
+ /** Shared buffer the capture patches write into and the console tab reads from. */
54
+ const captureBuffer = new CaptureBuffer(500);
55
+ /**
56
+ * What the pill counts as an error: `console.error`, uncaught errors and
57
+ * rejections, and requests that failed outright or answered 5xx. A 4xx is the
58
+ * app's business (a 404 probe, a 401 before login), so it stays a plain fetch.
59
+ */
60
+ function isError(entry) {
61
+ if (entry.kind === "error") return true;
62
+ return (entry.kind === "fetch" || entry.kind === "xhr") && entry.status !== void 0 && (entry.status === 0 || entry.status >= 500);
63
+ }
64
+ //#endregion
65
+ //#region src/plugins/observe/redact.ts
66
+ /**
67
+ * Redaction for captured requests. Runs at capture time, so a secret never
68
+ * sits in the HUD's buffer: `authorization`, `cookie`, `set-cookie` and every
69
+ * header, query parameter, form field or JSON key whose name looks like a
70
+ * token are replaced with `[redacted]`, as are bearer tokens and JWTs found
71
+ * in free text.
72
+ */
73
+ const REDACTED = "[redacted]";
74
+ /**
75
+ * Known token fields, matched on the lower-cased name with `-`, `_`, `.` and
76
+ * spaces removed: `x-api-key`, `access_token`, `Set-Cookie`, `clientSecret`.
77
+ * `auth` alone (or `x-auth`) counts; `author` does not.
78
+ */
79
+ const SENSITIVE = /token|secret|password|passwd|pwd|apikey|authorization|credential|privatekey|cookie|jwt|accesskey|clientkey|signature/;
80
+ function isSensitiveKey(key) {
81
+ const normalised = key.toLowerCase().replace(/[-_.\s]/g, "");
82
+ return SENSITIVE.test(normalised) || normalised === "auth" || normalised === "xauth";
83
+ }
84
+ /** Headers as a plain lower-cased record, sensitive values replaced. */
85
+ function redactHeaders(headers) {
86
+ const out = {};
87
+ const entries = headers instanceof Headers || Symbol.iterator in headers ? headers : Object.entries(headers);
88
+ for (const [name, value] of entries) {
89
+ const key = name.toLowerCase();
90
+ out[key] = isSensitiveKey(key) ? REDACTED : value;
91
+ }
92
+ return out;
93
+ }
94
+ /** Replaces the value of every sensitive query parameter; the rest of the URL is untouched. */
95
+ function redactUrl(url) {
96
+ const query = url.indexOf("?");
97
+ if (query === -1) return url;
98
+ const hash = url.indexOf("#", query);
99
+ const search = url.slice(query + 1, hash === -1 ? void 0 : hash);
100
+ if (!search) return url;
101
+ const redacted = search.split("&").map((pair) => {
102
+ const eq = pair.indexOf("=");
103
+ const name = eq === -1 ? pair : pair.slice(0, eq);
104
+ return eq !== -1 && isSensitiveKey(safeDecode(name)) ? `${name}=${REDACTED}` : pair;
105
+ }).join("&");
106
+ return `${url.slice(0, query + 1)}${redacted}${hash === -1 ? "" : url.slice(hash)}`;
107
+ }
108
+ function safeDecode(text) {
109
+ try {
110
+ return decodeURIComponent(text);
111
+ } catch {
112
+ return text;
113
+ }
114
+ }
115
+ const BEARER = /\b(Bearer|Basic|Token)\s+[A-Za-z0-9._~+/=-]{8,}/g;
116
+ const JWT = /\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]*/g;
117
+ /** `"key": "value"` inside text that did not parse as JSON. */
118
+ const JSON_PAIR = /("([^"\\]|\\.)*")(\s*:\s*)"(?:[^"\\]|\\.)*"/g;
119
+ /** A multipart part: the disposition line, a blank line, then the value. */
120
+ const MULTIPART = /(Content-Disposition:\s*form-data;\s*name="([^"]*)"[^\r\n]*\r?\n(?:[^\r\n]+\r?\n)*\r?\n)([^\r\n]*)/gi;
121
+ /** Free-text pass: bearer tokens, JWTs, JSON-looking pairs and multipart fields. */
122
+ function redactText(text) {
123
+ return text.replace(BEARER, `$1 ${REDACTED}`).replace(JWT, REDACTED).replace(JSON_PAIR, (match, quotedKey, _inner, colon) => isSensitiveKey(quotedKey.slice(1, -1)) ? `${quotedKey}${colon}"${REDACTED}"` : match).replace(MULTIPART, (match, head, name, value) => isSensitiveKey(name) && value ? `${head}${REDACTED}` : match);
124
+ }
125
+ function redactJsonValue(value, sensitive) {
126
+ if (Array.isArray(value)) return value.map((item) => redactJsonValue(item, sensitive));
127
+ if (value !== null && typeof value === "object") {
128
+ const out = {};
129
+ for (const [key, inner] of Object.entries(value)) out[key] = redactJsonValue(inner, sensitive || isSensitiveKey(key));
130
+ return out;
131
+ }
132
+ if (sensitive && value !== null && value !== void 0) return REDACTED;
133
+ return typeof value === "string" ? redactText(value) : value;
134
+ }
135
+ /** JSON: every value under a sensitive key, at any depth, becomes `[redacted]`. */
136
+ function redactJson(value) {
137
+ return redactJsonValue(value, false);
138
+ }
139
+ function redactForm(text) {
140
+ const params = new URLSearchParams(text);
141
+ const out = new URLSearchParams();
142
+ for (const [key, value] of params) out.append(key, isSensitiveKey(key) ? REDACTED : value);
143
+ return out.toString();
144
+ }
145
+ const FORM_SHAPE = /^[^=&\s]+=[^&\n]*(&[^=&\s]+=[^&\n]*)*$/;
146
+ /**
147
+ * Redacts a captured body by its content type: JSON is walked by key, a URL
148
+ * encoded form by field, anything else gets the free-text pass.
149
+ */
150
+ function redactBody(text, contentType = "") {
151
+ const type = contentType.toLowerCase();
152
+ if (type.includes("json") || !type && /^\s*[[{]/.test(text)) try {
153
+ return JSON.stringify(redactJson(JSON.parse(text)));
154
+ } catch {}
155
+ if (type.includes("x-www-form-urlencoded") || !type && FORM_SHAPE.test(text)) return redactForm(text);
156
+ return redactText(text);
157
+ }
158
+ //#endregion
159
+ //#region src/plugins/observe/requests.ts
160
+ /**
161
+ * Detailed request capture for the inspect plugin: headers, bodies and
162
+ * timing per fetch, XHR and Server Action, redacted on the way in. The
163
+ * capture patches feed it only while a plugin asked for request detail
164
+ * (`installCapture({ requests: true })`); the console tab's one-line entries
165
+ * are always recorded.
166
+ */
167
+ /** Characters kept per body. */
168
+ const MAX_BODY = 16384;
169
+ const requestBuffer = new RingBuffer(200);
170
+ function isRequestError(entry) {
171
+ return entry.status !== void 0 && (entry.status === 0 || entry.status >= 500);
172
+ }
173
+ const TEXT_TYPES = /^(text\/|application\/(json|x-www-form-urlencoded|xml|javascript|graphql))/;
174
+ const STREAM_TYPES = /^text\/event-stream/;
175
+ /** Whether a content type is worth reading as text. Unknown types are read; binaries are not. */
176
+ function isTextType(contentType) {
177
+ if (!contentType) return true;
178
+ const type = contentType.toLowerCase();
179
+ return TEXT_TYPES.test(type) || /\+(json|xml)\b/.test(type) || type.includes("x-component");
180
+ }
181
+ function isStreamType(contentType) {
182
+ return contentType !== void 0 && STREAM_TYPES.test(contentType.toLowerCase());
183
+ }
184
+ /** Caps and redacts a text body. */
185
+ function capturedText(text, contentType) {
186
+ const truncated = text.length > MAX_BODY;
187
+ const body = redactBody(truncated ? text.slice(0, MAX_BODY) : text, contentType);
188
+ return truncated ? {
189
+ body,
190
+ bodyTruncated: true
191
+ } : { body };
192
+ }
193
+ /** Multipart fields with sensitive names redacted; files become a note. */
194
+ function capturedForm(data) {
195
+ const form = [];
196
+ for (const [name, value] of data) if (typeof value === "string") form.push([name, isSensitiveKey(name) ? REDACTED : value]);
197
+ else form.push([name, `[file ${value.name || "blob"}, ${value.size} bytes]`]);
198
+ return {
199
+ body: form.map(([name, value]) => `${name}=${value}`).join("\n"),
200
+ form
201
+ };
202
+ }
203
+ /**
204
+ * Describes a fetch `init.body` (or an XHR `send` argument) without reading a
205
+ * stream: strings and URL-encoded params are captured as text, FormData by
206
+ * field, blobs and buffers as a note.
207
+ */
208
+ function captureRequestBody(body, contentType) {
209
+ if (body === null || body === void 0) return {};
210
+ if (typeof body === "string") return capturedText(body, contentType);
211
+ if (body instanceof URLSearchParams) return capturedText(body.toString(), "application/x-www-form-urlencoded");
212
+ if (typeof FormData !== "undefined" && body instanceof FormData) return capturedForm(body);
213
+ if (typeof Blob !== "undefined" && body instanceof Blob) return { bodyNote: `[blob ${body.type || "application/octet-stream"}, ${body.size} bytes]` };
214
+ if (body instanceof ArrayBuffer || ArrayBuffer.isView(body)) return { bodyNote: `[binary, ${body.byteLength} bytes]` };
215
+ if (typeof ReadableStream !== "undefined" && body instanceof ReadableStream) return { bodyNote: "[stream]" };
216
+ return { bodyNote: "[document]" };
217
+ }
218
+ /**
219
+ * Reads a stream as text up to `MAX_BODY` characters, then cancels it. Used
220
+ * on a clone, so the app's own read is unaffected.
221
+ */
222
+ async function readCapped(stream, contentType) {
223
+ const reader = stream.getReader();
224
+ const decoder = new TextDecoder();
225
+ let text = "";
226
+ try {
227
+ while (text.length <= MAX_BODY) {
228
+ const { done, value } = await reader.read();
229
+ if (done) break;
230
+ text += decoder.decode(value, { stream: true });
231
+ }
232
+ } finally {
233
+ reader.cancel().catch(() => {});
234
+ }
235
+ return capturedText(text, contentType);
236
+ }
237
+ /** Headers, body note or body of a `Response` (its clone is read in the background). */
238
+ function captureResponse(response, onBody) {
239
+ const headers = redactHeaders(response.headers);
240
+ const contentType = headers["content-type"];
241
+ const payload = { headers };
242
+ if (!response.body) return payload;
243
+ if (isStreamType(contentType)) return {
244
+ ...payload,
245
+ bodyNote: "[stream]"
246
+ };
247
+ if (!isTextType(contentType)) return {
248
+ ...payload,
249
+ bodyNote: `[binary ${contentType}]`
250
+ };
251
+ try {
252
+ readCapped(response.clone().body ?? new ReadableStream(), contentType).then(onBody).catch((error) => onBody({ bodyNote: `[unreadable: ${String(error)}]` }));
253
+ } catch (error) {
254
+ return {
255
+ ...payload,
256
+ bodyNote: `[unreadable: ${String(error)}]`
257
+ };
258
+ }
259
+ return payload;
260
+ }
261
+ /** Parses `XMLHttpRequest.getAllResponseHeaders()`. */
262
+ function parseRawHeaders(raw) {
263
+ const out = {};
264
+ for (const line of raw.split(/\r?\n/)) {
265
+ const colon = line.indexOf(":");
266
+ if (colon <= 0) continue;
267
+ out[line.slice(0, colon).trim().toLowerCase()] = line.slice(colon + 1).trim();
268
+ }
269
+ return redactHeaders(out);
270
+ }
271
+ let pendingReplayOf;
272
+ /** Tags the next captured fetch as a replay of `id`; the fetch patch consumes it. */
273
+ function markReplay(id) {
274
+ pendingReplayOf = id;
275
+ }
276
+ function takeReplay() {
277
+ const id = pendingReplayOf;
278
+ pendingReplayOf = void 0;
279
+ return id;
280
+ }
281
+ //#endregion
282
+ export { captureBuffer as _, isRequestError as a, readCapped as c, REDACTED as d, isSensitiveKey as f, RingBuffer as g, redactUrl as h, capturedText as i, requestBuffer as l, redactHeaders as m, captureRequestBody as n, markReplay as o, redactBody as p, captureResponse as r, parseRawHeaders as s, MAX_BODY as t, takeReplay as u, isError as v };
@@ -0,0 +1,50 @@
1
+ import { i as Stamped, r as RingBuffer } from "./capture-buffer-Bbbo6omF.js";
2
+ //#region src/plugins/observe/capture.d.ts
3
+ /**
4
+ * Browser-side capture into the shared ring buffer: console.log/warn/error,
5
+ * uncaught errors and rejections, fetch and XHR timing, and long tasks. The
6
+ * observe pill installs it when the HUD mounts, so whatever happens before
7
+ * the panel is first opened is already there. With `requests: true` (the
8
+ * inspect plugin) every fetch, XHR and Server Action also lands in
9
+ * `requestBuffer` with its headers and bodies, redacted.
10
+ */
11
+ interface CaptureOptions {
12
+ /** Requests to leave out of the log. Default: the HUD's own `/api/hud/` calls. */
13
+ ignore?: (url: string) => boolean;
14
+ /** Also record headers and bodies into `requestBuffer` while this install is held. */
15
+ requests?: boolean;
16
+ }
17
+ //#endregion
18
+ //#region src/plugins/observe/requests.d.ts
19
+ type RequestTransport = "fetch" | "xhr";
20
+ interface RequestPayload {
21
+ /** Lower-cased names; sensitive values are `[redacted]`. */
22
+ headers: Record<string, string>;
23
+ /** Redacted text, at most `MAX_BODY` characters. */
24
+ body?: string;
25
+ bodyTruncated?: boolean;
26
+ /** Why there is no `body`: `[binary image/png]`, `[stream]`, `[file …]`. */
27
+ bodyNote?: string;
28
+ /** Multipart fields (files left out), so a form request can be replayed. */
29
+ form?: [string, string][];
30
+ }
31
+ interface InspectRequestInput {
32
+ transport: RequestTransport;
33
+ method: string;
34
+ /** As the app passed it, query tokens redacted. */
35
+ url: string;
36
+ /** Next Server Action id, from the `Next-Action` request header. */
37
+ actionId?: string;
38
+ /** Set on a request the inspector replayed. */
39
+ replayOf?: number;
40
+ /** Undefined while in flight; 0 when the request failed outright. */
41
+ status?: number;
42
+ error?: string;
43
+ durationMs?: number;
44
+ request: RequestPayload;
45
+ response?: RequestPayload;
46
+ }
47
+ interface InspectRequest extends InspectRequestInput, Stamped {}
48
+ declare const requestBuffer: RingBuffer<InspectRequestInput>;
49
+ //#endregion
50
+ export { CaptureOptions as a, requestBuffer as i, RequestPayload as n, RequestTransport as r, InspectRequest as t };
@@ -0,0 +1,181 @@
1
+ import { t as HUD_REVIEW_MARKER } from "./marker-C66LxOhJ.js";
2
+ //#region src/review/anchor/types.d.ts
3
+ /** Which breakpoint band a pin was planted in. Cut on Tailwind's `md` and `xl`. */
4
+ type ViewportBucket = "mobile" | "tablet" | "desktop";
5
+ /** Box in viewport percentages. Kept only to draw the highlight on a stored screenshot. */
6
+ interface PinRect {
7
+ x: number;
8
+ y: number;
9
+ width: number;
10
+ height: number;
11
+ }
12
+ /**
13
+ * Everything stored when a pin is planted.
14
+ *
15
+ * The grabber's `buildGrabAnchor` stores a viewport-relative rect, which is correct for
16
+ * a grab that is dispatched in the same second and wrong for anything that
17
+ * persists: reload at a different scroll offset and the box has moved. A pin is
18
+ * therefore located by `selector` + `docX`/`docY` (fractions of the *document*,
19
+ * not the viewport), with the viewport rect kept only for the screenshot overlay.
20
+ */
21
+ interface PinAnchor {
22
+ /** Lowercase tag name. Guards strategy 1 against matching a different node of the same shape. */
23
+ tag: string;
24
+ /** `nth-of-type` path from `document.body`. */
25
+ selector: string;
26
+ /** Unique, non-generated `#id` / `[data-testid=…]` selector, on the element or an ancestor. */
27
+ stableId?: string;
28
+ /** Path from the stable node down to the element. This is what makes strategy 2 more than a fallback. */
29
+ selectorFromStable?: string;
30
+ /** Human label, e.g. `button “Termin buchen”`. */
31
+ label: string;
32
+ /** Normalised leading text, for strategy 3. Absent when the element holds too much text to identify. */
33
+ textPrefix?: string;
34
+ /**
35
+ * Stable-ish identity for elements that carry no text — an icon button, an
36
+ * image, an input. Without it a text-less element can only ever be
37
+ * corroborated by its tag, which is far too weak.
38
+ */
39
+ signature?: string;
40
+ /** Where inside the element the reviewer clicked, 0..1. */
41
+ offsetX: number;
42
+ offsetY: number;
43
+ /** Position as a fraction of the full scrollable document — scroll-independent. */
44
+ docX: number;
45
+ docY: number;
46
+ rect: PinRect;
47
+ viewportWidth: number;
48
+ viewportHeight: number;
49
+ scrollY: number;
50
+ viewportBucket: ViewportBucket;
51
+ }
52
+ /**
53
+ * How a pin was located on this render.
54
+ *
55
+ * There is deliberately no "container" outcome. Falling back to a surviving
56
+ * ancestor was tried and removed: text matching already recovers the reshuffle
57
+ * case it was meant for, and in the only case left — the element is genuinely
58
+ * gone — putting the pin on its parent asserts that the comment still applies
59
+ * to something on screen. It does not. That pin belongs in "Ohne Position".
60
+ */
61
+ type AnchorStrategy = "exact" | "stable" | "identity";
62
+ interface AnchorResolution {
63
+ element: Element;
64
+ strategy: AnchorStrategy;
65
+ }
66
+ //#endregion
67
+ //#region src/review/anchor/capture.d.ts
68
+ interface CapturePoint {
69
+ clientX: number;
70
+ clientY: number;
71
+ }
72
+ /**
73
+ * Snapshot everything needed to find this element again on a later render, at a
74
+ * possibly different scroll offset, viewport and content revision.
75
+ */
76
+ export declare function capturePinAnchor(el: Element, point?: CapturePoint): PinAnchor;
77
+ //#endregion
78
+ //#region src/review/anchor/resolve.d.ts
79
+ /**
80
+ * Locate a stored anchor on the current document.
81
+ *
82
+ * Returns null rather than guessing. A null resolution is a first-class
83
+ * outcome, not an error: the pin is shown in the "Ohne Position" list with its
84
+ * screenshot, where it stays actionable — and a pin that stops resolving is
85
+ * itself a signal that the thing it complained about is gone.
86
+ */
87
+ export declare function resolveAnchor(anchor: PinAnchor, doc?: Document): AnchorResolution | null;
88
+ //#endregion
89
+ //#region src/review/anchor/viewport.d.ts
90
+ export declare function viewportBucket(width: number): ViewportBucket;
91
+ //#endregion
92
+ //#region src/review/backend.d.ts
93
+ interface ReviewSession {
94
+ sessionToken: string;
95
+ projectSlug: string;
96
+ displayName: string;
97
+ }
98
+ interface Reviewer {
99
+ displayName: string;
100
+ role: string;
101
+ }
102
+ interface ReviewPin {
103
+ _id: string;
104
+ number: number;
105
+ body: string;
106
+ authorName: string;
107
+ lane: "client" | "internal";
108
+ status: string;
109
+ anchor: PinAnchor;
110
+ viewportBucket: ViewportBucket;
111
+ }
112
+ interface PlantPin {
113
+ sessionToken: string;
114
+ route: string;
115
+ rawPath: string;
116
+ locale: string;
117
+ body: string;
118
+ anchor: PinAnchor;
119
+ }
120
+ /**
121
+ * What the widget needs from the review deployment. `convexReview()` is the
122
+ * one implementation; the seam exists so tests and the playground can run the
123
+ * widget without a Convex backend.
124
+ *
125
+ * `watch*` deliver the current value and every later change until the
126
+ * returned function is called. `null` from `watchReviewer` means the token is
127
+ * not (or no longer) valid.
128
+ */
129
+ interface ReviewBackend {
130
+ redeemGrant: (grant: string) => Promise<ReviewSession>;
131
+ watchReviewer: (sessionToken: string, onChange: (reviewer: Reviewer | null) => void) => () => void;
132
+ watchPins: (sessionToken: string, route: string, onChange: (pins: ReviewPin[]) => void) => () => void;
133
+ plant: (pin: PlantPin) => Promise<unknown>;
134
+ /** Releases the connection when the widget unmounts. */
135
+ close?: () => void;
136
+ }
137
+ /** The review app's Convex deployment at `url`. */
138
+ export declare function convexReview(url: string): ReviewBackend;
139
+ //#endregion
140
+ //#region src/review/review.d.ts
141
+ interface ReviewProps {
142
+ /**
143
+ * Convex deployment of the review app. Empty or absent renders nothing, so
144
+ * the mounting app can switch the widget off per deployment at runtime.
145
+ */
146
+ convexUrl?: string | undefined;
147
+ /** Project slug this surface belongs to. */
148
+ projectSlug: string;
149
+ /** Active locale, used to derive the locale-stripped route key. */
150
+ locale: string;
151
+ /** Replaces the Convex backend, for tests and the playground. Keep it stable. */
152
+ backend?: ReviewBackend | undefined;
153
+ }
154
+ /**
155
+ * The production-safe review widget: a pill, the element picker and a docked
156
+ * review sheet with the page's pins.
157
+ *
158
+ * Everything arrives as a prop and nothing is read from `process.env`. That is
159
+ * what makes the runtime gate work: an app that ships one image to two
160
+ * productions has identical build-time flags on both, so a build flag could not
161
+ * switch the widget off where it must be off. The mounting app decides, per
162
+ * deployment, by passing `convexUrl` or not.
163
+ *
164
+ * Nothing renders, and no DOM is touched, until a reviewer session exists:
165
+ * a visitor without a review link never sees a pill.
166
+ */
167
+ export declare function Review({ convexUrl, projectSlug, locale, backend }: ReviewProps): import("react").JSX.Element | null;
168
+ //#endregion
169
+ //#region src/review/route.d.ts
170
+ /**
171
+ * The route a pin belongs to.
172
+ *
173
+ * Locale-stripped on purpose: with `localePrefix: "as-needed"` the German page
174
+ * is `/standorte/wedel` and the English one `/en/standorte/wedel`. Storing the
175
+ * raw path would make those two different routes, so a pin left by a German
176
+ * reviewer would be invisible to anyone reading the English page — and the same
177
+ * layout bug would be reported once per language.
178
+ */
179
+ export declare function routeKey(pathname: string, locale: string): string;
180
+ //#endregion
181
+ export { type AnchorStrategy, HUD_REVIEW_MARKER, type PinAnchor, type PlantPin, type ReviewBackend, type ReviewPin, type ReviewProps, type ReviewSession, type Reviewer, type ViewportBucket };