@reopt-ai/opt-devtool 1.0.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 (46) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/LICENSE +21 -0
  3. package/README.md +149 -0
  4. package/dist/brandapp/index.cjs +391 -0
  5. package/dist/brandapp/index.d.cts +95 -0
  6. package/dist/brandapp/index.d.ts +95 -0
  7. package/dist/brandapp/index.js +391 -0
  8. package/dist/chunk-4MJKIAXH.cjs +65 -0
  9. package/dist/chunk-5HRIQSVF.js +32 -0
  10. package/dist/chunk-6AGUYGVT.cjs +77 -0
  11. package/dist/chunk-EQPETYJJ.cjs +32 -0
  12. package/dist/chunk-H3F2WACS.cjs +568 -0
  13. package/dist/chunk-N7YO56TN.cjs +25 -0
  14. package/dist/chunk-SQ3E3QLA.cjs +253 -0
  15. package/dist/chunk-SW2FF6EV.js +568 -0
  16. package/dist/chunk-UJSIQF3A.js +25 -0
  17. package/dist/chunk-UQY5I3WS.js +253 -0
  18. package/dist/chunk-YCYIUFB4.js +65 -0
  19. package/dist/chunk-Z2KFRHSI.js +77 -0
  20. package/dist/datagrid/index.cjs +187 -0
  21. package/dist/datagrid/index.d.cts +14 -0
  22. package/dist/datagrid/index.d.ts +14 -0
  23. package/dist/datagrid/index.js +187 -0
  24. package/dist/editor/index.cjs +239 -0
  25. package/dist/editor/index.d.cts +14 -0
  26. package/dist/editor/index.d.ts +14 -0
  27. package/dist/editor/index.js +239 -0
  28. package/dist/harness/index.cjs +13 -0
  29. package/dist/harness/index.d.cts +30 -0
  30. package/dist/harness/index.d.ts +30 -0
  31. package/dist/harness/index.js +13 -0
  32. package/dist/index-Bakx4o8Z.d.cts +91 -0
  33. package/dist/index-Bakx4o8Z.d.ts +91 -0
  34. package/dist/index.cjs +3895 -0
  35. package/dist/index.d.cts +22 -0
  36. package/dist/index.d.ts +22 -0
  37. package/dist/index.js +3895 -0
  38. package/dist/theme/index.cjs +13 -0
  39. package/dist/theme/index.d.cts +33 -0
  40. package/dist/theme/index.d.ts +33 -0
  41. package/dist/theme/index.js +13 -0
  42. package/dist/ui/index.cjs +8 -0
  43. package/dist/ui/index.d.cts +2 -0
  44. package/dist/ui/index.d.ts +2 -0
  45. package/dist/ui/index.js +8 -0
  46. package/package.json +153 -0
@@ -0,0 +1,95 @@
1
+ type BrandappDevtoolStatus = "connected" | "configured" | "missing" | "warning" | "error" | "unknown";
2
+ interface BrandappDevtoolEnvVar {
3
+ name: string;
4
+ present: boolean;
5
+ required?: boolean;
6
+ scope?: "server" | "client" | "both";
7
+ maskedValue?: string;
8
+ note?: string;
9
+ }
10
+ interface BrandappDevtoolFeature {
11
+ id: string;
12
+ label: string;
13
+ status: BrandappDevtoolStatus;
14
+ detail?: string;
15
+ }
16
+ interface BrandappDevtoolRoute {
17
+ path: string;
18
+ method?: string;
19
+ status?: BrandappDevtoolStatus;
20
+ statusCode?: number;
21
+ latencyMs?: number;
22
+ description?: string;
23
+ lastCheckedAt?: string | number;
24
+ }
25
+ interface BrandappDevtoolEavEntity {
26
+ id: string;
27
+ name?: string;
28
+ label?: string;
29
+ attributeCount?: number;
30
+ recordCount?: number;
31
+ synced?: boolean;
32
+ }
33
+ interface BrandappDevtoolEavState {
34
+ status?: BrandappDevtoolStatus;
35
+ schemaHash?: string;
36
+ lockfileHash?: string;
37
+ lastSyncAt?: string | number;
38
+ entities?: BrandappDevtoolEavEntity[];
39
+ }
40
+ interface BrandappDevtoolAuthState {
41
+ status?: BrandappDevtoolStatus;
42
+ provider?: string;
43
+ session?: "authenticated" | "anonymous" | "loading" | "unknown";
44
+ userId?: string;
45
+ organizationId?: string;
46
+ callbackPath?: string;
47
+ }
48
+ interface BrandappDevtoolAiState {
49
+ status?: BrandappDevtoolStatus;
50
+ routePath?: string;
51
+ defaultModel?: string;
52
+ models?: string[];
53
+ creditBalance?: number;
54
+ }
55
+ interface BrandappDevtoolSnapshot {
56
+ brandappId?: string | null;
57
+ clientId?: string | null;
58
+ sdkVersion?: string | null;
59
+ baseUrl?: string | null;
60
+ environment?: string | null;
61
+ updatedAt?: string | number;
62
+ auth?: BrandappDevtoolAuthState;
63
+ ai?: BrandappDevtoolAiState;
64
+ eav?: BrandappDevtoolEavState;
65
+ env?: BrandappDevtoolEnvVar[];
66
+ features?: BrandappDevtoolFeature[];
67
+ routes?: BrandappDevtoolRoute[];
68
+ notes?: string[];
69
+ }
70
+ interface UseBrandappDevtoolBridgeOptions {
71
+ id: string;
72
+ label: string;
73
+ order?: number;
74
+ /**
75
+ * Controlled snapshot. When provided, this prop is authoritative and
76
+ * returned `inspect` / `clear` callbacks do not mutate local bridge state.
77
+ */
78
+ snapshot?: BrandappDevtoolSnapshot | null;
79
+ }
80
+ interface RegisteredBrandappDevtoolBridge {
81
+ inspect: (snapshot: BrandappDevtoolSnapshot) => void;
82
+ clear: () => void;
83
+ }
84
+ /** Summarize required Brandapp env vars for status badges and diagnostics. */
85
+ declare function getBrandappRequiredEnvSummary(env: readonly BrandappDevtoolEnvVar[] | undefined): {
86
+ total: number;
87
+ present: number;
88
+ missing: string[];
89
+ };
90
+ /** Resolve the top-level Brandapp snapshot status from all reported signals. */
91
+ declare function getBrandappSnapshotStatus(snapshot: BrandappDevtoolSnapshot): BrandappDevtoolStatus;
92
+ /** Register a Brandapp SDK integration panel in opt-devtool. */
93
+ declare function useBrandappDevtoolBridge({ id, label, order, snapshot: controlledSnapshot, }: UseBrandappDevtoolBridgeOptions): RegisteredBrandappDevtoolBridge;
94
+
95
+ export { type BrandappDevtoolAiState, type BrandappDevtoolAuthState, type BrandappDevtoolEavEntity, type BrandappDevtoolEavState, type BrandappDevtoolEnvVar, type BrandappDevtoolFeature, type BrandappDevtoolRoute, type BrandappDevtoolSnapshot, type BrandappDevtoolStatus, type RegisteredBrandappDevtoolBridge, type UseBrandappDevtoolBridgeOptions, getBrandappRequiredEnvSummary, getBrandappSnapshotStatus, useBrandappDevtoolBridge };
@@ -0,0 +1,95 @@
1
+ type BrandappDevtoolStatus = "connected" | "configured" | "missing" | "warning" | "error" | "unknown";
2
+ interface BrandappDevtoolEnvVar {
3
+ name: string;
4
+ present: boolean;
5
+ required?: boolean;
6
+ scope?: "server" | "client" | "both";
7
+ maskedValue?: string;
8
+ note?: string;
9
+ }
10
+ interface BrandappDevtoolFeature {
11
+ id: string;
12
+ label: string;
13
+ status: BrandappDevtoolStatus;
14
+ detail?: string;
15
+ }
16
+ interface BrandappDevtoolRoute {
17
+ path: string;
18
+ method?: string;
19
+ status?: BrandappDevtoolStatus;
20
+ statusCode?: number;
21
+ latencyMs?: number;
22
+ description?: string;
23
+ lastCheckedAt?: string | number;
24
+ }
25
+ interface BrandappDevtoolEavEntity {
26
+ id: string;
27
+ name?: string;
28
+ label?: string;
29
+ attributeCount?: number;
30
+ recordCount?: number;
31
+ synced?: boolean;
32
+ }
33
+ interface BrandappDevtoolEavState {
34
+ status?: BrandappDevtoolStatus;
35
+ schemaHash?: string;
36
+ lockfileHash?: string;
37
+ lastSyncAt?: string | number;
38
+ entities?: BrandappDevtoolEavEntity[];
39
+ }
40
+ interface BrandappDevtoolAuthState {
41
+ status?: BrandappDevtoolStatus;
42
+ provider?: string;
43
+ session?: "authenticated" | "anonymous" | "loading" | "unknown";
44
+ userId?: string;
45
+ organizationId?: string;
46
+ callbackPath?: string;
47
+ }
48
+ interface BrandappDevtoolAiState {
49
+ status?: BrandappDevtoolStatus;
50
+ routePath?: string;
51
+ defaultModel?: string;
52
+ models?: string[];
53
+ creditBalance?: number;
54
+ }
55
+ interface BrandappDevtoolSnapshot {
56
+ brandappId?: string | null;
57
+ clientId?: string | null;
58
+ sdkVersion?: string | null;
59
+ baseUrl?: string | null;
60
+ environment?: string | null;
61
+ updatedAt?: string | number;
62
+ auth?: BrandappDevtoolAuthState;
63
+ ai?: BrandappDevtoolAiState;
64
+ eav?: BrandappDevtoolEavState;
65
+ env?: BrandappDevtoolEnvVar[];
66
+ features?: BrandappDevtoolFeature[];
67
+ routes?: BrandappDevtoolRoute[];
68
+ notes?: string[];
69
+ }
70
+ interface UseBrandappDevtoolBridgeOptions {
71
+ id: string;
72
+ label: string;
73
+ order?: number;
74
+ /**
75
+ * Controlled snapshot. When provided, this prop is authoritative and
76
+ * returned `inspect` / `clear` callbacks do not mutate local bridge state.
77
+ */
78
+ snapshot?: BrandappDevtoolSnapshot | null;
79
+ }
80
+ interface RegisteredBrandappDevtoolBridge {
81
+ inspect: (snapshot: BrandappDevtoolSnapshot) => void;
82
+ clear: () => void;
83
+ }
84
+ /** Summarize required Brandapp env vars for status badges and diagnostics. */
85
+ declare function getBrandappRequiredEnvSummary(env: readonly BrandappDevtoolEnvVar[] | undefined): {
86
+ total: number;
87
+ present: number;
88
+ missing: string[];
89
+ };
90
+ /** Resolve the top-level Brandapp snapshot status from all reported signals. */
91
+ declare function getBrandappSnapshotStatus(snapshot: BrandappDevtoolSnapshot): BrandappDevtoolStatus;
92
+ /** Register a Brandapp SDK integration panel in opt-devtool. */
93
+ declare function useBrandappDevtoolBridge({ id, label, order, snapshot: controlledSnapshot, }: UseBrandappDevtoolBridgeOptions): RegisteredBrandappDevtoolBridge;
94
+
95
+ export { type BrandappDevtoolAiState, type BrandappDevtoolAuthState, type BrandappDevtoolEavEntity, type BrandappDevtoolEavState, type BrandappDevtoolEnvVar, type BrandappDevtoolFeature, type BrandappDevtoolRoute, type BrandappDevtoolSnapshot, type BrandappDevtoolStatus, type RegisteredBrandappDevtoolBridge, type UseBrandappDevtoolBridgeOptions, getBrandappRequiredEnvSummary, getBrandappSnapshotStatus, useBrandappDevtoolBridge };
@@ -0,0 +1,391 @@
1
+ "use client";
2
+ "use client";
3
+ import {
4
+ useOptDevtoolPlugin
5
+ } from "../chunk-Z2KFRHSI.js";
6
+ import "../chunk-UJSIQF3A.js";
7
+
8
+ // src/brandapp/index.tsx
9
+ import * as React from "react";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ var STATUS_STYLES = {
12
+ connected: "bg-emerald-400",
13
+ configured: "bg-blue-400",
14
+ missing: "bg-red-400",
15
+ warning: "bg-amber-300",
16
+ error: "bg-red-400",
17
+ unknown: "bg-white/25"
18
+ };
19
+ var STATUS_TEXT_STYLES = {
20
+ connected: "text-emerald-300",
21
+ configured: "text-blue-300",
22
+ missing: "text-red-300",
23
+ warning: "text-amber-300",
24
+ error: "text-red-300",
25
+ unknown: "text-white/45"
26
+ };
27
+ function statusLabel(status) {
28
+ return status != null ? status : "unknown";
29
+ }
30
+ function getBrandappRequiredEnvSummary(env) {
31
+ const required = (env != null ? env : []).filter((item) => item.required);
32
+ return {
33
+ total: required.length,
34
+ present: required.filter((item) => item.present).length,
35
+ missing: required.filter((item) => !item.present).map((item) => item.name)
36
+ };
37
+ }
38
+ function getBrandappSnapshotStatus(snapshot) {
39
+ var _a, _b, _c, _d, _e;
40
+ const requiredEnv = getBrandappRequiredEnvSummary(snapshot.env);
41
+ const statuses = [
42
+ (_a = snapshot.auth) == null ? void 0 : _a.status,
43
+ (_b = snapshot.eav) == null ? void 0 : _b.status,
44
+ (_c = snapshot.ai) == null ? void 0 : _c.status,
45
+ ...((_d = snapshot.features) != null ? _d : []).map((feature) => feature.status),
46
+ ...((_e = snapshot.routes) != null ? _e : []).map((route) => route.status)
47
+ ];
48
+ if (statuses.includes("error")) {
49
+ return "error";
50
+ }
51
+ if (requiredEnv.missing.length > 0 || statuses.includes("missing")) {
52
+ return "missing";
53
+ }
54
+ if (statuses.includes("warning")) {
55
+ return "warning";
56
+ }
57
+ if (statuses.includes("connected")) {
58
+ return "connected";
59
+ }
60
+ if (statuses.includes("configured")) {
61
+ return "configured";
62
+ }
63
+ return "unknown";
64
+ }
65
+ function formatDate(value) {
66
+ if (value === void 0) {
67
+ return "-";
68
+ }
69
+ const date = typeof value === "number" ? new Date(value) : new Date(value);
70
+ if (Number.isNaN(date.getTime())) {
71
+ return String(value);
72
+ }
73
+ return date.toLocaleString();
74
+ }
75
+ function formatOptional(value) {
76
+ if (value === null || value === void 0 || value === "") {
77
+ return "-";
78
+ }
79
+ return String(value);
80
+ }
81
+ function StatusDot({
82
+ status,
83
+ label
84
+ }) {
85
+ const resolved = status != null ? status : "unknown";
86
+ return /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
87
+ /* @__PURE__ */ jsx(
88
+ "span",
89
+ {
90
+ className: `inline-block h-1.5 w-1.5 rounded-full ${STATUS_STYLES[resolved]}`
91
+ }
92
+ ),
93
+ /* @__PURE__ */ jsx("span", { className: STATUS_TEXT_STYLES[resolved], children: label })
94
+ ] });
95
+ }
96
+ function InfoRow({
97
+ label,
98
+ value
99
+ }) {
100
+ return /* @__PURE__ */ jsxs("div", { className: "grid min-w-0 grid-cols-[5.75rem_minmax(0,1fr)] items-center gap-1 rounded-md bg-white/[0.035] px-2 py-1", children: [
101
+ /* @__PURE__ */ jsx("span", { className: "truncate text-[9px] font-semibold tracking-wide text-white/35 uppercase", children: label }),
102
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate rounded bg-black/20 px-1.5 py-0.5 text-right font-mono text-[10px] text-white/78", children: formatOptional(value) })
103
+ ] });
104
+ }
105
+ function CollapsibleGroup({
106
+ title,
107
+ trailing,
108
+ defaultOpen = true,
109
+ children
110
+ }) {
111
+ const [open, setOpen] = React.useState(defaultOpen);
112
+ return /* @__PURE__ */ jsxs("section", { className: "overflow-hidden rounded-lg bg-white/[0.025]", children: [
113
+ /* @__PURE__ */ jsxs(
114
+ "button",
115
+ {
116
+ type: "button",
117
+ tabIndex: -1,
118
+ onClick: () => setOpen((current) => !current),
119
+ className: "flex w-full items-center justify-between gap-2 bg-white/[0.045] px-2.5 py-1.5 text-left transition-colors hover:bg-white/[0.065]",
120
+ "aria-expanded": open,
121
+ children: [
122
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-1.5", children: [
123
+ /* @__PURE__ */ jsx("span", { className: "text-[9px] text-white/35", children: open ? "\u25BE" : "\u25B8" }),
124
+ /* @__PURE__ */ jsx("span", { className: "truncate text-[10px] font-semibold text-emerald-400", children: title })
125
+ ] }),
126
+ trailing
127
+ ]
128
+ }
129
+ ),
130
+ open ? /* @__PURE__ */ jsx("div", { className: "px-2.5 py-2", children }) : null
131
+ ] });
132
+ }
133
+ function SummaryPanel({ snapshot }) {
134
+ const requiredEnv = getBrandappRequiredEnvSummary(snapshot.env);
135
+ const status = getBrandappSnapshotStatus(snapshot);
136
+ const statusText = statusLabel(status);
137
+ return /* @__PURE__ */ jsxs("section", { className: "rounded-lg bg-white/[0.05] px-2.5 py-2", children: [
138
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
139
+ /* @__PURE__ */ jsx(StatusDot, { status, label: `Brandapp ${statusText}` }),
140
+ /* @__PURE__ */ jsxs("span", { className: "rounded bg-black/20 px-1.5 py-0.5 font-mono text-[9px] text-white/55", children: [
141
+ "env ",
142
+ requiredEnv.present,
143
+ "/",
144
+ requiredEnv.total
145
+ ] })
146
+ ] }),
147
+ requiredEnv.missing.length > 0 ? /* @__PURE__ */ jsx("div", { className: "mt-1.5 flex flex-wrap gap-1", children: requiredEnv.missing.map((name) => /* @__PURE__ */ jsxs(
148
+ "span",
149
+ {
150
+ className: "rounded bg-red-500/15 px-1.5 py-0.5 font-mono text-[9px] text-red-200",
151
+ children: [
152
+ "missing ",
153
+ name
154
+ ]
155
+ },
156
+ name
157
+ )) }) : null
158
+ ] });
159
+ }
160
+ function FeatureList({
161
+ features
162
+ }) {
163
+ if (!features || features.length === 0) {
164
+ return /* @__PURE__ */ jsx("div", { className: "text-[10px] text-white/40", children: "No feature signals." });
165
+ }
166
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: features.map((feature) => /* @__PURE__ */ jsxs(
167
+ "div",
168
+ {
169
+ className: "grid min-w-0 grid-cols-[6.5rem_minmax(0,1fr)] items-start gap-1 rounded-md bg-white/[0.035] px-2 py-1",
170
+ children: [
171
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: /* @__PURE__ */ jsx(StatusDot, { status: feature.status, label: feature.label }) }),
172
+ feature.detail ? /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate rounded bg-black/20 px-1.5 py-0.5 font-mono text-[9px] text-white/55", children: feature.detail }) : /* @__PURE__ */ jsx("span", { className: "rounded bg-black/20 px-1.5 py-0.5 font-mono text-[9px] text-white/35", children: "-" })
173
+ ]
174
+ },
175
+ feature.id
176
+ )) });
177
+ }
178
+ function EnvList({
179
+ env
180
+ }) {
181
+ if (!env || env.length === 0) {
182
+ return /* @__PURE__ */ jsx("div", { className: "text-[10px] text-white/40", children: "No env signals." });
183
+ }
184
+ const requiredEnv = getBrandappRequiredEnvSummary(env);
185
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
186
+ requiredEnv.missing.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "rounded bg-red-500/12 px-2 py-1 text-[10px] text-red-200", children: [
187
+ "Missing required env: ",
188
+ requiredEnv.missing.join(", ")
189
+ ] }) : null,
190
+ env.map((item) => {
191
+ var _a, _b;
192
+ const status = item.present ? "configured" : item.required ? "missing" : "unknown";
193
+ return /* @__PURE__ */ jsxs(
194
+ "div",
195
+ {
196
+ className: "grid grid-cols-[minmax(0,1fr)_minmax(4.5rem,auto)] gap-1 rounded-md bg-white/[0.035] px-2 py-1",
197
+ children: [
198
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
199
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [
200
+ /* @__PURE__ */ jsx(StatusDot, { status, label: item.name }),
201
+ item.required ? /* @__PURE__ */ jsx("span", { className: "rounded bg-amber-400/12 px-1 py-0.5 text-[8px] text-amber-300", children: "required" }) : null
202
+ ] }),
203
+ item.note ? /* @__PURE__ */ jsx("div", { className: "truncate pl-3 text-[9px] text-white/35", children: item.note }) : null
204
+ ] }),
205
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate rounded bg-black/20 px-1.5 py-0.5 text-right font-mono text-[9px] text-white/55", children: (_b = (_a = item.maskedValue) != null ? _a : item.scope) != null ? _b : "" })
206
+ ]
207
+ },
208
+ item.name
209
+ );
210
+ })
211
+ ] });
212
+ }
213
+ function RouteList({
214
+ routes
215
+ }) {
216
+ if (!routes || routes.length === 0) {
217
+ return /* @__PURE__ */ jsx("div", { className: "text-[10px] text-white/40", children: "No route signals." });
218
+ }
219
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: routes.map((route) => {
220
+ var _a, _b, _c;
221
+ const status = (_a = route.status) != null ? _a : "unknown";
222
+ return /* @__PURE__ */ jsxs(
223
+ "div",
224
+ {
225
+ className: "min-w-0 rounded-md bg-white/[0.035] px-2 py-1",
226
+ children: [
227
+ /* @__PURE__ */ jsxs("div", { className: "grid min-w-0 grid-cols-[3.25rem_minmax(0,1fr)] items-center gap-1", children: [
228
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: /* @__PURE__ */ jsx(StatusDot, { status, label: (_c = route.method) != null ? _c : "GET" }) }),
229
+ /* @__PURE__ */ jsx("span", { className: "truncate rounded bg-black/20 px-1.5 py-0.5 font-mono text-[10px] text-white/75", children: route.path })
230
+ ] }),
231
+ route.statusCode !== void 0 || route.latencyMs !== void 0 || route.lastCheckedAt !== void 0 ? /* @__PURE__ */ jsxs("div", { className: "mt-1 flex flex-wrap gap-1 pl-[3.75rem]", children: [
232
+ route.statusCode !== void 0 ? /* @__PURE__ */ jsx("span", { className: "rounded bg-black/20 px-1.5 py-0.5 text-[9px] text-white/45", children: route.statusCode }) : null,
233
+ route.latencyMs !== void 0 ? /* @__PURE__ */ jsxs("span", { className: "rounded bg-black/20 px-1.5 py-0.5 text-[9px] text-white/45", children: [
234
+ route.latencyMs,
235
+ "ms"
236
+ ] }) : null,
237
+ route.lastCheckedAt !== void 0 ? /* @__PURE__ */ jsx("span", { className: "rounded bg-black/20 px-1.5 py-0.5 text-[9px] text-white/40", children: formatDate(route.lastCheckedAt) }) : null
238
+ ] }) : null,
239
+ route.description ? /* @__PURE__ */ jsx("div", { className: "truncate pl-3 text-[9px] text-white/35", children: route.description }) : null
240
+ ]
241
+ },
242
+ `${(_b = route.method) != null ? _b : "GET"} ${route.path}`
243
+ );
244
+ }) });
245
+ }
246
+ function formatEntityMetric(entity) {
247
+ if (entity.recordCount !== void 0) {
248
+ return `${entity.recordCount} rows`;
249
+ }
250
+ if (entity.attributeCount !== void 0) {
251
+ return `${entity.attributeCount} attrs`;
252
+ }
253
+ if (entity.synced) {
254
+ return "synced";
255
+ }
256
+ return entity.id;
257
+ }
258
+ function EavPanel({ eav }) {
259
+ if (!eav) {
260
+ return /* @__PURE__ */ jsx("div", { className: "text-[10px] text-white/40", children: "No EAV signal." });
261
+ }
262
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
263
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-x-3 gap-y-1 text-[10px] md:grid-cols-2", children: [
264
+ /* @__PURE__ */ jsx(InfoRow, { label: "status", value: statusLabel(eav.status) }),
265
+ /* @__PURE__ */ jsx(InfoRow, { label: "schema", value: eav.schemaHash }),
266
+ /* @__PURE__ */ jsx(InfoRow, { label: "lockfile", value: eav.lockfileHash }),
267
+ /* @__PURE__ */ jsx(InfoRow, { label: "sync", value: formatDate(eav.lastSyncAt) })
268
+ ] }),
269
+ eav.entities && eav.entities.length > 0 ? /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: eav.entities.slice(0, 6).map((entity) => {
270
+ var _a, _b;
271
+ return /* @__PURE__ */ jsxs(
272
+ "div",
273
+ {
274
+ className: "grid grid-cols-[minmax(0,1fr)_auto] gap-1 rounded-md bg-white/[0.035] px-2 py-1 text-[10px]",
275
+ children: [
276
+ /* @__PURE__ */ jsx("span", { className: "truncate text-white/70", children: (_b = (_a = entity.label) != null ? _a : entity.name) != null ? _b : entity.id }),
277
+ /* @__PURE__ */ jsx("span", { className: "rounded bg-black/20 px-1.5 py-0.5 font-mono text-white/55", children: formatEntityMetric(entity) })
278
+ ]
279
+ },
280
+ entity.id
281
+ );
282
+ }) }) : null
283
+ ] });
284
+ }
285
+ function BrandappDevtoolPanel({
286
+ snapshot
287
+ }) {
288
+ var _a, _b, _c, _d, _e, _f, _g, _h;
289
+ if (!snapshot) {
290
+ return /* @__PURE__ */ jsx("div", { className: "text-[11px] text-white/55", children: "Waiting for Brandapp SDK snapshot." });
291
+ }
292
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 text-[11px]", children: [
293
+ /* @__PURE__ */ jsx(SummaryPanel, { snapshot }),
294
+ /* @__PURE__ */ jsx(CollapsibleGroup, { title: "Identity", children: /* @__PURE__ */ jsxs("div", { className: "grid gap-x-3 gap-y-1 text-[10px] md:grid-cols-2", children: [
295
+ /* @__PURE__ */ jsx(InfoRow, { label: "brandappId", value: snapshot.brandappId }),
296
+ /* @__PURE__ */ jsx(InfoRow, { label: "clientId", value: snapshot.clientId }),
297
+ /* @__PURE__ */ jsx(InfoRow, { label: "baseUrl", value: snapshot.baseUrl }),
298
+ /* @__PURE__ */ jsx(InfoRow, { label: "sdk", value: snapshot.sdkVersion }),
299
+ /* @__PURE__ */ jsx(InfoRow, { label: "env", value: snapshot.environment }),
300
+ /* @__PURE__ */ jsx(InfoRow, { label: "updated", value: formatDate(snapshot.updatedAt) })
301
+ ] }) }),
302
+ /* @__PURE__ */ jsxs(CollapsibleGroup, { title: "Connection", children: [
303
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-x-3 gap-y-1.5 text-white/70", children: [
304
+ /* @__PURE__ */ jsx(StatusDot, { status: (_a = snapshot.auth) == null ? void 0 : _a.status, label: "Auth" }),
305
+ /* @__PURE__ */ jsx(StatusDot, { status: (_b = snapshot.eav) == null ? void 0 : _b.status, label: "EAV" }),
306
+ /* @__PURE__ */ jsx(StatusDot, { status: (_c = snapshot.ai) == null ? void 0 : _c.status, label: "AI" }),
307
+ ((_d = snapshot.auth) == null ? void 0 : _d.session) ? /* @__PURE__ */ jsxs("span", { className: "text-white/45", children: [
308
+ "session: ",
309
+ snapshot.auth.session
310
+ ] }) : null
311
+ ] }),
312
+ /* @__PURE__ */ jsxs("div", { className: "mt-1 grid gap-x-3 gap-y-1 text-[10px] md:grid-cols-2", children: [
313
+ /* @__PURE__ */ jsx(InfoRow, { label: "provider", value: (_e = snapshot.auth) == null ? void 0 : _e.provider }),
314
+ /* @__PURE__ */ jsx(InfoRow, { label: "callback", value: (_f = snapshot.auth) == null ? void 0 : _f.callbackPath }),
315
+ /* @__PURE__ */ jsx(InfoRow, { label: "user", value: (_g = snapshot.auth) == null ? void 0 : _g.userId }),
316
+ /* @__PURE__ */ jsx(InfoRow, { label: "org", value: (_h = snapshot.auth) == null ? void 0 : _h.organizationId })
317
+ ] })
318
+ ] }),
319
+ /* @__PURE__ */ jsx(CollapsibleGroup, { title: "Features", children: /* @__PURE__ */ jsx(FeatureList, { features: snapshot.features }) }),
320
+ /* @__PURE__ */ jsx(CollapsibleGroup, { title: "Environment", children: /* @__PURE__ */ jsx(EnvList, { env: snapshot.env }) }),
321
+ /* @__PURE__ */ jsx(CollapsibleGroup, { title: "EAV", children: /* @__PURE__ */ jsx(EavPanel, { eav: snapshot.eav }) }),
322
+ /* @__PURE__ */ jsx(CollapsibleGroup, { title: "Routes", children: /* @__PURE__ */ jsx(RouteList, { routes: snapshot.routes }) }),
323
+ snapshot.ai ? /* @__PURE__ */ jsxs(CollapsibleGroup, { title: "AI", children: [
324
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-x-3 gap-y-1 text-[10px] md:grid-cols-2", children: [
325
+ /* @__PURE__ */ jsx(InfoRow, { label: "status", value: statusLabel(snapshot.ai.status) }),
326
+ /* @__PURE__ */ jsx(InfoRow, { label: "route", value: snapshot.ai.routePath }),
327
+ /* @__PURE__ */ jsx(InfoRow, { label: "model", value: snapshot.ai.defaultModel }),
328
+ /* @__PURE__ */ jsx(InfoRow, { label: "credits", value: snapshot.ai.creditBalance })
329
+ ] }),
330
+ snapshot.ai.models && snapshot.ai.models.length > 0 ? /* @__PURE__ */ jsx("div", { className: "mt-1 flex flex-wrap gap-1", children: snapshot.ai.models.map((model) => /* @__PURE__ */ jsx(
331
+ "span",
332
+ {
333
+ className: "rounded bg-white/[0.055] px-1.5 py-0.5 text-[9px] text-white/60",
334
+ children: model
335
+ },
336
+ model
337
+ )) }) : null
338
+ ] }) : null,
339
+ snapshot.notes && snapshot.notes.length > 0 ? /* @__PURE__ */ jsx(CollapsibleGroup, { title: "Notes", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1 text-[10px] text-white/50", children: snapshot.notes.map((note, index) => /* @__PURE__ */ jsx(
340
+ "div",
341
+ {
342
+ className: "rounded bg-white/[0.035] px-2 py-1",
343
+ children: note
344
+ },
345
+ `${index}-${note}`
346
+ )) }) }) : null
347
+ ] });
348
+ }
349
+ function useBrandappDevtoolBridge({
350
+ id,
351
+ label,
352
+ order = 10,
353
+ snapshot: controlledSnapshot
354
+ }) {
355
+ const isControlled = controlledSnapshot !== void 0;
356
+ const [uncontrolledSnapshot, setUncontrolledSnapshot] = React.useState(controlledSnapshot != null ? controlledSnapshot : null);
357
+ const snapshot = isControlled ? controlledSnapshot : uncontrolledSnapshot;
358
+ const inspect = React.useCallback(
359
+ (nextSnapshot) => {
360
+ if (!isControlled) {
361
+ setUncontrolledSnapshot(nextSnapshot);
362
+ }
363
+ },
364
+ [isControlled]
365
+ );
366
+ const clear = React.useCallback(() => {
367
+ if (!isControlled) {
368
+ setUncontrolledSnapshot(null);
369
+ }
370
+ }, [isControlled]);
371
+ const plugin = React.useMemo(
372
+ () => ({
373
+ id,
374
+ label,
375
+ order,
376
+ tab: "brandapp",
377
+ renderPanel: () => /* @__PURE__ */ jsx(BrandappDevtoolPanel, { snapshot })
378
+ }),
379
+ [id, label, order, snapshot]
380
+ );
381
+ useOptDevtoolPlugin(plugin);
382
+ return {
383
+ inspect,
384
+ clear
385
+ };
386
+ }
387
+ export {
388
+ getBrandappRequiredEnvSummary,
389
+ getBrandappSnapshotStatus,
390
+ useBrandappDevtoolBridge
391
+ };
@@ -0,0 +1,65 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
2
+
3
+ // src/i18n/ko.ts
4
+ var koDevtoolLabels = {
5
+ panelTitle: "opt-devtool",
6
+ toggleHint: "Ctrl+Shift+F",
7
+ copyButtonTooltip: "\uB514\uBC84\uADF8 \uC815\uBCF4 \uBCF5\uC0AC",
8
+ closeButton: "\uB2EB\uAE30",
9
+ tabComponent: "\uCEF4\uD3EC\uB10C\uD2B8",
10
+ tabEditor: "opt-editor",
11
+ tabBrandapp: "Brandapp",
12
+ tabTheme: "\uD14C\uB9C8",
13
+ tabHarness: "\uD558\uB124\uC2A4",
14
+ emptyComponent: "\uC544\uBB34 \uC694\uC18C\uB97C \uD3EC\uCEE4\uC2A4\uD558\uBA74\n\uC815\uBCF4\uAC00 \uC5EC\uAE30\uC5D0 \uD45C\uC2DC\uB429\uB2C8\uB2E4.",
15
+ emptyEditor: "\uC774 \uD398\uC774\uC9C0\uC5D0 \uB4F1\uB85D\uB41C Editor snapshot\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",
16
+ emptyBrandapp: "\uC774 \uD398\uC774\uC9C0\uC5D0 \uB4F1\uB85D\uB41C Brandapp SDK snapshot\uC774 \uC5C6\uC2B5\uB2C8\uB2E4",
17
+ emptyEnginePanel: "\uD328\uB110\uC744 \uC120\uD0DD\uD558\uC138\uC694",
18
+ inspectingPinned: "\uC778\uC2A4\uD399\uD2B8 \uB300\uC0C1 (\uACE0\uC815)",
19
+ inspecting: "\uC778\uC2A4\uD399\uD2B8 \uB300\uC0C1",
20
+ currentFocus: "\uD604\uC7AC \uD3EC\uCEE4\uC2A4",
21
+ componentTrace: "\uCEF4\uD3EC\uB10C\uD2B8 \uCD94\uC801",
22
+ componentTree: "\uCEF4\uD3EC\uB10C\uD2B8 \uD2B8\uB9AC",
23
+ noReactComponent: "React \uCEF4\uD3EC\uB10C\uD2B8\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC74C",
24
+ tabOrderInline: "Tab \uC21C\uC11C",
25
+ tabOrderOut: "Tab \uC21C\uC11C (\uC21C\uC11C \uBC16)",
26
+ tabOrderHint: "Tab\uC73C\uB85C \uB3C4\uB2EC\uD560 \uC218 \uC5C6\uC74C (roving tabindex \uB610\uB294 \uD504\uB85C\uADF8\uB798\uBC0D \uD3EC\uCEE4\uC2A4)",
27
+ shiftTabPrev: "Shift+Tab (\uC774\uC804)",
28
+ tabNext: "Tab (\uB2E4\uC74C)",
29
+ arrowKeysTitle: (type, index, total) => `\uBC29\uD5A5\uD0A4 (${type}) ${index}/${total}`,
30
+ loopBadge: "Loop",
31
+ wrapBadge: "Wrap",
32
+ noArrowTarget: "\uBC29\uD5A5\uD0A4 \uB300\uC0C1 \uC5C6\uC74C (\uB05D)",
33
+ spatialNav: "\uACF5\uAC04 \uB124\uBE44\uAC8C\uC774\uC158",
34
+ spatialProtected: "\uBCF4\uD638\uB428",
35
+ spatialNoCandidate: "\uD6C4\uBCF4 \uC5C6\uC74C",
36
+ spatialTrappedContext: (context) => `trapped context (${context})`,
37
+ history: "\uC774\uB3D9 \uAE30\uB85D",
38
+ eventLogTitle: "\uC774\uBCA4\uD2B8 \uB85C\uADF8",
39
+ eventLogClear: "\uC9C0\uC6B0\uAE30",
40
+ eventLogWaiting: "\uC774\uBCA4\uD2B8 \uB300\uAE30 \uC911\u2026",
41
+ overlaysSection: "\uC624\uBC84\uB808\uC774",
42
+ panelsSection: "\uC815\uBCF4 \uD328\uB110",
43
+ toggleGuide: "\uAC00\uC774\uB4DC \uB77C\uC778",
44
+ toggleTabOrder: "Tab \uC21C\uC11C",
45
+ toggleSpatialNav: "\uACF5\uAC04 \uD0D0\uC0C9",
46
+ toggleComponentLabels: "\uCEF4\uD3EC\uB10C\uD2B8 \uB77C\uBCA8",
47
+ toggleCompositeBounds: "Composite \uC601\uC5ED",
48
+ toggleComponentTrace: "\uCEF4\uD3EC\uB10C\uD2B8 \uCD94\uC801",
49
+ toggleComponentTree: "\uCEF4\uD3EC\uB10C\uD2B8 \uD2B8\uB9AC",
50
+ toggleEventLog: "\uC774\uBCA4\uD2B8 \uB85C\uADF8",
51
+ toggleInspect: "\uC778\uC2A4\uD399\uD2B8",
52
+ trapped: "trapped",
53
+ protected: "\uBCF4\uD638",
54
+ filterUser: "\uC0AC\uC6A9\uC790",
55
+ filterPrimitives: "Primitives",
56
+ filterAll: "\uC804\uCCB4"
57
+ };
58
+
59
+ // src/types.ts
60
+ var OPT_DEVTOOL_CONFIGURE_EVENT = "opt-devtool-configure";
61
+
62
+
63
+
64
+
65
+ exports.koDevtoolLabels = koDevtoolLabels; exports.OPT_DEVTOOL_CONFIGURE_EVENT = OPT_DEVTOOL_CONFIGURE_EVENT;
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import {
3
+ __spreadProps,
4
+ __spreadValues
5
+ } from "./chunk-UJSIQF3A.js";
6
+
7
+ // src/theme-isolate.tsx
8
+ var ISOLATE_STYLE = {
9
+ color: "rgba(255, 255, 255, 0.8)",
10
+ fontFamily: 'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',
11
+ fontSize: "12px",
12
+ fontWeight: 400,
13
+ lineHeight: 1.5,
14
+ letterSpacing: "normal",
15
+ textTransform: "none",
16
+ textDecoration: "none",
17
+ fontStyle: "normal",
18
+ colorScheme: "dark",
19
+ textAlign: "left",
20
+ wordSpacing: "normal",
21
+ tabSize: 4,
22
+ isolation: "isolate",
23
+ boxSizing: "border-box"
24
+ };
25
+ var PANEL_STYLE = __spreadProps(__spreadValues({}, ISOLATE_STYLE), {
26
+ backgroundColor: "#0a0a0a"
27
+ });
28
+
29
+ export {
30
+ ISOLATE_STYLE,
31
+ PANEL_STYLE
32
+ };