@theoremjs/studio 0.3.4-next.562.g43efe6a → 0.3.4-next.570.gfda95a3

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 (54) hide show
  1. package/draft.d.ts +4 -3
  2. package/draft.js +3 -3
  3. package/origins.d.ts +2 -7
  4. package/origins.js +16 -9
  5. package/package.json +4 -4
  6. package/page/assets/Banner-CrKy_Hwv.js +4 -0
  7. package/page/assets/{ConsoleFrame-CAJZyEO2.js → ConsoleFrame-mZpOKfZP.js} +1 -1
  8. package/page/assets/{ContextMenu-B4QfIs55.js → ContextMenu-BAMCFPeG.js} +2 -2
  9. package/page/assets/{MenuBottomSheet-DAWcmJrl.js → MenuBottomSheet-COMdKPyt.js} +1 -1
  10. package/page/assets/{SchemaFields-klwSsa5v.js → SchemaFields-i5CGKHZw.js} +1 -1
  11. package/page/assets/{ToolResultCharts-CFJXBAnq.js → ToolResultCharts-CM0D9rIN.js} +1 -1
  12. package/page/assets/{TraceInspector-DurRvzW4.js → TraceInspector-BZ6XsVv6.js} +1 -1
  13. package/page/assets/{TraceOverview-C7sm61G3.js → TraceOverview-B3KOSNYV.js} +1 -1
  14. package/page/assets/browser-connection-D9jsfxnA.js +3 -0
  15. package/page/assets/browser-engine-CG3geEGu.js +11 -0
  16. package/page/assets/browser-transport-Bh1HRv_X.js +45 -0
  17. package/page/assets/{export-agent-CpuPHkBF.js → export-agent-BXoo4WkX.js} +1 -1
  18. package/page/assets/{guardrail-tester-DcAALNW8.js → guardrail-tester-BiFjW2iT.js} +1 -1
  19. package/page/assets/{index-CpiaUZvj.js → index-Cy5Fau-l.js} +29 -29
  20. package/page/assets/{live-messages-D1DPu8uD.js → live-messages-Chl3Ye0D.js} +1 -1
  21. package/page/assets/reader-Cn4QuGp2.js +5 -0
  22. package/page/assets/{studio-code-pane-BpRCPuxB.js → studio-code-pane-BXowjDUi.js} +2 -2
  23. package/page/assets/{studio-console-C4EH5FV2.js → studio-console-By2ZHfS3.js} +1 -1
  24. package/page/assets/{studio-decision-D59j-wNe.js → studio-decision-CZJiH4yV.js} +1 -1
  25. package/page/assets/studio-embedding-DJ4PyagP.js +2 -0
  26. package/page/assets/{studio-host-console-BRHcbshh.js → studio-host-console-Cq_V7aux.js} +2 -2
  27. package/page/assets/{studio-labels-CPxUMksx.js → studio-labels-DFzGkFod.js} +1 -1
  28. package/page/assets/{studio-live-C_s1RniX.js → studio-live-DkMUAP67.js} +2 -2
  29. package/page/assets/{studio-map-C6C6Y9Zt.js → studio-map-CWw5Sd6l.js} +1 -1
  30. package/page/assets/{studio-trace-replay-B3tegdb5.js → studio-trace-replay-DqWHUnOl.js} +2 -2
  31. package/page/assets/{tree-Cy9xwG_l.js → tree-BxJ7bZId.js} +1 -1
  32. package/page/assets/{turn-client-mCvAwEgO.js → turn-client-CFuTLOCL.js} +1 -1
  33. package/page/assets/{use-one-call-B3GIPvzI.js → use-one-call-BibUH5we.js} +1 -1
  34. package/page/assets/use-second-ticker-DQqJ4pIV.js +1 -0
  35. package/page/assets/{workspace-BFrc6kx2.js → workspace-D9otnmy3.js} +1 -1
  36. package/page/index.html +14 -14
  37. package/server/project-source.js +43 -0
  38. package/shared-carry.d.ts +4 -1
  39. package/shared-carry.js +1 -1
  40. package/ui/acting-as-button.d.ts +3 -1
  41. package/ui/acting-as-button.js +5 -2
  42. package/ui/inspector-context.js +1 -1
  43. package/ui/lib/studio-restore.js +3 -1
  44. package/ui/profile-editor.js +46 -4
  45. package/ui/studio-screen.js +12 -16
  46. package/ui/use-phone.d.ts +8 -0
  47. package/ui/use-phone.js +23 -1
  48. package/page/assets/Banner-D7PiJb6d.js +0 -2
  49. package/page/assets/browser-engine-DWIBJUBO.js +0 -11
  50. package/page/assets/browser-transport-BYhKkw64.js +0 -47
  51. package/page/assets/reader-BJZH_Cmn.js +0 -7
  52. package/page/assets/studio-embedding-DTiqRBrp.js +0 -2
  53. package/page/assets/types-CB42MysU.js +0 -1
  54. package/page/assets/use-second-ticker-DhbZ0Soz.js +0 -1
@@ -66,7 +66,7 @@ import { StudioHostContext, useStudioHost, } from "./studio-host.js";
66
66
  import { NAV_WIDTH } from "./studio-nav.js";
67
67
  import { StudioRunner } from "./studio-runner.js";
68
68
  import { ProjectSave, ProjectTokens, useProjectSave } from "./studio-save.js";
69
- import { usePhone } from "./use-phone.js";
69
+ import { useBelowDesktop } from "./use-phone.js";
70
70
  // The tester, Settings, the map and the code view load when they first open, or once the page is idle.
71
71
  const testerPanel = () => import("./guardrail-tester.js");
72
72
  const settingsPanel = () => import("./studio-settings.js");
@@ -847,10 +847,9 @@ function useLeftIssues(issues, page, revealed) {
847
847
  return { shown, leavePage };
848
848
  }
849
849
  /** Open in a new tab, for the agent being chatted with; off while the workspace has issues. */
850
- function OpenInNewTabButton({ compiled, chattedId, blocked, connection, }) {
850
+ function OpenInNewTabButton({ compiled, chattedId, blocked, connection, isIconOnly, }) {
851
851
  const project = useProject();
852
- const phone = usePhone();
853
- return (_jsx(Button, { label: "Open in a new tab", isIconOnly: phone, variant: "ghost", icon: _jsx(Icon, { icon: IconBrowserShare, size: "sm" }), isDisabled: !compiled, tooltip: blocked ??
852
+ return (_jsx(Button, { label: "Open in a new tab", isIconOnly: isIconOnly, variant: "ghost", icon: _jsx(Icon, { icon: IconBrowserShare, size: "sm" }), isDisabled: !compiled, tooltip: blocked ??
854
853
  'Run this agent on a full page of its own, in a new tab, the way a person using it would see it', onClick: () => {
855
854
  const run = compiled && workspaceRunAgent(compiled, chattedId);
856
855
  if (run)
@@ -1745,22 +1744,21 @@ function ClearHistoryButton({ run }) {
1745
1744
  /** The types whose conversation a trace can hold, and so open and replay. */
1746
1745
  const NO_CONVERSATION = new Set(['decision', 'host', 'embedding', 'live']);
1747
1746
  /** Replay exchange, for a type whose conversation a trace holds. */
1748
- function ReplayExchangeButton({ payload, tracing, }) {
1749
- const phone = usePhone();
1747
+ function ReplayExchangeButton({ payload, tracing, isIconOnly, }) {
1750
1748
  if (payload == null || NO_CONVERSATION.has(payload.profile.type))
1751
1749
  return null;
1752
- return (_jsx(Button, { label: tracing.open ? 'Close replay' : 'Replay exchange', isIconOnly: phone, variant: tracing.open ? 'secondary' : 'ghost', tooltip: tracing.open
1750
+ return (_jsx(Button, { label: tracing.open ? 'Close replay' : 'Replay exchange', isIconOnly: isIconOnly, variant: tracing.open ? 'secondary' : 'ghost', tooltip: tracing.open
1753
1751
  ? 'Back to the live conversation'
1754
1752
  : 'Open a recorded conversation (a .trace.json file) to see what happened, then replay its messages through this agent as it is now and compare', icon: _jsx(Icon, { icon: IconFileImport, size: "sm" }), "aria-pressed": tracing.open, onClick: tracing.toggle }));
1755
1753
  }
1756
1754
  /** The preview's header: back to the editor, the agent to chat with, history, trace, and Export. */
1757
1755
  function PreviewHeader({ store, chatAgents, chatWith, compile, run, connection, trace, testing, tracing, setSheet, }) {
1758
1756
  const traceLabel = trace.open ? 'Hide trace' : 'View trace';
1759
- const phone = usePhone();
1757
+ const { ref, below: iconsOnly } = useBelowDesktop();
1760
1758
  const { compiled } = compile;
1761
- return (_jsx(Section, { variant: "transparent", paddingInline: 3, paddingBlock: 0, children: _jsxs(HStack, { gap: 2, vAlign: "center", children: [_jsx(SheetButton, { label: "Back to the editor", icon: IconArrowLeft, sheet: null, setSheet: setSheet }), _jsx(StackItem, { size: "fill", children: _jsx(ChatPicker, { agents: chatAgents, chatWith: chatWith, onChange: store.chatWith }) }), _jsx(StackItem, { size: "static", children: _jsxs(HStack, { gap: 1, vAlign: "center", children: [_jsx(ActingAsButton, {}), compile.payload && run.isUsed && !testing && !tracing.open && (_jsx(ClearHistoryButton, { run: run })), !testing && _jsx(ReplayExchangeButton, { payload: compile.payload, tracing: tracing }), (compile.traced || tracing.open) && !testing ? (_jsx(Button, { label: traceLabel, isIconOnly: phone, variant: trace.open ? 'secondary' : 'ghost', tooltip: trace.open
1759
+ return (_jsx(Section, { ref: ref, variant: "transparent", paddingInline: 3, paddingBlock: 0, children: _jsxs(HStack, { gap: 2, vAlign: "center", children: [_jsx(SheetButton, { label: "Back to the editor", icon: IconArrowLeft, sheet: null, setSheet: setSheet }), _jsx(StackItem, { size: "fill", children: _jsx(ChatPicker, { agents: chatAgents, chatWith: chatWith, onChange: store.chatWith }) }), _jsx(StackItem, { size: "static", children: _jsxs(HStack, { gap: 1, vAlign: "center", children: [_jsx(ActingAsButton, { isIconOnly: iconsOnly }), compile.payload && run.isUsed && !testing && !tracing.open && (_jsx(ClearHistoryButton, { run: run })), !testing && (_jsx(ReplayExchangeButton, { payload: compile.payload, tracing: tracing, isIconOnly: iconsOnly })), (compile.traced || tracing.open) && !testing ? (_jsx(Button, { label: traceLabel, isIconOnly: iconsOnly, variant: trace.open ? 'secondary' : 'ghost', tooltip: trace.open
1762
1760
  ? 'Close the trace'
1763
- : 'See how each reply was made, step by step: every model and tool call, guardrail check and gate, with its timing', icon: _jsx(Icon, { icon: IconActivity, size: "sm" }), "aria-pressed": trace.open, onClick: trace.toggle })) : null, _jsx(OpenInNewTabButton, { compiled: compiled.ok ? compiled : undefined, chattedId: compile.chattedId, blocked: compile.blocked, connection: {
1761
+ : 'See how each reply was made, step by step: every model and tool call, guardrail check and gate, with its timing', icon: _jsx(Icon, { icon: IconActivity, size: "sm" }), "aria-pressed": trace.open, onClick: trace.toggle })) : null, _jsx(OpenInNewTabButton, { isIconOnly: iconsOnly, compiled: compiled.ok ? compiled : undefined, chattedId: compile.chattedId, blocked: compile.blocked, connection: {
1764
1762
  connectionMode: connection.mode,
1765
1763
  localBaseUrl: connection.local.baseUrl,
1766
1764
  } })] }) })] }) }));
@@ -2138,12 +2136,11 @@ function SharedLine({ entry, workspace, selected, onOpen, }) {
2138
2136
  return (_jsx(Section, { variant: "transparent", padding: 3, children: _jsx(Banner, { status: "info", title: `${entry.setting.label} · used by ${String(count)} other ${count === 1 ? 'profile' : 'profiles'}`, description: `${declaredAt(entry)}. A change here changes ${others.join(', ')} too.`, endContent: onOpen && _jsx(Button, { label: "Open", variant: "ghost", size: "sm", onClick: onOpen }) }) }));
2139
2137
  }
2140
2138
  /** Over a node one place in the project's files sets whole: what sets it, where, and the way there. */
2141
- function OriginBanner({ origin, partly, onOpen, }) {
2139
+ function OriginBanner({ origin, onOpen }) {
2142
2140
  const place = originPlace(origin);
2143
2141
  // The cause is the title. Here: what it does to this page, then the way out.
2144
- const effect = partly ? 'The greyed rows are read-only here.' : 'Read-only here.';
2145
2142
  const way = place ? `Edit it at ${place}.` : originWay(origin);
2146
- return (_jsx(Section, { variant: "transparent", padding: 3, children: _jsx(Banner, { status: "info", title: originLabel(origin), description: `${effect} ${way}`, endContent: place && _jsx(Button, { label: "Open", variant: "ghost", size: "sm", onClick: onOpen }) }) }));
2143
+ return (_jsx(Section, { variant: "transparent", padding: 3, children: _jsx(Banner, { status: "info", title: originLabel(origin), description: `Read-only here. ${way}`, endContent: place && _jsx(Button, { label: "Open", variant: "ghost", size: "sm", onClick: onOpen }) }) }));
2147
2144
  }
2148
2145
  /** The editor column: its toolbar over the Keys panel, the open node's editor, or its code. */
2149
2146
  function EditorColumn({ heading, state, connection, view, compile, selected, editing, frame, issueReveal, goToIssue, copy, setSheet, }) {
@@ -2158,8 +2155,7 @@ function EditorColumn({ heading, state, connection, view, compile, selected, edi
2158
2155
  const scope = state.origins && nodeOrigins(state.workspace, state.origins, selected);
2159
2156
  return scope ? { scope, open: openOrigin } : null;
2160
2157
  }, [state.origins, state.workspace, selected, openOrigin]);
2161
- const whole = rowOrigins?.scope.section;
2162
- const said = over ? undefined : (whole ?? rowOrigins?.scope.partly);
2158
+ const said = over ? undefined : rowOrigins?.scope.section;
2163
2159
  return (_jsxs(VStack, { height: "100%", children: [_jsx(EditorToolbar, { heading: heading, compiled: compile.compiled, selected: selected, view: view, onIssue: goToIssue, getCode: _jsx(ExportMenu, { store: state.store, compile: compile, copy: copy }), project: project && (_jsxs(_Fragment, { children: [state.conflict && (_jsx(Token, { label: conflictsLabel(state.conflict.merge.conflicts.length), color: "orange", description: "Choose between studio edits and source code", onClick: () => {
2164
2160
  state.showConflict(true);
2165
2161
  } })), _jsx(ProjectTokens, { project: project, unloaded: state.files?.unloaded })] })), setSheet: setSheet }), shared && (_jsx(SharedLine, { entry: shared, workspace: state.workspace, selected: selected, onOpen: project
@@ -2171,7 +2167,7 @@ function EditorColumn({ heading, state, connection, view, compile, selected, edi
2171
2167
  line: shared.setting.line,
2172
2168
  });
2173
2169
  }
2174
- : undefined })), said && (_jsx(OriginBanner, { origin: said, partly: !whole, onOpen: () => {
2170
+ : undefined })), said && (_jsx(OriginBanner, { origin: said, onOpen: () => {
2175
2171
  openOrigin(said);
2176
2172
  } })), _jsx(StackItem, { size: "fill", children: _jsx(RowOrigins, { value: rowOrigins, children: _jsx(LeavePage, { value: leavePage, children: _jsx(EditorColumnBody, { state: state, connection: connection, view: view, compile: compile, rowIssues: shown, selected: selected, editing: editing, frame: frame, editorRef: editorRef }) }) }) })] }));
2177
2173
  }
package/ui/use-phone.d.ts CHANGED
@@ -1,2 +1,10 @@
1
1
  /** Whether the page is phone-wide. */
2
2
  export declare function usePhone(): boolean;
3
+ /**
4
+ * Whether the element `ref` is set on is narrower than the desktop width. It measures the row, not
5
+ * the window, so a pane beside the editor collapses as a narrow window does.
6
+ */
7
+ export declare function useBelowDesktop(): {
8
+ ref: (node: HTMLElement | null) => (() => void) | undefined;
9
+ below: boolean;
10
+ };
package/ui/use-phone.js CHANGED
@@ -1,6 +1,9 @@
1
- import { useSyncExternalStore } from 'react';
1
+ import { DEFAULT_WIDTH_BREAKPOINTS } from '@astryxdesign/core/theme';
2
+ import { useCallback, useState, useSyncExternalStore } from 'react';
2
3
  /** The width below which the studio's text buttons keep only their icon. */
3
4
  const PHONE = '(width < 768px)';
5
+ /** Astryx's desktop width: a row of text buttons narrower than it keeps only their icons. */
6
+ const DESKTOP = DEFAULT_WIDTH_BREAKPOINTS.lg;
4
7
  /** Whether the page is phone-wide. */
5
8
  export function usePhone() {
6
9
  return useSyncExternalStore((change) => {
@@ -11,3 +14,22 @@ export function usePhone() {
11
14
  };
12
15
  }, () => globalThis.matchMedia(PHONE).matches, () => false);
13
16
  }
17
+ /**
18
+ * Whether the element `ref` is set on is narrower than the desktop width. It measures the row, not
19
+ * the window, so a pane beside the editor collapses as a narrow window does.
20
+ */
21
+ export function useBelowDesktop() {
22
+ const [below, setBelow] = useState(false);
23
+ const ref = useCallback((node) => {
24
+ if (!node)
25
+ return;
26
+ const observer = new ResizeObserver(([entry]) => {
27
+ setBelow((entry?.contentRect.width ?? DESKTOP) < DESKTOP);
28
+ });
29
+ observer.observe(node);
30
+ return () => {
31
+ observer.disconnect();
32
+ };
33
+ }, []);
34
+ return { ref, below };
35
+ }
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TraceInspector-DurRvzW4.js","assets/rolldown-runtime-hePW80VL.js","assets/themeProps-3IqahpCr.js","assets/tokens.stylex-DkHf0P9C.js","assets/SegmentedControlItem-BBGRPrxp.js","assets/padding.stylex-B76907Zf.js","assets/VStack-CkVMcNiK.js","assets/mergeProps-ptS-gIMz.js","assets/StackItem-CQviqAfM.js","assets/useLayerDismissal-BAnTRYTt.js","assets/fieldParts-B7DYLgh4.js","assets/Icon-BqkS-pIq.js","assets/devWarning-DxuplmRl.js","assets/Text-BOqCfzZC.js","assets/sharedResizeObserver-4U9Xq5Oq.js","assets/preload-helper-DpV6A1kQ.js","assets/useMediaQuery-BCT0NUeZ.js","assets/useResolvedRequired-DbsOcDqy.js","assets/useAnnounce-DTSHZvjg.js","assets/Tooltip-BWs5DLrM.js","assets/useTooltip-c097gL_-.js","assets/focusOutline.stylex-BT0kfa4t.js","assets/IconButton-DVUFx-8p.js","assets/focusableSelector-DXZeMU85.js","assets/useDevWarning-Z9SoixOP.js","assets/createReactComponent-CZwsv6DD.js","assets/isRtlElement-BG33-k_H.js","assets/plainDate-BHiJcj7o.js","assets/DateInput-B1ICJtHn.js","assets/focusReturn-CTppP2k0.js","assets/Card-DruykyeB.js","assets/container.stylex-BmOi-8DQ.js","assets/ScrollableArea-BHfY7sWH.js","assets/useScrollableArea-DuF_pz9m.js","assets/chainEventHandlers-C6ttXGfW.js","assets/BottomSheet-Dbh6A5Vl.js","assets/useScrollLock-Dyf6PHJt.js","assets/use-trace-records-B1vrKQmA.js","assets/CheckboxInput-CFZ_Wq8-.js","assets/isRenderable-DHkzpAoQ.js","assets/IconAlertTriangle-BqAEqqdU.js","assets/arrive-DvbqpeRS.js","assets/IconShield-DDOh7Gr5.js","assets/shaped-data-AVV4e7rW.js","assets/host-patterns-F-KZIzkF.js","assets/trace-record-Dtrz7WQ7.js","assets/TraceOverview-C7sm61G3.js","assets/labels-provider-DkA22zkP.js","assets/CodeBlock-CfVOtDeO.js","assets/useClipboard-CbN9bb4J.js","assets/index-CpiaUZvj.js","assets/browser-transport-BYhKkw64.js","assets/Center-nHS1JSux.js","assets/IconSearch-BTx66a40.js","assets/schemas-BQ9Jydzb.js","assets/tool-schema-DCF2M0n_.js","assets/reader-BJZH_Cmn.js","assets/live-ingress-OuSlQ6q7.js","assets/trace-schema-9CdEyG6Q.js","assets/stub-BMUhx6B5.js","assets/tree-Cy9xwG_l.js","assets/types-CB42MysU.js","assets/useContainerReveal-BFy8N_QU.js","assets/Dialog-Sd04KQS2.js","assets/HoverCard-DMyWUvwP.js","assets/IconEye-BB5aY-wQ.js","assets/studio-labels-CPxUMksx.js","assets/turn-client-mCvAwEgO.js","assets/encode-files-BCf3-Q7y.js","assets/CollapsibleGroup-FIawJRo4.js","assets/crypto-CrMpJY2D.js","assets/workspace-BFrc6kx2.js","assets/lent-keys-C32ems-I.js","assets/editors-BJX_S59A.js","assets/studio-session-yEqFQo5o.js","assets/EmptyState-C_uF9Wyj.js","assets/use-second-ticker-DhbZ0Soz.js","assets/use-second-ticker-GWBt83pd.css","assets/ContextMenu-B4QfIs55.js","assets/MenuBottomSheetActionList-3L0HS4Kf.js","assets/useMenuPress-DLG1QOiE.js","assets/ListItem-QF7KFt0h.js","assets/useAdaptivePresentation-Bma4-u1a.js","assets/useFocusReturnVisibility-BHKv5Jwr.js","assets/index-C9rhrCGT.css","assets/trace-patterns-D6TbkLLr.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,l as n,n as r,u as i}from"./themeProps-3IqahpCr.js";import{h as a}from"./tokens.stylex-DkHf0P9C.js";import{t as o}from"./mergeProps-ptS-gIMz.js";import{x as s}from"./fieldParts-B7DYLgh4.js";import{t as c}from"./isRenderable-DHkzpAoQ.js";import{t as l,x as u}from"./Icon-BqkS-pIq.js";import{b as d,d as f,f as p,g as m,h,l as g,n as _,p as v,t as y,u as b}from"./use-trace-records-B1vrKQmA.js";import{t as x}from"./preload-helper-DpV6A1kQ.js";import{n as S,t as C}from"./labels-provider-DkA22zkP.js";import{c as w,n as T,t as E}from"./IconButton-DVUFx-8p.js";import{t as D}from"./createReactComponent-CZwsv6DD.js";import{a as O}from"./ScrollableArea-BHfY7sWH.js";var k=D(`outline`,`check`,`Check`,[[`path`,{d:`M5 12l5 5l10 -10`,key:`svg-0`}]]),A=D(`outline`,`copy`,`Copy`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}]]),j=D(`outline`,`download`,`Download`,[[`path`,{d:`M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2`,key:`svg-0`}],[`path`,{d:`M7 11l5 5l5 -5`,key:`svg-1`}],[`path`,{d:`M12 4l0 12`,key:`svg-2`}]]),M=e(i(),1),N=t(),P=(0,M.lazy)(()=>x(()=>import(`./TraceInspector-DurRvzW4.js`).then(e=>({default:e.TraceGuardrailsBody})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85]))),F=(0,M.lazy)(()=>x(()=>import(`./TraceInspector-DurRvzW4.js`).then(e=>({default:e.TraceFeedBody})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85]))),I=(0,M.createContext)(`replace`);function L({value:e,children:t}){return(0,N.jsx)(I,{value:e,children:t})}function R({id:e,header:t,traces:n}){return(0,N.jsx)(g,{id:e,header:t,children:e=>(0,N.jsx)(M.Suspense,{fallback:null,children:(0,N.jsx)(F,{traces:n,isWide:e})})})}function z(e,t,n){let r=S(),i=(0,M.useId)(),[a,o]=(0,M.useState)(!1),s=(0,M.use)(I),c={name:r(`@theorem.panel.trace.name`),show:r(`@theorem.panel.trace.show`),hide:r(`@theorem.panel.trace.hide`),resize:r(`@theorem.panel.trace.resize`)};if(e.observability?.record!==!0)return{toggle:null,view:null,labels:c,offered:!1};let u=n??a,d=n===void 0?(0,N.jsx)(p,{labels:c,icon:(0,N.jsx)(l,{icon:O}),panelId:i,open:u,onToggle:()=>o(e=>!e)}):null;return{toggle:d,view:u?B(s===`panel`,i,t,d):null,labels:c,offered:!0}}function B(e,t,n,r){let i=(0,N.jsxs)(f,{floating:!0,children:[(0,N.jsx)(U,{traces:n}),r]});return e?(0,N.jsx)(V,{id:t,header:i,traces:n}):(0,N.jsx)(R,{id:t,header:i,traces:n})}function V({id:e,header:t,traces:n}){let{ref:r,width:i}=m();return(0,N.jsxs)(`div`,{id:e,ref:r,style:{height:`100%`,position:`relative`},children:[t,(0,N.jsx)(M.Suspense,{fallback:null,children:(0,N.jsx)(F,{traces:n,isWide:v(i)})})]})}function H(e){for(let t of e)for(let e of t.spans){let t=e.attributes[`gen_ai.agent.name`];if(typeof t==`string`&&t)return t}return`trace`}function U({traces:e}){let t=S(),n=y(e);if(n.length===0)return null;let r=t(`@theorem.panel.trace.download`);return(0,N.jsx)(E,{label:r,variant:`ghost`,tooltip:r,icon:(0,N.jsx)(l,{icon:j,size:`sm`}),onClick:()=>{let e=new Date().toISOString().replaceAll(`:`,`-`).slice(0,19),t=new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),r=URL.createObjectURL(t),i=document.createElement(`a`);i.href=r,i.download=`${H(n)}-${e}.trace.json`,i.click(),URL.revokeObjectURL(r)}})}function W({inspector:e,children:t}){let n=(0,M.useRef)(null),r=h(n,!1),i=(0,M.useRef)(void 0),a=(0,M.useCallback)(e=>{n.current=e;let t=i.current;typeof t==`function`?t(e):t!=null&&(t.current=e)},[]);if(!(0,M.isValidElement)(t))return(0,N.jsx)(_,{view:e.view,children:t});i.current=t.props.ref;let o=e.view!=null;return(0,M.cloneElement)(t,{ref:a,end:(0,N.jsx)(b,{labels:e.labels,resizable:r.resizable,open:o,children:e.view})})}function G({inspector:e,children:t}){return(0,M.use)(I)===`panel`&&e.offered?(0,N.jsx)(W,{inspector:e,children:t}):(0,N.jsx)(_,{view:e.view,children:t})}function K({records:e,head:t}){return(0,N.jsx)(C,{children:(0,N.jsx)(M.Suspense,{fallback:null,children:(0,N.jsx)(P,{records:e,head:t})})})}var q={info:`info`,warning:`warning`,error:`error`,success:`success`},ee={info:`accent`,warning:`warning`,error:`error`,success:`success`},J={root:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kMv6JI:`xjb2p0i`,$$css:!0},rootElevatedCard:{kaIpWk:`x1vf2byn`,$$css:!0},header:{k1xSpc:`x78zum5`,kGNEyG:`x1cy8zhl`,kwnvtZ:`x1a02dak`,k1C7PZ:`xak3so`,khm7nJ:`x4olc9o`,k8WAf4:`x8o8v82`,kg3NbH:`x1pzlopt`,$$css:!0},headerCardStandalone:{kaIpWk:`x1vf2byn`,$$css:!0},headerCardWithContent:{krdFHd:`xwxb7qi`,kfmiAY:`x13nour3`,kVL7Gh:`xbiv7yw`,kT0f0o:`x16uus16`,$$css:!0},headerCentered:{kGNEyG:`x6s0dn4`,$$css:!0},endArea:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kwnvtZ:`x1a02dak`,kjj79g:`x13a6bvl`,kOIVth:`x1txdalj`,kmuXW:`x2lah0s`,ks0D6T:`x193iq5w`,keTefX:`xvc5jky`,kqGvvJ:`x81ka23`,$$css:!0},chevron:{k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,$$css:!0},chevronExpanded:{k3aq6I:`x19jd1h0`,$$css:!0}},Y={info:{kWkggS:`xgcxg3y`,$$css:!0},warning:{kWkggS:`x24i8r5`,$$css:!0},error:{kWkggS:`x1pritpl`,$$css:!0},success:{kWkggS:`xu13z74`,$$css:!0}};function te(e){return Object.prototype.hasOwnProperty.call(Y,e)}var ne={none:{kGVxlE:`x1gnnqk1`,$$css:!0},low:{kGVxlE:`x1i5ehqx`,$$css:!0},med:{kGVxlE:`x14hfi27`,$$css:!0},high:{kGVxlE:`x1kcpxr7`,$$css:!0}};function X({status:e,title:t,description:i,icon:f,isDismissable:p=!1,onDismiss:m,dismissLabel:h,endContent:g,container:_=`card`,elevation:v=`none`,collapsible:y=!0,children:b,xstyle:x,className:S,style:C,ref:E,onFocusCapture:D,onPointerDownCapture:O,...k}){let A=u(),[j,P]=(0,M.useState)(!1),F=typeof y==`object`&&y?y:{},{isEnabled:I,isOpen:L,toggle:R}=d({isCollapsible:y!==!1&&{...F,defaultIsOpen:F.defaultIsOpen??!1}}),z=(0,M.useRef)(null),B=(0,M.useId)(),V=q[e],H=ee[e],U=c(b),W=A(`@astryx.banner.dismiss`),G=h??W,K=h??(typeof t==`string`?A(`@astryx.banner.dismissTitled`,{dismiss:W,title:t}):W);if(j)return null;let X=(e,t)=>{e instanceof HTMLElement&&e!==document.body&&!t.contains(e)&&(z.current=e)},re=e=>{X(e.relatedTarget,e.currentTarget)},ie=e=>{X(document.activeElement,e.currentTarget)},ae=()=>{let e=z.current;P(!0),m?.(),e?.isConnected&&e.focus()},Z=I&&U,oe=c(g)||p||Z,se=c(g)||p,ce=!c(i)&&se,Q=U&&(!I||L),$=_===`card`;return(0,N.jsxs)(`div`,{ref:E,onFocusCapture:s(D,re),onPointerDownCapture:s(O,ie),...o(r(`banner-frame`,{container:_,elevation:v}),n(J.root,ne[v],$&&v!==`none`&&J.rootElevatedCard,x),S,C),...k,children:[(0,N.jsxs)(`div`,{...o(r(`banner`,{container:_,status:e}),n(J.header,ce&&J.headerCentered,te(e)&&Y[e],$&&(Q?J.headerCardWithContent:J.headerCardStandalone))),children:[(0,N.jsx)(`div`,{...c(f)?o(r(`banner-icon`,{status:e}),{className:`x78zum5 x6s0dn4 x2lah0s`}):{className:`x78zum5 x6s0dn4 x2lah0s`},"aria-hidden":`true`,children:c(f)?f:V==null?null:(0,N.jsx)(l,{icon:V,size:`md`,color:H,...r(`banner-icon`,{status:e})})}),(0,N.jsxs)(`div`,{...{0:{className:`x78zum5 xdt5ytf xxhr3t x98rzlu xeuugli`},1:{className:`x78zum5 xdt5ytf xxhr3t x98rzlu xeuugli xgualba`}}[!!c(g)|0],children:[(0,N.jsx)(`div`,{className:`x1ghz6dp xjb2p0i xcr08ib x2mo6ok x1kq96og x1tgivj0 xj0a0fe`,children:t}),c(i)&&(0,N.jsx)(`div`,{...o(r(`banner-description`),{className:`x1ghz6dp xjb2p0i x141an7d x1sodnla x1ltkj2j xv1l7n4 xj0a0fe`}),children:i})]}),oe&&(0,N.jsxs)(`div`,{...n(J.endArea,w.inset(a[`--spacing-2`])),children:[g,Z&&(0,N.jsx)(T,{variant:`ghost`,size:`sm`,label:A(L?`@astryx.banner.collapse`:`@astryx.banner.expand`),tooltip:A(L?`@astryx.banner.collapse`:`@astryx.banner.expand`),icon:(0,N.jsx)(l,{icon:`chevronDown`,size:`sm`,color:`inherit`,xstyle:[J.chevron,L&&J.chevronExpanded]}),onClick:R,"aria-expanded":L,"aria-controls":Q?B:void 0,isIconOnly:!0}),p&&(0,N.jsx)(T,{variant:`ghost`,size:`sm`,label:K,tooltip:G,icon:(0,N.jsx)(l,{icon:`close`,size:`sm`,color:`inherit`}),onClick:ae,isIconOnly:!0})]})]}),Q&&(0,N.jsx)(`div`,{id:Z?B:void 0,...o(r(`banner-content`,{container:_,status:e}),{0:{className:`x1de1mus x8o8v82 x1pzlopt xgbv0en xw8tdv1 x92x3c3 x1t7ytsu x18b5jzi x1q0q8m5 x1j92z86 x1gejf6u xw8gpjh`},1:{className:`x1de1mus x8o8v82 x1pzlopt xgbv0en xw8tdv1 x92x3c3 x1t7ytsu x18b5jzi x1q0q8m5 x1j92z86 x1gejf6u xw8gpjh x1k5g1gk x1eprgri`}}[!!$|0]),children:b})]})}X.displayName=`Banner`;export{z as a,G as i,K as n,A as o,L as r,k as s,X as t};