@opengeni/react 6.1.0-canary.2 → 6.1.0-canary.3

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 (35) hide show
  1. package/README.md +5 -0
  2. package/dist/{browser-viewer-NTD6UIPR.js → browser-viewer-LGH4IP47.js} +3 -3
  3. package/dist/chunk-BRM6FVZA.js +302 -0
  4. package/dist/chunk-BRM6FVZA.js.map +1 -0
  5. package/dist/{chunk-UWVY3OXF.js → chunk-EQEIQSRJ.js} +276 -454
  6. package/dist/chunk-EQEIQSRJ.js.map +1 -0
  7. package/dist/{chunk-NLTS7JHI.js → chunk-JPHDWKZE.js} +5 -5
  8. package/dist/{chunk-KZ4QDBGM.js → chunk-LVHCZABQ.js} +924 -1264
  9. package/dist/chunk-LVHCZABQ.js.map +1 -0
  10. package/dist/{chunk-L5VJYZIW.js → chunk-O53CQZ6T.js} +7 -7
  11. package/dist/{chunk-24M4YBCL.js → chunk-PNAVEK2U.js} +4 -4
  12. package/dist/{chunk-G5JFM6ZE.js → chunk-URNTAVGX.js} +429 -84
  13. package/dist/chunk-URNTAVGX.js.map +1 -0
  14. package/dist/composer.js +3 -3
  15. package/dist/connect.js +4 -3
  16. package/dist/connect.js.map +1 -1
  17. package/dist/index.js +26 -26
  18. package/dist/interaction.js +2 -2
  19. package/dist/machines.js +2 -2
  20. package/dist/plugin-discovery.d.ts +2 -0
  21. package/dist/session-ui.js +6 -6
  22. package/dist/session.js +2 -2
  23. package/package.json +3 -3
  24. package/src/components/markdown.tsx +10 -23
  25. package/src/plugin-discovery.tsx +10 -6
  26. package/styles/compiled.css +0 -8
  27. package/dist/chunk-G5JFM6ZE.js.map +0 -1
  28. package/dist/chunk-HQV2I5HV.js +0 -124
  29. package/dist/chunk-HQV2I5HV.js.map +0 -1
  30. package/dist/chunk-KZ4QDBGM.js.map +0 -1
  31. package/dist/chunk-UWVY3OXF.js.map +0 -1
  32. /package/dist/{browser-viewer-NTD6UIPR.js.map → browser-viewer-LGH4IP47.js.map} +0 -0
  33. /package/dist/{chunk-NLTS7JHI.js.map → chunk-JPHDWKZE.js.map} +0 -0
  34. /package/dist/{chunk-L5VJYZIW.js.map → chunk-O53CQZ6T.js.map} +0 -0
  35. /package/dist/{chunk-24M4YBCL.js.map → chunk-PNAVEK2U.js.map} +0 -0
@@ -6,16 +6,361 @@ import {
6
6
  Tooltip,
7
7
  TooltipContent,
8
8
  TooltipProvider,
9
- TooltipTrigger
10
- } from "./chunk-HQV2I5HV.js";
9
+ TooltipTrigger,
10
+ useLightboxOptional
11
+ } from "./chunk-BRM6FVZA.js";
12
+ import {
13
+ stringifyPayload
14
+ } from "./chunk-PLYRL5ER.js";
11
15
  import {
12
16
  cn
13
17
  } from "./chunk-22KP6LR5.js";
14
18
 
19
+ // src/timeline/disclosure-context.tsx
20
+ import { createContext, useContext } from "react";
21
+ import { jsx } from "react/jsx-runtime";
22
+ var DisclosureDefaultsContext = createContext(void 0);
23
+ function DisclosureDefaultsProvider({
24
+ defaultOpen,
25
+ children
26
+ }) {
27
+ return /* @__PURE__ */ jsx(DisclosureDefaultsContext.Provider, { value: defaultOpen, children });
28
+ }
29
+ function useForcedDefaultOpen() {
30
+ return useContext(DisclosureDefaultsContext);
31
+ }
32
+
33
+ // src/timeline/shared.tsx
34
+ import { CameraIcon, CameraOffIcon, ChevronRightIcon } from "lucide-react";
35
+ import { createContext as createContext2, useContext as useContext2, useState } from "react";
36
+ import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
37
+ var ToolCallTruncationContext = createContext2(null);
38
+ function ToolCallTruncationProvider({
39
+ value,
40
+ children
41
+ }) {
42
+ return /* @__PURE__ */ jsx2(ToolCallTruncationContext.Provider, { value, children });
43
+ }
44
+ var ICON_TONE = {
45
+ accent: "text-og-accent",
46
+ failed: "text-og-status-failed",
47
+ running: "text-og-status-running",
48
+ muted: "text-og-fg-subtle"
49
+ };
50
+ var CompactActivityContext = createContext2(false);
51
+ function ActivityDisclosure({
52
+ icon,
53
+ iconTone: iconToneProp = "muted",
54
+ title,
55
+ titleMono,
56
+ running,
57
+ preview,
58
+ compactPreview,
59
+ media,
60
+ chip: chipProp,
61
+ failed,
62
+ cancelled,
63
+ expandable = true,
64
+ defaultOpen,
65
+ children
66
+ }) {
67
+ const iconTone = failed && iconToneProp === "muted" ? "failed" : iconToneProp;
68
+ const chip = chipProp ?? (failed ? { tone: "bad", text: "failed" } : cancelled ? { tone: "interrupted", text: "interrupted" } : void 0);
69
+ const forcedDefaultOpen = useForcedDefaultOpen();
70
+ const [open, setOpen] = useState(defaultOpen ?? forcedDefaultOpen ?? false);
71
+ const truncation = useContext2(ToolCallTruncationContext);
72
+ const compact = useContext2(CompactActivityContext);
73
+ if (compact)
74
+ return /* @__PURE__ */ jsxs("span", { className: "og-rolling-label", children: [
75
+ /* @__PURE__ */ jsx2("span", { className: cn("shrink-0", ICON_TONE[iconTone]), children: icon }),
76
+ /* @__PURE__ */ jsxs("span", { className: "og-command-reel", children: [
77
+ /* @__PURE__ */ jsx2("span", { className: "og-reel-title", children: title }),
78
+ (compactPreview === void 0 ? preview : compactPreview) ? /* @__PURE__ */ jsx2("span", { className: "og-reel-preview text-og-fg-subtle", children: compactPreview === void 0 ? preview : compactPreview }) : null
79
+ ] })
80
+ ] });
81
+ const hasBody = expandable && (children != null || truncation != null);
82
+ const previewVisible = preview != null && !open;
83
+ const rowClass = cn(
84
+ "group/disclosure flex w-full min-w-0 items-center gap-2 rounded-og-sm px-1.5 py-1.5 text-left text-og-base",
85
+ "text-og-fg-muted transition-colors duration-150",
86
+ // A tool row is a touch target on coarse pointers: grow its hit area to the
87
+ // 44px mobile minimum without loosening the dense desktop rail.
88
+ "pointer-coarse:min-h-11 pointer-coarse:py-2.5"
89
+ );
90
+ const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
91
+ hasBody ? /* @__PURE__ */ jsx2(ChevronRightIcon, { className: "size-3.5 shrink-0 text-og-fg-subtle transition-transform duration-[var(--_og-duration-disclose)] ease-og-in-out group-data-[state=open]/disclosure:rotate-90" }) : /* @__PURE__ */ jsx2("span", { className: "size-3.5 shrink-0" }),
92
+ /* @__PURE__ */ jsx2("span", { className: cn("shrink-0", ICON_TONE[iconTone]), children: icon }),
93
+ /* @__PURE__ */ jsxs("span", { className: cn("og-command-reel", running && "og-command-reel-running"), children: [
94
+ /* @__PURE__ */ jsx2(
95
+ "span",
96
+ {
97
+ className: cn(
98
+ "min-w-0 shrink truncate text-og-base font-medium",
99
+ titleMono && "font-og-mono text-og-sm font-normal"
100
+ ),
101
+ children: title
102
+ }
103
+ ),
104
+ previewVisible && !media ? /* @__PURE__ */ jsx2("span", { className: "min-w-0 flex-1 truncate text-og-sm text-og-fg-subtle", children: preview }) : /* @__PURE__ */ jsx2("span", { className: "flex-1" })
105
+ ] }),
106
+ media && !open ? /* @__PURE__ */ jsx2("span", { className: "ml-auto flex shrink-0 items-center gap-2 pl-2", children: media }) : chip && !open ? /* @__PURE__ */ jsx2("span", { className: "ml-auto shrink-0 pl-2", children: /* @__PURE__ */ jsx2(Chip, { chip }) }) : null
107
+ ] });
108
+ const dataStatus = cancelled ? "cancelled" : failed ? "failed" : void 0;
109
+ if (!hasBody) {
110
+ return /* @__PURE__ */ jsx2("div", { className: cn(rowClass, "cursor-default"), "data-status": dataStatus, children: inner });
111
+ }
112
+ return /* @__PURE__ */ jsxs("div", { children: [
113
+ /* @__PURE__ */ jsx2(
114
+ "div",
115
+ {
116
+ role: "button",
117
+ tabIndex: 0,
118
+ "aria-expanded": open,
119
+ "data-state": open ? "open" : "closed",
120
+ onClick: () => setOpen((prev) => !prev),
121
+ onKeyDown: (event) => {
122
+ if (event.key === "Enter" || event.key === " ") {
123
+ event.preventDefault();
124
+ setOpen((prev) => !prev);
125
+ }
126
+ },
127
+ "data-status": dataStatus,
128
+ className: cn(
129
+ rowClass,
130
+ "cursor-pointer outline-hidden hover:bg-og-surface-1 hover:text-og-fg",
131
+ "focus-visible:ring-2 focus-visible:ring-og-accent focus-visible:ring-offset-0"
132
+ ),
133
+ children: inner
134
+ }
135
+ ),
136
+ open ? /* @__PURE__ */ jsxs("div", { className: "mb-2 ml-7 mt-1.5 flex flex-col gap-2 overflow-hidden animate-og-expand", children: [
137
+ children,
138
+ truncation ? /* @__PURE__ */ jsx2(ToolCallTruncationNotice, { truncation }) : null
139
+ ] }) : null
140
+ ] });
141
+ }
142
+ function ToolCallTruncationNotice({ truncation }) {
143
+ const fullEvidence = truncation.fullEvidence.available ? "retained" : truncation.fullEvidence.reason ?? "unavailable";
144
+ return /* @__PURE__ */ jsxs("div", { "data-og-tool-output-truncation": "", className: "text-og-sm leading-5 text-og-fg-subtle", children: [
145
+ "Output bounded at ",
146
+ /* @__PURE__ */ jsx2("code", { className: "font-og-mono", children: truncation.surface }),
147
+ truncation.omittedBytes != null && truncation.omittedBytes > 0 ? ` \xB7 ${truncation.omittedBytes.toLocaleString()} bytes omitted` : null,
148
+ " \xB7 reason ",
149
+ /* @__PURE__ */ jsx2("code", { className: "font-og-mono", children: truncation.reason }),
150
+ " \xB7 full evidence ",
151
+ /* @__PURE__ */ jsx2("code", { className: "font-og-mono", children: fullEvidence })
152
+ ] });
153
+ }
154
+ function Chip({ chip }) {
155
+ const base = "inline-flex items-center font-og-mono text-og-xs leading-none";
156
+ const withText = chip.text ? "gap-1.5" : "gap-0";
157
+ if (chip.tone === "bad") {
158
+ return /* @__PURE__ */ jsxs("span", { className: cn(base, withText, "text-og-status-failed"), children: [
159
+ /* @__PURE__ */ jsx2("span", { className: "size-1.5 rounded-full bg-og-status-failed" }),
160
+ chip.text
161
+ ] });
162
+ }
163
+ if (chip.tone === "interrupted") {
164
+ return /* @__PURE__ */ jsx2("span", { className: cn(base, "text-og-fg-subtle og-cancelled-chip"), children: chip.text });
165
+ }
166
+ return /* @__PURE__ */ jsx2("span", { className: cn(base, "text-og-fg-subtle"), children: chip.text });
167
+ }
168
+ function TermBlock({
169
+ command,
170
+ workdir,
171
+ output,
172
+ live,
173
+ tailLines = 12,
174
+ failed
175
+ }) {
176
+ const [full, setFull] = useState(false);
177
+ const empty = output.trim() === "";
178
+ const lines = output.split("\n");
179
+ const big = lines.length > tailLines + 4;
180
+ const shown = full || !big ? output : lines.slice(-tailLines).join("\n");
181
+ const showMore = big && !full;
182
+ const showHeader = command != null || workdir != null;
183
+ return /* @__PURE__ */ jsxs(
184
+ "div",
185
+ {
186
+ className: cn(
187
+ "min-w-0 border-l-2 pl-3",
188
+ failed ? "border-og-status-failed/50" : live ? "border-og-status-running/50" : "border-og-border"
189
+ ),
190
+ children: [
191
+ showHeader ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 pb-1", children: [
192
+ /* @__PURE__ */ jsx2("span", { className: "select-none text-og-status-idle", children: "$" }),
193
+ command != null ? /* @__PURE__ */ jsx2("span", { className: "min-w-0 flex-1 truncate font-og-mono text-og-sm text-og-fg-muted", children: command }) : /* @__PURE__ */ jsx2("span", { className: "flex-1" }),
194
+ workdir ? /* @__PURE__ */ jsx2("span", { className: "shrink-0 font-og-mono text-og-xs text-og-fg-subtle", children: workdir }) : null
195
+ ] }) : null,
196
+ empty ? /* @__PURE__ */ jsx2("p", { className: "font-og-mono text-og-xs italic text-og-fg-subtle", children: "(no output)" }) : /* @__PURE__ */ jsxs("pre", { className: "max-h-72 overflow-auto whitespace-pre-wrap break-all font-og-mono text-og-xs leading-5 text-og-fg-muted", children: [
197
+ shown,
198
+ live ? /* @__PURE__ */ jsx2("span", { className: "ml-px inline-block h-[1em] w-[2px] translate-y-[2px] animate-og-blink bg-og-accent align-middle" }) : null
199
+ ] }),
200
+ showMore ? /* @__PURE__ */ jsxs(
201
+ "button",
202
+ {
203
+ type: "button",
204
+ onClick: () => setFull(true),
205
+ className: "mt-1 text-left text-og-xs text-og-fg-subtle transition-colors hover:text-og-fg",
206
+ children: [
207
+ "show full output (",
208
+ lines.length,
209
+ " lines)"
210
+ ]
211
+ }
212
+ ) : null
213
+ ]
214
+ }
215
+ );
216
+ }
217
+ function PayloadBlock({
218
+ label,
219
+ value,
220
+ failed
221
+ }) {
222
+ const text = typeof value === "string" ? value : stringifyPayload(value);
223
+ if (!text || text.trim() === "") {
224
+ return null;
225
+ }
226
+ return /* @__PURE__ */ jsxs(
227
+ "div",
228
+ {
229
+ className: cn(
230
+ "min-w-0 border-l-2 pl-3",
231
+ failed ? "border-og-status-failed/50" : "border-og-border"
232
+ ),
233
+ children: [
234
+ /* @__PURE__ */ jsx2("p", { className: "mb-1 text-og-xs font-medium uppercase tracking-[0.08em] text-og-fg-subtle", children: label }),
235
+ /* @__PURE__ */ jsx2(
236
+ "pre",
237
+ {
238
+ className: cn(
239
+ "max-h-64 overflow-auto whitespace-pre-wrap break-all font-og-mono text-og-xs leading-5",
240
+ failed ? "text-og-status-failed" : "text-og-fg-muted"
241
+ ),
242
+ children: text
243
+ }
244
+ )
245
+ ]
246
+ }
247
+ );
248
+ }
249
+ function BodyNote({
250
+ children,
251
+ tone
252
+ }) {
253
+ if (tone === "error") {
254
+ return /* @__PURE__ */ jsx2("div", { className: "border-l-2 border-og-status-failed/50 pl-3 font-og-mono text-og-xs leading-5 text-og-status-failed", children });
255
+ }
256
+ return /* @__PURE__ */ jsx2("p", { className: "px-0.5 text-og-sm italic leading-5 text-og-fg-subtle", children });
257
+ }
258
+ var MEDIA_BOX = "h-7 w-[52px] shrink-0 rounded-og-xs border border-og-border";
259
+ function MediaSkeleton() {
260
+ return /* @__PURE__ */ jsxs(
261
+ "span",
262
+ {
263
+ className: cn(
264
+ MEDIA_BOX,
265
+ "relative inline-flex items-center justify-center overflow-hidden bg-og-surface-2"
266
+ ),
267
+ children: [
268
+ /* @__PURE__ */ jsx2("span", { className: "absolute inset-0 animate-og-pulse bg-og-surface-3/50" }),
269
+ /* @__PURE__ */ jsx2(CameraIcon, { className: "relative size-3.5 text-og-fg-subtle" })
270
+ ]
271
+ }
272
+ );
273
+ }
274
+ function MediaEmpty() {
275
+ return /* @__PURE__ */ jsx2("span", { className: cn(MEDIA_BOX, "inline-flex items-center justify-center bg-og-bg"), children: /* @__PURE__ */ jsx2(CameraOffIcon, { className: "size-3.5 text-og-fg-subtle" }) });
276
+ }
277
+ function Thumbnail({
278
+ src,
279
+ caption,
280
+ alt = "screenshot",
281
+ expandLabel = "Expand screenshot",
282
+ lightboxLabel = "Screenshot",
283
+ downloadFilename
284
+ }) {
285
+ const lightbox = useLightboxOptional();
286
+ const [failed, setFailed] = useState(false);
287
+ if (failed) {
288
+ return /* @__PURE__ */ jsx2(MediaEmpty, {});
289
+ }
290
+ const img = /* @__PURE__ */ jsx2(
291
+ "img",
292
+ {
293
+ src,
294
+ alt,
295
+ onError: () => setFailed(true),
296
+ className: "h-full w-full object-cover transition-opacity group-hover/thumb:opacity-80"
297
+ }
298
+ );
299
+ if (!lightbox) {
300
+ return /* @__PURE__ */ jsx2("span", { className: cn(MEDIA_BOX, "inline-flex overflow-hidden bg-og-bg"), children: img });
301
+ }
302
+ return /* @__PURE__ */ jsx2(
303
+ "button",
304
+ {
305
+ type: "button",
306
+ onClick: (event) => {
307
+ event.stopPropagation();
308
+ lightbox.open(src, caption, event.currentTarget, lightboxLabel, downloadFilename);
309
+ },
310
+ onKeyDown: (event) => {
311
+ if (event.key === "Enter" || event.key === " ") {
312
+ event.stopPropagation();
313
+ }
314
+ },
315
+ className: cn(
316
+ MEDIA_BOX,
317
+ "group/thumb relative inline-flex overflow-hidden bg-og-bg outline-hidden",
318
+ "focus-visible:ring-2 focus-visible:ring-og-accent"
319
+ ),
320
+ "aria-label": expandLabel,
321
+ children: img
322
+ }
323
+ );
324
+ }
325
+ function ScreenshotFigure({
326
+ src,
327
+ caption,
328
+ alt = "screenshot",
329
+ expandLabel = "Expand screenshot",
330
+ lightboxLabel = "Screenshot",
331
+ downloadFilename
332
+ }) {
333
+ const lightbox = useLightboxOptional();
334
+ const [failed, setFailed] = useState(false);
335
+ const surface = "block w-full overflow-hidden rounded-og-md border border-og-border bg-og-bg";
336
+ const img = /* @__PURE__ */ jsx2(
337
+ "img",
338
+ {
339
+ src,
340
+ alt,
341
+ onError: () => setFailed(true),
342
+ className: "max-h-80 w-full object-contain"
343
+ }
344
+ );
345
+ return /* @__PURE__ */ jsxs("figure", { className: "m-0 min-w-0", children: [
346
+ failed ? /* @__PURE__ */ jsx2("div", { className: "rounded-og-md border border-og-border bg-og-bg px-3 py-6 text-center font-og-mono text-og-xs text-og-fg-subtle", children: "image unavailable" }) : lightbox ? /* @__PURE__ */ jsx2(
347
+ "button",
348
+ {
349
+ type: "button",
350
+ onClick: (event) => lightbox.open(src, caption, event.currentTarget, lightboxLabel, downloadFilename),
351
+ className: surface,
352
+ "aria-label": expandLabel,
353
+ children: img
354
+ }
355
+ ) : /* @__PURE__ */ jsx2("div", { className: surface, children: img }),
356
+ caption ? /* @__PURE__ */ jsx2("figcaption", { className: "mt-1.5 font-og-mono text-og-xs text-og-fg-subtle", children: caption }) : null
357
+ ] });
358
+ }
359
+
15
360
  // src/components/copy-button.tsx
16
361
  import { CheckIcon, CopyIcon } from "lucide-react";
17
- import { useEffect, useRef, useState } from "react";
18
- import { jsx, jsxs } from "react/jsx-runtime";
362
+ import { useEffect, useRef, useState as useState2 } from "react";
363
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
19
364
  var COPIED_MS = 1600;
20
365
  function CopyButton({
21
366
  text,
@@ -23,8 +368,8 @@ function CopyButton({
23
368
  className,
24
369
  reveal = "group-hover"
25
370
  }) {
26
- const [copied, setCopied] = useState(false);
27
- const [tipOpen, setTipOpen] = useState(false);
371
+ const [copied, setCopied] = useState2(false);
372
+ const [tipOpen, setTipOpen] = useState2(false);
28
373
  const timerRef = useRef(null);
29
374
  useEffect(() => {
30
375
  return () => {
@@ -58,7 +403,7 @@ function CopyButton({
58
403
  }
59
404
  };
60
405
  const tip = copied ? "Copied" : label;
61
- return /* @__PURE__ */ jsxs(
406
+ return /* @__PURE__ */ jsxs2(
62
407
  Tooltip,
63
408
  {
64
409
  open: copied ? true : tipOpen,
@@ -68,7 +413,7 @@ function CopyButton({
68
413
  }
69
414
  },
70
415
  children: [
71
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
416
+ /* @__PURE__ */ jsx3(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx3(
72
417
  "button",
73
418
  {
74
419
  type: "button",
@@ -85,10 +430,10 @@ function CopyButton({
85
430
  copied && "opacity-100 text-og-accent",
86
431
  className
87
432
  ),
88
- children: copied ? /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5", "aria-hidden": true }) : /* @__PURE__ */ jsx(CopyIcon, { className: "size-3.5", "aria-hidden": true })
433
+ children: copied ? /* @__PURE__ */ jsx3(CheckIcon, { className: "size-3.5", "aria-hidden": true }) : /* @__PURE__ */ jsx3(CopyIcon, { className: "size-3.5", "aria-hidden": true })
89
434
  }
90
435
  ) }),
91
- /* @__PURE__ */ jsx(TooltipContent, { side: "top", children: tip })
436
+ /* @__PURE__ */ jsx3(TooltipContent, { side: "top", children: tip })
92
437
  ]
93
438
  }
94
439
  );
@@ -102,11 +447,11 @@ function CopyHoverFrame({
102
447
  trailing
103
448
  }) {
104
449
  if (copyText.trim().length === 0) {
105
- return /* @__PURE__ */ jsx("div", { className, children });
450
+ return /* @__PURE__ */ jsx3("div", { className, children });
106
451
  }
107
- return /* @__PURE__ */ jsxs("div", { className: cn("group/copy", className), children: [
452
+ return /* @__PURE__ */ jsxs2("div", { className: cn("group/copy", className), children: [
108
453
  children,
109
- /* @__PURE__ */ jsxs(
454
+ /* @__PURE__ */ jsxs2(
110
455
  "div",
111
456
  {
112
457
  "data-og-annotation-chrome": "",
@@ -115,7 +460,7 @@ function CopyHoverFrame({
115
460
  align === "end" ? "justify-end" : "justify-start"
116
461
  ),
117
462
  children: [
118
- /* @__PURE__ */ jsx(
463
+ /* @__PURE__ */ jsx3(
119
464
  CopyButton,
120
465
  {
121
466
  text: copyText,
@@ -134,21 +479,21 @@ function CopyHoverFrame({
134
479
  // src/components/markdown.tsx
135
480
  import {
136
481
  Children,
137
- createContext,
138
- useContext,
482
+ createContext as createContext3,
483
+ useContext as useContext3,
139
484
  isValidElement,
140
485
  memo,
141
486
  useEffect as useEffect2,
142
487
  useMemo,
143
488
  useReducer,
144
489
  useRef as useRef2,
145
- useState as useState2
490
+ useState as useState3
146
491
  } from "react";
147
492
  import ReactMarkdown, {
148
493
  defaultUrlTransform
149
494
  } from "react-markdown";
150
495
  import remarkGfm from "remark-gfm";
151
- import { LoaderCircleIcon } from "lucide-react";
496
+ import { PanelsTopLeftIcon } from "lucide-react";
152
497
 
153
498
  // src/lib/motion.ts
154
499
  import { flushSync } from "react-dom";
@@ -430,10 +775,10 @@ function rehypeStreamReveal(options) {
430
775
  }
431
776
 
432
777
  // src/components/markdown.tsx
433
- import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
434
- var InteractiveContext = createContext({ source: "" });
778
+ import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
779
+ var InteractiveContext = createContext3({ source: "" });
435
780
  var baseComponents = {
436
- h1: ({ children, ...props }) => /* @__PURE__ */ jsx2(
781
+ h1: ({ children, ...props }) => /* @__PURE__ */ jsx4(
437
782
  "h1",
438
783
  {
439
784
  className: "mt-5 mb-2.5 text-xl font-semibold tracking-tight text-og-fg first:mt-0",
@@ -441,8 +786,8 @@ var baseComponents = {
441
786
  children
442
787
  }
443
788
  ),
444
- h2: ({ children, ...props }) => /* @__PURE__ */ jsx2("h2", { className: "mt-5 mb-2 text-lg font-semibold tracking-tight text-og-fg first:mt-0", ...props, children }),
445
- h3: ({ children, ...props }) => /* @__PURE__ */ jsx2(
789
+ h2: ({ children, ...props }) => /* @__PURE__ */ jsx4("h2", { className: "mt-5 mb-2 text-lg font-semibold tracking-tight text-og-fg first:mt-0", ...props, children }),
790
+ h3: ({ children, ...props }) => /* @__PURE__ */ jsx4(
446
791
  "h3",
447
792
  {
448
793
  className: "mt-4 mb-1.5 text-og-md font-semibold tracking-tight text-og-fg first:mt-0",
@@ -450,7 +795,7 @@ var baseComponents = {
450
795
  children
451
796
  }
452
797
  ),
453
- h4: ({ children, ...props }) => /* @__PURE__ */ jsx2(
798
+ h4: ({ children, ...props }) => /* @__PURE__ */ jsx4(
454
799
  "h4",
455
800
  {
456
801
  className: "mt-4 mb-1.5 text-og-sm font-semibold uppercase tracking-[0.04em] text-og-fg-muted first:mt-0",
@@ -458,10 +803,10 @@ var baseComponents = {
458
803
  children
459
804
  }
460
805
  ),
461
- p: ({ children, ...props }) => /* @__PURE__ */ jsx2("p", { className: "my-2.5 leading-7 first:mt-0 last:mb-0", ...props, children }),
462
- strong: ({ children, ...props }) => /* @__PURE__ */ jsx2("strong", { className: "font-semibold text-og-fg", ...props, children }),
463
- em: ({ children, ...props }) => /* @__PURE__ */ jsx2("em", { className: "italic", ...props, children }),
464
- ul: ({ children, ...props }) => /* @__PURE__ */ jsx2(
806
+ p: ({ children, ...props }) => /* @__PURE__ */ jsx4("p", { className: "my-2.5 leading-7 first:mt-0 last:mb-0", ...props, children }),
807
+ strong: ({ children, ...props }) => /* @__PURE__ */ jsx4("strong", { className: "font-semibold text-og-fg", ...props, children }),
808
+ em: ({ children, ...props }) => /* @__PURE__ */ jsx4("em", { className: "italic", ...props, children }),
809
+ ul: ({ children, ...props }) => /* @__PURE__ */ jsx4(
465
810
  "ul",
466
811
  {
467
812
  className: "my-2.5 ml-5 flex list-disc flex-col gap-1 marker:text-og-fg-subtle first:mt-0 last:mb-0",
@@ -469,7 +814,7 @@ var baseComponents = {
469
814
  children
470
815
  }
471
816
  ),
472
- ol: ({ children, ...props }) => /* @__PURE__ */ jsx2(
817
+ ol: ({ children, ...props }) => /* @__PURE__ */ jsx4(
473
818
  "ol",
474
819
  {
475
820
  className: "my-2.5 ml-5 flex list-decimal flex-col gap-1 marker:text-og-fg-subtle first:mt-0 last:mb-0",
@@ -480,7 +825,7 @@ var baseComponents = {
480
825
  // GFM task-list items carry a leading checkbox <input>; `list-none` + a
481
826
  // negative margin pull the checkbox back to the bullet column so it aligns
482
827
  // with the text.
483
- li: ({ children, ...props }) => /* @__PURE__ */ jsx2(
828
+ li: ({ children, ...props }) => /* @__PURE__ */ jsx4(
484
829
  "li",
485
830
  {
486
831
  className: "leading-7 marker:text-og-fg-subtle [&>ul]:my-1 [&>ol]:my-1 [&:has(>input)]:list-none [&:has(>input)]:-ml-5",
@@ -488,7 +833,7 @@ var baseComponents = {
488
833
  children
489
834
  }
490
835
  ),
491
- input: ({ type, ...props }) => type === "checkbox" ? /* @__PURE__ */ jsx2(
836
+ input: ({ type, ...props }) => type === "checkbox" ? /* @__PURE__ */ jsx4(
492
837
  "input",
493
838
  {
494
839
  ...props,
@@ -496,8 +841,8 @@ var baseComponents = {
496
841
  disabled: true,
497
842
  className: "mr-2 size-3.5 translate-y-[2px] cursor-default accent-og-accent align-baseline"
498
843
  }
499
- ) : /* @__PURE__ */ jsx2("input", { type, ...props }),
500
- blockquote: ({ children, ...props }) => /* @__PURE__ */ jsx2(
844
+ ) : /* @__PURE__ */ jsx4("input", { type, ...props }),
845
+ blockquote: ({ children, ...props }) => /* @__PURE__ */ jsx4(
501
846
  "blockquote",
502
847
  {
503
848
  className: "my-3 border-l-2 border-og-border-strong pl-3.5 text-og-fg-muted [&>p]:my-1.5 first:mt-0 last:mb-0",
@@ -505,11 +850,11 @@ var baseComponents = {
505
850
  children
506
851
  }
507
852
  ),
508
- hr: (props) => /* @__PURE__ */ jsx2("hr", { className: "my-4 border-0 border-t border-og-border", ...props }),
853
+ hr: (props) => /* @__PURE__ */ jsx4("hr", { className: "my-4 border-0 border-t border-og-border", ...props }),
509
854
  // Inline `code` vs fenced code blocks. react-markdown v10 no longer passes an
510
855
  // `inline` flag; a fenced block is a <code> whose parent is <pre> (styled by
511
856
  // the `pre` renderer), so a `code` reaching here is treated as inline.
512
- code: ({ children, className: _className, ...props }) => /* @__PURE__ */ jsx2(
857
+ code: ({ children, className: _className, ...props }) => /* @__PURE__ */ jsx4(
513
858
  "code",
514
859
  {
515
860
  className: "rounded-og-xs bg-og-surface-1 px-1 py-0.5 font-og-mono text-og-sm text-og-fg",
@@ -520,9 +865,9 @@ var baseComponents = {
520
865
  // Fenced code — quiet mono block (no card / no nested vertical scroll).
521
866
  pre: InteractiveCodeBlock,
522
867
  // Tables stay unboxed (hairline rules); hover reveals a TSV copy control.
523
- table: ({ children, ...props }) => /* @__PURE__ */ jsx2(MarkdownTable, { ...props, children }),
524
- thead: ({ children, ...props }) => /* @__PURE__ */ jsx2("thead", { ...props, children }),
525
- th: ({ children, ...props }) => /* @__PURE__ */ jsx2(
868
+ table: ({ children, ...props }) => /* @__PURE__ */ jsx4(MarkdownTable, { ...props, children }),
869
+ thead: ({ children, ...props }) => /* @__PURE__ */ jsx4("thead", { ...props, children }),
870
+ th: ({ children, ...props }) => /* @__PURE__ */ jsx4(
526
871
  "th",
527
872
  {
528
873
  className: "border-b border-og-border px-0 py-1.5 pr-4 text-left font-medium text-og-fg first:pl-0",
@@ -530,7 +875,7 @@ var baseComponents = {
530
875
  children
531
876
  }
532
877
  ),
533
- td: ({ children, ...props }) => /* @__PURE__ */ jsx2(
878
+ td: ({ children, ...props }) => /* @__PURE__ */ jsx4(
534
879
  "td",
535
880
  {
536
881
  className: "border-b border-og-border/70 px-0 py-1.5 pr-4 align-top text-og-fg-muted [tr:last-child>&]:border-b-0",
@@ -547,10 +892,10 @@ function markdownComponents(onSandboxFile) {
547
892
  a: ({ children, href, ...props }) => {
548
893
  const location = sandboxFileLocationFromHref(href);
549
894
  if (location !== null) {
550
- return /* @__PURE__ */ jsx2(SandboxMarkdownLink, { location, onSandboxFile, children });
895
+ return /* @__PURE__ */ jsx4(SandboxMarkdownLink, { location, onSandboxFile, children });
551
896
  }
552
897
  if (isSandboxHref(href) || !href) {
553
- return /* @__PURE__ */ jsx2(
898
+ return /* @__PURE__ */ jsx4(
554
899
  "span",
555
900
  {
556
901
  className: "break-words font-medium text-og-fg-subtle underline decoration-dotted underline-offset-2",
@@ -560,7 +905,7 @@ function markdownComponents(onSandboxFile) {
560
905
  }
561
906
  );
562
907
  }
563
- return /* @__PURE__ */ jsx2(
908
+ return /* @__PURE__ */ jsx4(
564
909
  "a",
565
910
  {
566
911
  className: MARKDOWN_LINK_CLASS,
@@ -579,10 +924,10 @@ function SandboxMarkdownLink({
579
924
  onSandboxFile,
580
925
  children
581
926
  }) {
582
- const [state, setState] = useState2("idle");
927
+ const [state, setState] = useState3("idle");
583
928
  const { path, line } = location;
584
929
  if (!onSandboxFile) {
585
- return /* @__PURE__ */ jsx2(
930
+ return /* @__PURE__ */ jsx4(
586
931
  "span",
587
932
  {
588
933
  className: "break-words font-medium text-og-fg-subtle underline decoration-dotted underline-offset-2",
@@ -593,7 +938,7 @@ function SandboxMarkdownLink({
593
938
  );
594
939
  }
595
940
  const idleTitle = line !== null ? `Open ${path} at line ${line}` : `Open ${path}`;
596
- return /* @__PURE__ */ jsxs2(
941
+ return /* @__PURE__ */ jsxs3(
597
942
  "button",
598
943
  {
599
944
  type: "button",
@@ -652,14 +997,14 @@ function retainedImageId(src) {
652
997
  return /^artifact:([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i.exec(src)?.[1]?.toLowerCase() ?? null;
653
998
  }
654
999
  function MarkdownImage({ src, alt }) {
655
- const { renderImage } = useContext(InteractiveContext);
656
- if (!src) return /* @__PURE__ */ jsx2("span", { children: alt ?? "Image unavailable" });
1000
+ const { renderImage } = useContext3(InteractiveContext);
1001
+ if (!src) return /* @__PURE__ */ jsx4("span", { children: alt ?? "Image unavailable" });
657
1002
  if (retainedImageId(src))
658
- return renderImage ? /* @__PURE__ */ jsx2(Fragment, { children: renderImage({ src, alt: alt ?? "" }) }) : /* @__PURE__ */ jsxs2("span", { children: [
1003
+ return renderImage ? /* @__PURE__ */ jsx4(Fragment2, { children: renderImage({ src, alt: alt ?? "" }) }) : /* @__PURE__ */ jsxs3("span", { children: [
659
1004
  alt || "Image",
660
1005
  " (preview unavailable)"
661
1006
  ] });
662
- return /* @__PURE__ */ jsx2("img", { src, alt: alt ?? "", loading: "lazy", className: "my-3 max-w-full rounded-og-md" });
1007
+ return /* @__PURE__ */ jsx4("img", { src, alt: alt ?? "", loading: "lazy", className: "my-3 max-w-full rounded-og-md" });
663
1008
  }
664
1009
  var markdownUrlTransform = (url, key, node) => key === "href" && node.tagName === "a" && isSandboxHref(url) || key === "src" && node.tagName === "img" && retainedImageId(url) ? url : defaultUrlTransform(url);
665
1010
  var REVEAL_LINGER_MS = 480 * MOTION_INSPECT_SCALE;
@@ -693,7 +1038,7 @@ function fenceLanguage(children) {
693
1038
  return found;
694
1039
  }
695
1040
  function InteractiveCodeBlock({ children, node }) {
696
- const { source, render, streaming } = useContext(InteractiveContext);
1041
+ const { source, render, streaming } = useContext3(InteractiveContext);
697
1042
  const language = fenceLanguage(children);
698
1043
  if (render && (language === "opengeni-html" || language === "opengeni-site")) {
699
1044
  const start = node?.position?.start.offset;
@@ -704,45 +1049,33 @@ function InteractiveCodeBlock({ children, node }) {
704
1049
  const closing = lines.at(-1)?.replace(/^\s*(?:>\s*)+/, "").trim();
705
1050
  const complete = opening && lines.length > 1 && closing && closing.length >= opening[1].length && [...closing].every((c) => c === opening[1][0]);
706
1051
  if (!complete) {
707
- return /* @__PURE__ */ jsxs2(
708
- "div",
1052
+ return /* @__PURE__ */ jsx4("div", { role: "status", "aria-live": "polite", "aria-busy": streaming === true, className: "my-3", children: /* @__PURE__ */ jsx4(
1053
+ ActivityDisclosure,
709
1054
  {
710
- role: "status",
711
- "aria-live": "polite",
712
- "aria-busy": streaming === true,
713
- className: "my-3 flex min-h-32 items-center gap-3 rounded-og-md bg-og-surface-1/70 px-4 py-5",
714
- children: [
715
- streaming ? /* @__PURE__ */ jsx2(
716
- LoaderCircleIcon,
717
- {
718
- "aria-hidden": true,
719
- className: "size-5 shrink-0 text-og-fg-muted motion-safe:animate-spin"
720
- }
721
- ) : null,
722
- /* @__PURE__ */ jsxs2("div", { children: [
723
- /* @__PURE__ */ jsx2("div", { className: "text-og-sm font-medium text-og-fg", children: streaming ? "Preparing preview\u2026" : "Preview incomplete" }),
724
- /* @__PURE__ */ jsx2("div", { className: "mt-1 text-og-sm text-og-fg-muted", children: streaming ? "Generating the interactive content. It will appear here when ready." : "Generation stopped before the preview was ready." })
725
- ] })
726
- ]
1055
+ icon: /* @__PURE__ */ jsx4(PanelsTopLeftIcon, { "aria-hidden": true, className: "size-3.5" }),
1056
+ title: streaming ? "Preparing preview\u2026" : "Preview incomplete",
1057
+ running: streaming === true,
1058
+ expandable: false,
1059
+ preview: streaming ? void 0 : "Generation stopped before the preview was ready."
727
1060
  }
728
- );
1061
+ ) });
729
1062
  }
730
- return /* @__PURE__ */ jsx2(Fragment, { children: render({
1063
+ return /* @__PURE__ */ jsx4(Fragment2, { children: render({
731
1064
  kind: language === "opengeni-html" ? "html" : "site",
732
1065
  content: nodeText(children).replace(/\n$/, "")
733
1066
  }) });
734
1067
  }
735
- return /* @__PURE__ */ jsx2(MarkdownCodeBlock, { children });
1068
+ return /* @__PURE__ */ jsx4(MarkdownCodeBlock, { children });
736
1069
  }
737
1070
  function MarkdownCodeBlock({ children }) {
738
1071
  const code = nodeText(children).replace(/\n$/, "");
739
1072
  const language = fenceLanguage(children);
740
- return /* @__PURE__ */ jsxs2("div", { className: "group/copy relative mt-3 first:mt-0", children: [
741
- /* @__PURE__ */ jsxs2("div", { className: "pointer-events-none absolute top-1.5 right-1.5 z-10 flex items-center gap-1", children: [
742
- language ? /* @__PURE__ */ jsx2("span", { className: "rounded px-1 py-0.5 font-og-mono text-[10px] uppercase tracking-wide text-og-fg-subtle/80 opacity-0 transition-opacity group-hover/copy:opacity-100 pointer-coarse:opacity-70", children: language }) : null,
743
- /* @__PURE__ */ jsx2("div", { className: "pointer-events-auto", children: /* @__PURE__ */ jsx2(CopyButton, { text: code, label: "Copy code", reveal: "group-hover" }) })
1073
+ return /* @__PURE__ */ jsxs3("div", { className: "group/copy relative mt-3 first:mt-0", children: [
1074
+ /* @__PURE__ */ jsxs3("div", { className: "pointer-events-none absolute top-1.5 right-1.5 z-10 flex items-center gap-1", children: [
1075
+ language ? /* @__PURE__ */ jsx4("span", { className: "rounded px-1 py-0.5 font-og-mono text-[10px] uppercase tracking-wide text-og-fg-subtle/80 opacity-0 transition-opacity group-hover/copy:opacity-100 pointer-coarse:opacity-70", children: language }) : null,
1076
+ /* @__PURE__ */ jsx4("div", { className: "pointer-events-auto", children: /* @__PURE__ */ jsx4(CopyButton, { text: code, label: "Copy code", reveal: "group-hover" }) })
744
1077
  ] }),
745
- /* @__PURE__ */ jsx2(
1078
+ /* @__PURE__ */ jsx4(
746
1079
  "pre",
747
1080
  {
748
1081
  tabIndex: 0,
@@ -774,8 +1107,8 @@ function MarkdownTable({ children, className, ...props }) {
774
1107
  useEffect2(() => {
775
1108
  layoutRef.current?.measure();
776
1109
  }, [children]);
777
- return /* @__PURE__ */ jsxs2("div", { ref: wrapperRef, className: "group/copy relative mt-3 max-w-full first:mt-0", children: [
778
- /* @__PURE__ */ jsx2("div", { className: "pointer-events-none absolute top-0 right-0 z-10", children: /* @__PURE__ */ jsx2("div", { className: "pointer-events-auto", children: /* @__PURE__ */ jsx2(
1110
+ return /* @__PURE__ */ jsxs3("div", { ref: wrapperRef, className: "group/copy relative mt-3 max-w-full first:mt-0", children: [
1111
+ /* @__PURE__ */ jsx4("div", { className: "pointer-events-none absolute top-0 right-0 z-10", children: /* @__PURE__ */ jsx4("div", { className: "pointer-events-auto", children: /* @__PURE__ */ jsx4(
779
1112
  CopyButton,
780
1113
  {
781
1114
  text: () => tableElementToTsv(tableRef.current),
@@ -783,7 +1116,7 @@ function MarkdownTable({ children, className, ...props }) {
783
1116
  reveal: "group-hover"
784
1117
  }
785
1118
  ) }) }),
786
- /* @__PURE__ */ jsx2("div", { className: "overflow-x-auto", tabIndex: 0, children: /* @__PURE__ */ jsx2(
1119
+ /* @__PURE__ */ jsx4("div", { className: "overflow-x-auto", tabIndex: 0, children: /* @__PURE__ */ jsx4(
787
1120
  "table",
788
1121
  {
789
1122
  ref: tableRef,
@@ -805,7 +1138,7 @@ function MarkdownImpl({
805
1138
  const revealRef = useRef2(null);
806
1139
  const bodyRef = useRef2(null);
807
1140
  const [, bump] = useReducer((n) => n + 1, 0);
808
- const [settling, setSettling] = useState2(false);
1141
+ const [settling, setSettling] = useState3(false);
809
1142
  const hadRevealRef = useRef2(false);
810
1143
  const now = typeof performance !== "undefined" ? performance.now() : Date.now();
811
1144
  const crystallize = (mutate) => {
@@ -874,7 +1207,7 @@ function MarkdownImpl({
874
1207
  }),
875
1208
  [children, streaming, renderInteractiveBlock, renderImage]
876
1209
  );
877
- return /* @__PURE__ */ jsx2(InteractiveContext.Provider, { value: interactiveContext, children: /* @__PURE__ */ jsx2(TooltipProvider, { delayDuration: 400, children: /* @__PURE__ */ jsx2(
1210
+ return /* @__PURE__ */ jsx4(InteractiveContext.Provider, { value: interactiveContext, children: /* @__PURE__ */ jsx4(TooltipProvider, { delayDuration: 400, children: /* @__PURE__ */ jsx4(
878
1211
  "div",
879
1212
  {
880
1213
  ref: bodyRef,
@@ -883,7 +1216,7 @@ function MarkdownImpl({
883
1216
  settling && "og-markdown-settle",
884
1217
  className
885
1218
  ),
886
- children: /* @__PURE__ */ jsx2(
1219
+ children: /* @__PURE__ */ jsx4(
887
1220
  ReactMarkdown,
888
1221
  {
889
1222
  remarkPlugins: [remarkGfm],
@@ -899,6 +1232,18 @@ function MarkdownImpl({
899
1232
  var Markdown = memo(MarkdownImpl);
900
1233
 
901
1234
  export {
1235
+ DisclosureDefaultsProvider,
1236
+ useForcedDefaultOpen,
1237
+ ToolCallTruncationProvider,
1238
+ CompactActivityContext,
1239
+ ActivityDisclosure,
1240
+ TermBlock,
1241
+ PayloadBlock,
1242
+ BodyNote,
1243
+ MediaSkeleton,
1244
+ MediaEmpty,
1245
+ Thumbnail,
1246
+ ScreenshotFigure,
902
1247
  prefersReducedMotion,
903
1248
  MOTION_INSPECT_SCALE,
904
1249
  CopyButton,
@@ -908,4 +1253,4 @@ export {
908
1253
  retainedImageId,
909
1254
  Markdown
910
1255
  };
911
- //# sourceMappingURL=chunk-G5JFM6ZE.js.map
1256
+ //# sourceMappingURL=chunk-URNTAVGX.js.map