@theoremjs/studio 0.3.4-next.815.g7f5fa76 → 0.3.4-next.819.g62d1f4f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +5 -5
- package/page/assets/Badge-Cj3D81QB.js +1 -0
- package/page/assets/BottomSheet-DUMPEHkR.js +1 -0
- package/page/assets/Button-98PahHB4.js +1 -0
- package/page/assets/Card-DKuxiCN0.js +1 -0
- package/page/assets/Center-C9ai7fq_.js +1 -0
- package/page/assets/CheckboxIndicator-Cca43Ctu.js +2 -0
- package/page/assets/CheckboxInput-nEEHX5M1.js +2 -0
- package/page/assets/CodeBlock-D7u2qG-t.js +3 -0
- package/page/assets/CollapsibleGroup-D_hnA9UR.js +1 -0
- package/page/assets/ConsoleFrame-6cZcgAw3.js +3 -0
- package/page/assets/DateInput-DWdaI0u_.js +1 -0
- package/page/assets/Dialog-C2GP5P7V.js +1 -0
- package/page/assets/EmptyState-DVoDGbtj.js +1 -0
- package/page/assets/FieldStatus-mbnJ60bK.js +1 -0
- package/page/assets/HStack-CqE4exX9.js +1 -0
- package/page/assets/HoverCard-BaUeXNdO.js +1 -0
- package/page/assets/Icon-Cluq4EiW.js +48 -0
- package/page/assets/{IconAlertTriangle-BqAEqqdU.js → IconAlertTriangle-CL88MFAk.js} +1 -1
- package/page/assets/IconButton-Jbcy-K-d.js +1 -0
- package/page/assets/{IconFileText-6zOFKKrF.js → IconFileText-BP1pyMTO.js} +1 -1
- package/page/assets/{IconFilter-BO98ezum.js → IconFilter-DYCjUyWk.js} +1 -1
- package/page/assets/{IconHistory-VvDVN7WG.js → IconHistory-DdcWdeRG.js} +1 -1
- package/page/assets/{IconMathFunction-Eux9NbUx.js → IconMathFunction-CyMTpj2z.js} +1 -1
- package/page/assets/{IconMicrophone-CJCgFwEd.js → IconMicrophone-BT77cilC.js} +1 -1
- package/page/assets/{IconSearch-BTx66a40.js → IconSearch-BN1R3FIx.js} +1 -1
- package/page/assets/{IconServer-DIJ0DAhI.js → IconServer-Dfs13rbh.js} +1 -1
- package/page/assets/{IconShield-DDOh7Gr5.js → IconShield-C7D1qFUk.js} +1 -1
- package/page/assets/{IconTool-CnptGEDw.js → IconTool-BHps7rbl.js} +1 -1
- package/page/assets/{IconWorld-DTIAtVl1.js → IconWorld-DkkGLUyH.js} +1 -1
- package/page/assets/InputClearButton-ClwCL3dr.js +1 -0
- package/page/assets/ItemSwipeLayer-Vrel9VQX.js +1 -0
- package/page/assets/LayoutContent-ClBE78rU.js +1 -0
- package/page/assets/LayoutFooter-QMRRAZfF.js +1 -0
- package/page/assets/ListItem-BevY6nJP.js +1 -0
- package/page/assets/MenuBottomSheet-CtpGLGiS.js +1 -0
- package/page/assets/MenuBottomSheetActionList-4BzDY0Sv.js +1 -0
- package/page/assets/OverflowList-CDkPnQmt.js +1 -0
- package/page/assets/PanelSearchInput-Dw5TVlEX.js +1 -0
- package/page/assets/SchemaFields-CeR8fdQP.js +1 -0
- package/page/assets/ScrollableArea-BGmyGfiL.js +1 -0
- package/page/assets/SidePanel-CYk_zksv.js +2 -0
- package/page/assets/Spinner-B6MdidYQ.js +1 -0
- package/page/assets/Stack-De5MY0tq.js +1 -0
- package/page/assets/StackItem-ClAjT294.js +1 -0
- package/page/assets/Text-BDwNaqzZ.js +2 -0
- package/page/assets/TextInput-BRBEgg_h.js +1 -0
- package/page/assets/TimestampHoverCard-Lt3iYlao.js +1 -0
- package/page/assets/Token-BZrQH6-I.js +1 -0
- package/page/assets/TokenizerBottomSheet-DWwKcApA.js +1 -0
- package/page/assets/ToolResultCharts-Cu8Vyn7b.js +1 -0
- package/page/assets/Toolbar-Bn-SeRUY.js +1 -0
- package/page/assets/{Tooltip-i8-9gEjh.js → Tooltip-Dhy5lIDA.js} +1 -1
- package/page/assets/TraceInspector-DSH0cSNV.js +1 -0
- package/page/assets/{TraceOverview-BWKmIqB_.js → TraceOverview-B1-wFXpd.js} +5 -5
- package/page/assets/VStack-CCYGIv4A.js +1 -0
- package/page/assets/VisuallyHidden-Dfmmn1_I.js +1 -0
- package/page/assets/{_virtual_studio-type-sources-By1WFfl3.js → _virtual_studio-type-sources-DsadDSMk.js} +25 -12
- package/page/assets/{browser-connection-CcVePgFL.js → browser-connection-Bc7sOuyD.js} +1 -1
- package/page/assets/browser-engine-CfZLnFHY.js +16 -0
- package/page/assets/browser-transport-Cw2eNd0h.js +2 -0
- package/page/assets/compile-D3bEXuZx.js +2 -0
- package/page/assets/{container.stylex-C2nFBhUj.js → container.stylex-CkS70he6.js} +1 -1
- package/page/assets/{createReactComponent-CZwsv6DD.js → createReactComponent-DVEyVJ-p.js} +1 -1
- package/page/assets/disabledInteraction-2qeNzu0m.js +1 -0
- package/page/assets/egress-automata-DTnWTzpb.js +1 -0
- package/page/assets/{embedding-space-view-hA6LFkNX.js → embedding-space-view-CRxJE7jA.js} +2 -2
- package/page/assets/{encode-files-D5aFu4ln.js → encode-files-DiwDNH4N.js} +1 -1
- package/page/assets/{export-agent-BODTL50Q.js → export-agent-BxwvLEI2.js} +3 -3
- package/page/assets/fieldParts-DOfguMAs.js +1 -0
- package/page/assets/focusOutline.stylex-LUQxyg0W.js +1 -0
- package/page/assets/focusReturn-DF3Bi_HC.js +1 -0
- package/page/assets/guardrail-tester-Cf-_eQoc.js +9 -0
- package/page/assets/highlightRanges-B7TRPq9q.js +51 -0
- package/page/assets/index-Df0i5k06.js +150 -0
- package/page/assets/index-YKE-6URE.css +1 -0
- package/page/assets/inputStyles.stylex-Dmh4r-B9.js +1 -0
- package/page/assets/{json-code-Baj1sHwL.js → json-code-Bv8iMKXP.js} +1 -1
- package/page/assets/{labels-provider-CKypi3Rm.js → labels-provider-B6PGDZ7i.js} +2 -2
- package/page/assets/{layerScopedContext-OrLDujSh.js → layerScopedContext-BA4VBuWG.js} +1 -1
- package/page/assets/{live-messages-CXlxccEO.js → live-messages-BmxSAnjs.js} +1 -1
- package/page/assets/{map-token-zJGxIUb4.js → map-token-_aDyWhNO.js} +1 -1
- package/page/assets/menuBottomSheet.stylex-BoKs4EdV.js +1 -0
- package/page/assets/plainDate-CE-glc6O.js +1 -0
- package/page/assets/prompt-row-BJrXOhMi.css +1 -0
- package/page/assets/prompt-row-W3uZ_pur.js +71 -0
- package/page/assets/{read-map-CVfRMOdU.js → read-map-i9VRmt7r.js} +1 -1
- package/page/assets/{reader-BVF30qvS.js → reader-LWnKsoZI.js} +4 -4
- package/page/assets/{registry-DFEch9py.js → registry-DSpjWDhn.js} +1 -1
- package/page/assets/{row-keys-WByP9Hsh.js → row-keys-0Bn7ZyYy.js} +1 -1
- package/page/assets/rtlStyles-CVVETNV7.js +1 -0
- package/page/assets/{schema-D7LTUA0h.js → schema-5VLoC-4Z.js} +1 -1
- package/page/assets/shaped-data-BPXuDrSn.js +21 -0
- package/page/assets/stackItem.stylex-BkECao56.js +1 -0
- package/page/assets/{stub-BS-Ey8w3.js → stub-ChwFuX34.js} +1 -1
- package/page/assets/{studio-code-pane-aoU9CYU8.js → studio-code-pane-CeO0QRc6.js} +3 -3
- package/page/assets/{studio-console-BfE4Qs0I.js → studio-console-B1jS8dTh.js} +1 -1
- package/page/assets/studio-decision-B_aYdM5T.js +1 -0
- package/page/assets/studio-embedding-DomBUA-V.js +2 -0
- package/page/assets/studio-host-console-BR9k5Rix.js +2 -0
- package/page/assets/studio-labels-CqXp6VcR.js +3 -0
- package/page/assets/studio-live-BKThbU_V.js +5 -0
- package/page/assets/studio-map-jVb58ujM.js +1 -0
- package/page/assets/studio-trace-replay-jn_RsjjK.js +3 -0
- package/page/assets/{studio-type-checker-CWgKneqZ.js → studio-type-checker-f2wzNB9Y.js} +1 -1
- package/page/assets/{themeProps-3IqahpCr.js → themeProps-Bo2jNkIC.js} +1 -1
- package/page/assets/tokens.stylex-a4pw9QVe.js +1 -0
- package/page/assets/{tool-schema-CxyHWJU1.js → tool-schema-C7QZtUhR.js} +5 -5
- package/page/assets/{trace-patterns-7ljKzdWI.js → trace-patterns-DFMwRU00.js} +1 -1
- package/page/assets/{trace-record-BnoxKfn0.js → trace-record-B7jN6tSR.js} +1 -1
- package/page/assets/tree-DGmS8wGm.js +3 -0
- package/page/assets/{turn-client-DMwkU41t.js → turn-client-4WkWaRoo.js} +2 -2
- package/page/assets/{type-icons-BH_hcYiS.js → type-icons-DgazEJTc.js} +1 -1
- package/page/assets/typeaheadMatch-BJfmSQc6.js +1 -0
- package/page/assets/{types-BoHnkC5F.js → types-vI-k9MS_.js} +1 -1
- package/page/assets/use-one-call-DeJ64uVJ.js +1 -0
- package/page/assets/use-second-ticker-D0uA9-ps.css +1 -0
- package/page/assets/{use-second-ticker-D29e7ivl.js → use-second-ticker-ovc65-Bo.js} +1 -1
- package/page/assets/useAnnounce-QM3mmuiE.js +1 -0
- package/page/assets/useAnnounceRenderedText-_-FYc-5m.js +1 -0
- package/page/assets/useBusyAnnouncement-CjJI13FX.js +1 -0
- package/page/assets/useClickableContainer-dg6qYWze.js +1 -0
- package/page/assets/{useClipboard-CBYppUy6.js → useClipboard-CAtohmvr.js} +1 -1
- package/page/assets/useDevWarning-WeXt8Pe8.js +1 -0
- package/page/assets/useFocusLeavingChange-Bb1WH0Lr.js +1 -0
- package/page/assets/useFocusReturnVisibility-Brk7Chog.js +1 -0
- package/page/assets/useHighlightedOptionScroll-CFs91KPl.js +1 -0
- package/page/assets/useIsHydrating-JHu3d-Y0.js +1 -0
- package/page/assets/useKeyboardHint-BP66YM6d.js +1 -0
- package/page/assets/useLayerDismissal-7g2rAKDN.js +1 -0
- package/page/assets/useLocale-d7ARRGFj.js +1 -0
- package/page/assets/{useMediaQuery-BCT0NUeZ.js → useMediaQuery-D0tQ79Tl.js} +1 -1
- package/page/assets/useMenuOverflow-nA_EuFZP.js +1 -0
- package/page/assets/useMenuPress-BHmqa9bx.js +1 -0
- package/page/assets/useMergedRefs-BgzyWuff.js +1 -0
- package/page/assets/usePressFeedback-BpX4yZ5R.js +1 -0
- package/page/assets/useResolvedRequired-DR7Agwbm.js +1 -0
- package/page/assets/useScrollLock-Dm92sJDr.js +1 -0
- package/page/assets/useScrollableArea-CIrHdx_f.js +1 -0
- package/page/assets/useSettledOpen-DTsZ7A6A.js +1 -0
- package/page/assets/useTooltip-ClCeZiOV.js +1 -0
- package/page/assets/useTranslator-Ba7ULSHc.js +1 -0
- package/page/assets/{workspace-1TqzwSjs.js → workspace-CnHLWgF-.js} +1 -1
- package/page/index.html +105 -90
- package/probe-battery.js +2 -2
- package/ui/built/theme.css +35 -125
- package/ui/built/theme.css.d.ts +2 -2
- package/ui/built/theorem-studio.d.ts +2 -2
- package/ui/built/theorem-studio.js +30 -122
- package/ui/built/theorem-studio.variants.d.ts +2 -2
- package/ui/studio-theme.d.ts +1 -1
- package/page/assets/Badge-D78MvW22.js +0 -1
- package/page/assets/BottomSheet-RjdFLREq.js +0 -1
- package/page/assets/Card-UzuJJI_o.js +0 -1
- package/page/assets/Center-CfSYa5SJ.js +0 -1
- package/page/assets/CheckboxInput-DC62lfiG.js +0 -2
- package/page/assets/CodeBlock-Dcj5-dI6.js +0 -3
- package/page/assets/CollapsibleGroup-C558j700.js +0 -1
- package/page/assets/ConsoleFrame-Bf_3mpqP.js +0 -3
- package/page/assets/DateInput-BrLgvHDz.js +0 -1
- package/page/assets/Dialog-CVk3thtl.js +0 -1
- package/page/assets/EmptyState-C_uF9Wyj.js +0 -1
- package/page/assets/FieldStatus-DsLpiRRE.js +0 -1
- package/page/assets/HStack-DxvXX_Xt.js +0 -1
- package/page/assets/HoverCard-DM8G9-0E.js +0 -1
- package/page/assets/Icon-DQhwzrkL.js +0 -3
- package/page/assets/IconButton-DkBz0UbI.js +0 -1
- package/page/assets/ItemSwipeLayer-BzVkYf4E.js +0 -1
- package/page/assets/ListItem-DB9l0niX.js +0 -1
- package/page/assets/MenuBottomSheet-CO5gepJx.js +0 -1
- package/page/assets/MenuBottomSheetActionList-BXRLqw9i.js +0 -1
- package/page/assets/OverflowList-DCbz0juN.js +0 -1
- package/page/assets/SchemaFields-DwwHUFSt.js +0 -1
- package/page/assets/ScrollableArea-B4atQbG7.js +0 -1
- package/page/assets/SidePanel-CJhDv_-c.js +0 -2
- package/page/assets/Spinner-CB4UUJ5a.js +0 -1
- package/page/assets/Stack-BxV67rLm.js +0 -1
- package/page/assets/StackItem-YZCLellt.js +0 -1
- package/page/assets/Text-DsdhhbQq.js +0 -2
- package/page/assets/TextInput-DQESAqpV.js +0 -1
- package/page/assets/TimestampHoverCard-79rKEd7V.js +0 -1
- package/page/assets/Token-B-NmyYhm.js +0 -1
- package/page/assets/ToolResultCharts-CCpwUDJd.js +0 -1
- package/page/assets/Toolbar-B5ZOgQbb.js +0 -1
- package/page/assets/TraceInspector-DQRx1QUy.js +0 -1
- package/page/assets/VStack-CdkbS0YS.js +0 -1
- package/page/assets/VisuallyHidden-BdRLF-8h.js +0 -1
- package/page/assets/browser-engine-COB1GYTI.js +0 -16
- package/page/assets/browser-transport-DopwOpwI.js +0 -45
- package/page/assets/compile-Dg5FWToI.js +0 -2
- package/page/assets/egress-automata-SiHQTP1i.js +0 -1
- package/page/assets/fieldParts-CrDK1ecV.js +0 -1
- package/page/assets/focusOutline.stylex-B9nWSXsG.js +0 -1
- package/page/assets/focusReturn-CTppP2k0.js +0 -1
- package/page/assets/guardrail-tester-wCPEkzxL.js +0 -9
- package/page/assets/highlightRanges-BfROnk2i.js +0 -51
- package/page/assets/index-Coeeiw_9.css +0 -1
- package/page/assets/index-HAKOsFT6.js +0 -150
- package/page/assets/inputStyles.stylex-B1aNWR3P.js +0 -1
- package/page/assets/plainDate-BHiJcj7o.js +0 -1
- package/page/assets/prompt-row-DrNj8Dpl.js +0 -71
- package/page/assets/prompt-row-beoYzntJ.css +0 -1
- package/page/assets/safeUrl-CYCzKQ-X.js +0 -1
- package/page/assets/shaped-data-CDuHM2x5.js +0 -21
- package/page/assets/sharedResizeObserver-4U9Xq5Oq.js +0 -1
- package/page/assets/studio-decision-CEhkNfU0.js +0 -1
- package/page/assets/studio-embedding-CXSWEkG2.js +0 -2
- package/page/assets/studio-host-console-DogHcTFD.js +0 -2
- package/page/assets/studio-labels-DqAEpPH7.js +0 -3
- package/page/assets/studio-live-BteE9jJS.js +0 -5
- package/page/assets/studio-map-CNvNoxcA.js +0 -1
- package/page/assets/studio-trace-replay-QZQ9ppo-.js +0 -3
- package/page/assets/tokens.stylex-BpCwr7Mf.js +0 -1
- package/page/assets/tree-C204ODPn.js +0 -3
- package/page/assets/use-one-call-DP6ScVTT.js +0 -1
- package/page/assets/use-second-ticker-B-V4bkIB.css +0 -1
- package/page/assets/useAdaptivePresentation-Bma4-u1a.js +0 -1
- package/page/assets/useAnnounce-CRR83ID0.js +0 -1
- package/page/assets/useAnnounceRenderedText-Dmk4UjwU.js +0 -1
- package/page/assets/useClickableContainer-BirAhL6n.js +0 -1
- package/page/assets/useDevWarning-Z9SoixOP.js +0 -1
- package/page/assets/useFocusReturnVisibility-BHKv5Jwr.js +0 -1
- package/page/assets/useKeyboardHint-CPYLVCI3.js +0 -1
- package/page/assets/useLayerDismissal-BAnTRYTt.js +0 -1
- package/page/assets/useLocale-BuRYk4__.js +0 -1
- package/page/assets/useMenuDrillIn-tkh7-uy6.js +0 -1
- package/page/assets/useMenuPress-C-hKmliO.js +0 -1
- package/page/assets/usePressFeedback-v6IeHjJ6.js +0 -1
- package/page/assets/useResolvedRequired-DgA9eEzw.js +0 -1
- package/page/assets/useScrollLock-Dyf6PHJt.js +0 -1
- package/page/assets/useScrollableArea-DuF_pz9m.js +0 -1
- package/page/assets/useTooltip-CipI1oJa.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{l as e}from"./themeProps-Bo2jNkIC.js";import{t}from"./StackItem-ClAjT294.js";import{t as n}from"./Text-BDwNaqzZ.js";import{t as r}from"./HStack-CqE4exX9.js";import{t as i}from"./VStack-CCYGIv4A.js";import{t as a}from"./Card-DKuxiCN0.js";var o=e(),s={clear:`light-dark(#0d1e37, #b4c6e2)`,shade1:`light-dark(#3b5580, #6582ad)`,shade2:`light-dark(#7f95b7, #3b5078)`,shade3:`light-dark(#bcc8da, #22345a)`,failed:`light-dark(#8e2a28, #cd5f55)`},c=`light-dark(#e4e7ec, #2b2f36)`,l=`light-dark(#9aa3b1, #6b727d)`,u=s.clear,d=`var(--color-background-surface)`,f={model:`clear`,tool:`hatch`,host:`shade1`,theorem:`shade2`,user:`shade3`,error:`failed`};function p(e){return e===`hatch`?`url(#trace-fill-hatch)`:s[e]}function m(){return(0,o.jsx)(`svg`,{"aria-hidden":!0,width:0,height:0,style:{position:`absolute`},children:(0,o.jsx)(`defs`,{children:(0,o.jsxs)(`pattern`,{id:`trace-fill-hatch`,width:3,height:3,patternUnits:`userSpaceOnUse`,patternTransform:`rotate(45)`,children:[(0,o.jsx)(`rect`,{width:3,height:3,fill:c}),(0,o.jsx)(`line`,{x1:0,y1:0,x2:0,y2:3,stroke:l,strokeWidth:1.2})]})})})}function h({fill:e}){return(0,o.jsx)(`svg`,{"aria-hidden":!0,width:10,height:10,style:{display:`block`,flexShrink:0},children:(0,o.jsx)(`rect`,{width:10,height:10,rx:2,fill:p(e)})})}var g={background:`var(--theorem-console-card, var(--color-background-surface))`,borderRadius:`var(--radius-page)`};function _({title:e,value:a,note:s,aside:c,detail:l,children:d}){let f=(0,o.jsx)(n,{type:`supporting`,color:`secondary`,children:e}),p=l?(0,o.jsxs)(i,{gap:1,children:[f,(0,o.jsx)(n,{type:`supporting`,maxLines:2,children:l})]}):f;return(0,o.jsxs)(i,{gap:3,children:[c?(0,o.jsxs)(r,{gap:3,vAlign:`center`,children:[(0,o.jsx)(t,{size:`fill`,children:p}),c]}):p,(0,o.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,flexWrap:`wrap`,columnGap:8},children:[(0,o.jsx)(n,{size:`2xl`,weight:`medium`,hasTabularNumbers:!0,children:a}),s?(0,o.jsx)(n,{type:`supporting`,hasTabularNumbers:!0,children:(0,o.jsx)(`span`,{style:{color:u},children:s})}):null]}),d]})}function v(e){return(0,o.jsx)(a,{variant:`muted`,padding:4,style:g,children:(0,o.jsx)(_,{...e})})}export{d as a,p as c,v as i,g as n,m as o,_ as r,h as s,f as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,H as t,S as n,U as r,Xt as i,
|
|
1
|
+
import{C as e,H as t,S as n,U as r,Xt as i,ar as a,ir as o,jt as s,nr as c,tr as l,w as u}from"./shaped-data-BPXuDrSn.js";var d=/^data:([^;,]+);base64,/,f=new Map([[`image`,`data`],[`audio`,`data`],[`thought_signature`,`signature`],[`thought`,`signature`],[`function_call`,`signature`],[`reasoning.encrypted`,`data`]]);function p(e){if(typeof(e.mime_type??e.mimeType)==`string`&&typeof e.data==`string`)return`data`;if(typeof e.media_type==`string`&&typeof e.b64_json==`string`)return`b64_json`;let t=typeof e.type==`string`?f.get(e.type):void 0;return t&&typeof e[t]==`string`&&e[t]!==``?t:void 0}var m=`sha256`,h=`text_sha256`;async function g(e){let t=await a(e);return t?{kind:m,hash:t.hash}:{kind:h,hash:await o(e)}}async function _(e){let t=d.exec(e);if(!t)return e;let{kind:n,hash:r}=await g(e.slice(t[0].length));return`data:${t[1]};${n},${r}`}async function v(e){let t=p(e),n,r=await Promise.all(Object.entries(e).map(async([e,r])=>{if(e===t&&typeof r==`string`){let{kind:t,hash:i}=await g(r);return n=t,[e,i]}return[e,await y(r)]})),i=Object.fromEntries(r);return n&&(i.dataKind=n),i}function y(e){return typeof e==`string`?_(e):Array.isArray(e)?Promise.all(e.map(e=>y(e))):e&&typeof e==`object`?v(e):Promise.resolve(e)}function b(e,t){return t.reduce((e,t)=>s(e,t),e)}function x(e,t){return t.some(Boolean)?c(e,e=>b(e,t)):e}async function S(e,t){return x(await y(e),t)}var C=`https://github.com/open-telemetry/semantic-conventions-genai/tree/8ffdf56`,w=`content_sha256`,T=`json_sha256`,E=[`gen_ai.usage.`,`theorem.usage.`],D={"theorem.upstream.row":`upstreamLog`,"theorem.wire.request":`outboundWire`,"theorem.guardrail":`guardrailDecisions`},O=`raw`,k=`match`,A=[`injection`,`tool_instructions`];function j(e,t){return e===!0||e!==!1&&e[t]}function M(e,{scrub:n,detect:a}){let{sensitive:o,injection:s}=n;return i(e,[...o?r(e,l,o,a):[],...j(o,`host`)?t(e,a):[],...s?r(e,A,s,a):[]])}async function N(e,t){let n=await o(e);return t.content[n]=e,t.known.set(e,n),n}function P(e,t){let{[t]:n,...r}=e;return r}async function F(t,r){if(e(t)){let e=b(M(t.$content,r),r.canaries);return{...P(t,`$content`),[w]:await N(e,r)}}if(n(t)){let e=P(t,`$bytes`),n=await a(t.$bytes);return n?{...e,content_sha256:n.hash,bytes:n.bytes}:{...e,invalid_base64:!0,text_sha256:await o(t.$bytes)}}return u(t)?t:await z(t,e=>F(e,r))}function I(e,t){return typeof e==`string`?t(e):Array.isArray(e)?e.map(e=>I(e,t)):e&&typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,n])=>[e,I(n,t)])):e}function L(e,t){return I(e,e=>{let n=M(e,t),r=t.known.get(n);return r?{[w]:r}:n})}async function R(e,t){if(u(e)){let n=await S(e.$json,t.canaries),r=JSON.stringify(L(n,t)),i=await o(r);return t.content[i]=r,{...P(e,`$json`),[T]:i}}return await z(e,e=>R(e,t))}async function z(e,t){if(Array.isArray(e))return await Promise.all(e.map(t));if(e&&typeof e==`object`){let n=await Promise.all(Object.entries(e).map(async([e,n])=>[e,await t(n)]));return Object.fromEntries(n)}return e}async function B(e,t){let n=await Promise.all(Object.entries(e).map(async([e,n])=>[e,await t(n)]));return Object.fromEntries(n)}async function V(e,t){let n=await Promise.all(e.events.map(async e=>({...e,attributes:await B(e.attributes,t)})));return{...e,attributes:await B(e.attributes,t),events:n}}function H(e,t){return t.usage?e:Object.fromEntries(Object.entries(e).filter(([e])=>!E.some(t=>e.startsWith(t))))}function U(e){return e.map(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return e;let{[k]:t,...n}=e;return n})}function W(e,t){let n=D[e.name];if(n&&!t[n])return;if(e.name===`theorem.grounding`&&!t.evidenceRaw){let{[O]:t,...n}=e.attributes;return{...e,attributes:n}}let{hits:r}=e.attributes;return e.name===`theorem.guardrail`&&!t.guardrailMatchPreview&&Array.isArray(r)?{...e,attributes:{...e.attributes,hits:U(r)}}:e}function G(e,t){return{...e,attributes:H(e.attributes,t),events:e.events.flatMap(e=>W(e,t)??[])}}function K(e){return Object.entries(e).flatMap(([e,t])=>t?[e]:[])}async function q(e){let{policy:t}=e,n={scrub:t.scrub,detect:t.detect,canaries:j(t.scrub.canary,`theorem`)?e.canaries??[]:[],content:{},known:new Map},r=e.spans.map(e=>G(e,t.include)),[i]=r;i&&(i.attributes={...i.attributes,"theorem.record.include":K(t.include),"theorem.record.scrub":K(t.scrub)});let a=await Promise.all(r.map(e=>V(e,e=>F(e,n)))),o=await Promise.all(a.map(e=>V(e,e=>R(e,n))));return{v:3,schemaUrl:C,resource:{...t.resource},...e.metadata?{metadata:e.metadata}:{},spans:o,content:n.content}}function J(e,t){if(Array.isArray(t))return t.map(t=>J(e,t));if(!t||typeof t!=`object`)return t;let n=Object.fromEntries(Object.entries(t).map(([t,n])=>[t,J(e,n)])),{[w]:r,[T]:i,...a}=n,o=typeof r==`string`?e.content[r]:void 0;if(o!==void 0)return Object.keys(a).length===0?o:{...a,content:o};let s=typeof i==`string`?e.content[i]:void 0;if(s===void 0)return n;let c=J(e,JSON.parse(s));return Object.keys(a).length===0?c:c&&typeof c==`object`&&!Array.isArray(c)?{...c,...a}:n}export{J as n,q as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{$t as e,C as t,Cn as n,M as r,On as i,h as a,j as o,n as s,p as c,qt as l,t as ee,y as te,z as u}from"./tool-schema-C7QZtUhR.js";import{En as d,Er as f,Fn as ne,Rn as p,Sn as re,Sr as ie,Tn as ae,Xn as oe,cn as m,gn as h,qn as g,zn as _}from"./shaped-data-BPXuDrSn.js";import{a as se,r as v}from"./live-ingress-OuSlQ6q7.js";var ce=[{id:`identity`,profilePath:`identity`,role:`root`,optional:!1,editor:`structural`,label:`Identity`,ownsFields:[`profile.id`,`profile.type`]},{id:`models`,profilePath:`models`,role:`spine`,optional:!1,editor:`structural`,label:`Models`,ownsFields:[`profile.defaultModel`,`profile.allowModelSelect`,`profile.maxSteps`,`providerContinuation`]},{id:`modelBinding`,profilePath:`models.*`,role:`branch`,parent:`models`,optional:!1,editor:`structural`,label:`Model binding`},{id:`decision`,profilePath:`decision`,role:`spine`,optional:!1,editor:`structural`,label:`Decision`,ownsFields:[`inputs`]},{id:`image`,profilePath:`image`,role:`spine`,optional:!1,editor:`structural`,label:`Image`},{id:`speech`,profilePath:`speech`,role:`spine`,optional:!1,editor:`structural`,label:`Speech`},{id:`live`,profilePath:`live`,role:`spine`,optional:!1,editor:`structural`,label:`Live`},{id:`tools`,profilePath:`tools`,role:`spine`,optional:!1,editor:`structural`,label:`Tools`},{id:`toolSpec`,profilePath:`tools.allow`,role:`branch`,parent:`tools`,optional:!0,editor:`structural`,label:`Tool`},{id:`inputs`,profilePath:`inputs`,role:`spine`,optional:!1,editor:`structural`,label:`Inputs`},{id:`outputs`,profilePath:`outputs`,role:`spine`,optional:!0,editor:`structural`,label:`Outputs`},{id:`turnBehaviour`,profilePath:`turnBehaviour`,role:`spine`,optional:!0,editor:`structural`,label:`Turn behaviour`},{id:`guardrails`,profilePath:`guardrails`,role:`spine`,optional:!0,editor:`structural`,label:`Guardrails`},{id:`observability`,profilePath:`observability`,role:`spine`,optional:!0,editor:`structural`,label:`Observability`},{id:`labels`,profilePath:`labels`,role:`spine`,optional:!0,editor:`structural`,label:`Labels`}],le={identity:ne,inputs:p(`inputs`).filter(e=>e!==`decision`)},y=ce.map(e=>({...e,profileTypes:le[e.id]??p(e.profilePath)}));function ue(e){return y.find(t=>t.id===e)}function de(e){return e.modelBindings.length>1}function fe(e){return e.modelBindings.some(t=>t.provider!==`local`&&!r(e.providers,t).keySlot)}function b(e,t){let n={provider:t.provider,keySlot:t.keySlot||e.models.key,fallbackKeySlot:t.fallbackKeySlot||e.models.fallbackKey},i=r(e.providers,n);return{...i,given:{keySlot:!!i.keySlot&&!n.keySlot,fallbackKeySlot:!!i.fallbackKeySlot&&!n.fallbackKeySlot}}}function pe(e,t){let n=new Set(e.modelBindings.filter(n=>{let r=b(e,n);return r.keySlot===t||r.fallbackKeySlot===t}).map(e=>e.provider));return e.providers.filter(e=>n.has(e.id))}function me(e){let t=e.efforts.map(({alias:e})=>e.trim()).filter(Boolean);return new Set(t).size>1}function he(e){return e.attachmentsAccept.length>0||e.voiceAccept.length>0}var x=h,S=[{name:`operationTimeoutMs`,label:`Call timeout`,units:`ms`,isTimer:!0},{name:`connectTimeoutMs`,label:`Connect timeout`,units:`ms`,isTimer:!0},{name:`liveStepTimeoutMs`,label:`Live step timeout`,units:`ms`,isTimer:!0},{name:`maxWireRecordBytes`,label:`Wire record`,units:`bytes`,isTimer:!1},{name:`maxWireResponseBytes`,label:`Wire response`,units:`bytes`,isTimer:!1},{name:`maxEventBytes`,label:`Event`,units:`bytes`,isTimer:!1},{name:`maxStepBytes`,label:`Step`,units:`bytes`,isTimer:!1},{name:`maxStepEvents`,label:`Step events`,units:`events`,isTimer:!1},{name:`maxPendingToolCalls`,label:`Tool calls`,units:`calls`,isTimer:!1}],C=2147483647,w={compactMaxTokens:32e3,compactAt:.75,compactKeep:4},T={"continue.instruction":`turnBehaviour`,"canary.bind_note":`guardrails`,"quota.exhausted":`guardrails`,"repair.default_guidance":`outputs`,"egress.default_repair_guidance":`guardrails`,"egress.refusal":`guardrails`};function E(e){return`${e}-${crypto.randomUUID().slice(0,8)}`}function D(e){return{key:E(`model`),modelId:`fast`,protocol:`openRouterOpenAi`,provider:`openrouter`,apiId:``,options:{},timeoutMs:null,efforts:[],defaultEffort:``,allowEffortSelect:!1,summaries:null,maxOutputTokens:null,temperature:null,builtInTools:[],...e}}var O=`Studio stub tool — returns a fixed result.`;function k(e){return{key:E(`tool`),toolName:`my_tool`,toolType:`function`,description:O,category:`studio`,access:re[0],permission:d[0],loadTier:ae[0],paths:[`*`],inputJson:ee,outputJson:s,...e}}function A(e,t,n){return(!e.description.trim()||e.description===O)&&n?{agentKey:t,description:`Asks ${n} and returns its answer.`}:{agentKey:t}}function j(){return{name:``,kind:`words`,pattern:``,flags:``,words:[]}}function M(){return{key:``,label:``,at:f(ie,()=>`ignore`),patterns:[j()],hint:``}}function N(){let e=i(void 0);return{canaryBindNote:``,detect:f(_,t=>({...e.detect[t]})),sources:Object.fromEntries(g.map(e=>[e,{theorem:!0,patterns:[],hint:``}])),own:[],quotaEnabled:!1,quotaPerDay:null,quotaMessage:``,allow:{ungiven_images:{hosts:[],fromTools:!0},ungiven_links:{hosts:[],fromTools:!0}},innocentNames:[],blockedReplyOnBlock:``,blockedReplyMaxRetries:null,egressRepairGuidance:``,egressRefusal:``,allowPrivateNetworks:!1,allowedHosts:[],allowedSchemes:[],taintAfterRemoteRead:``,taintRemoteDestination:``}}function P(){let e=se({});return{writeTo:c,destination:c,sampleRate:e.sampleRate,include:{...e.include},scrub:{sensitive:e.scrub.sensitive,injection:e.scrub.injection,canary:e.scrub.canary},retainForDays:null,rotateAfterMiB:null,resourceJson:``}}function F(e){return e.map(([e,t])=>({key:E(`criterion`),label:e,text:t}))}function I(){return{contract:`guardrails.tool_call.v1`,maxStateBytes:null,questions:[{key:E(`question`),id:`verdict`,type:`choice`,instructions:`Given what the user asked for and what the call would do, should it run?`,criteria:F([[`allow`,`Safe, and what the user asked for.`],[`flag`,`Probably fine, but unusual or sensitive enough for a person to look first.`],[`block`,`Harmful, or clearly beyond what the user asked for.`]])},{key:E(`question`),id:`risk`,type:`score`,instructions:`How much harm would this call do if it were wrong?`,criteria:F([[``,`Low: reversible, and affects only the user.`],[``,`High: hard to undo, or affects other people or money.`]])}],images:[]}}var L=JSON.stringify({context:`The user asked the agent to tidy up old screenshots on their desktop.`,tool_call:{name:`delete_files`,path:`~/Documents`,recursive:!0},outcome:`Would delete 1,284 files, including tax_return_2025.pdf.`},null,2),R=JSON.stringify(`The user asked to tidy screenshots. The proposed call recursively deletes 1,284 files, including a tax return.`),ge=`To clear your desktop, select the screenshots and move them to the Trash. Empty the Trash to delete them for good.(Screen captures save to the desktop by default. You can change where they go in the Screenshot app's Options menu.(Press Command-Shift-5 to record the screen or capture a window. Recordings are saved as movie files next to your screenshots.(Stacks group desktop files by kind, date or tag, so a cluttered desktop folds into a few piles you can open one at a time.(Deleted files stay in the Trash for 30 days. Drag a file out of the Trash to put it back where it was.(When your disk is almost full, open Storage settings and review the largest files. Old downloads and installers are safe to remove.(Offloading unused apps frees space and keeps their documents. Reinstalling an app brings its data back.(Photos you have backed up can be optimised so the originals live in the cloud and smaller copies stay on the device.(Your plan renews on the same date each month. You can see the next charge under Billing, then Upcoming invoices.(To get a refund, open the invoice and choose Request refund. Charges from the last 14 days are refunded in full.(Update your card under Billing, then Payment methods. The new card is used for the next renewal, not for past invoices.(Annual plans cost two months less than paying monthly. Switching mid-term credits the unused months to the new plan.(Invoices are emailed as PDFs and list your company name and tax number. Edit those details before the invoice is issued.(Turn on two-step verification under Security. You will be asked for a code from your authenticator app each time you sign in on a new device.(If you forget your password, choose Forgot password on the sign-in page. The reset link expires after one hour.(Review signed-in devices under Security and sign out any you don't recognise. This ends their sessions immediately.(Passkeys replace your password with your fingerprint or face. Create one under Security, then Passkeys.(To close your account, export your data first. Closing deletes your workspace after a 30-day grace period.(Share a folder by choosing Share, then entering an email address. Viewers can read; editors can change and delete.(Public links work for anyone who has them. Set an expiry date, or turn the link off to stop sharing at once.(Transfer ownership of a folder before you leave a team, or its contents will be archived with your account.(Lisbon has mild, wet winters and warm, dry summers. Expect highs near 28 °C in August.(The best months for the Algarve coast are May, June and September, when the beaches are warm and the crowds are thin.(Trams in Lisbon climb the steep hills of Alfama and Graça. Line 28 is the famous one, and the busiest.(For a crisp pizza base, preheat the oven and the baking tray together at the highest setting for at least thirty minutes.(Rest steak for five minutes after cooking so the juices settle back into the meat instead of running onto the board.`.split(`(`).join(`
|
|
2
|
+
|
|
3
|
+
`),_e=`How do I delete every screenshot on my desktop?`;function ve(e,t=`choice`){let n=K(`question`,e.decision.questions.map(e=>e.id),e=>`question_${e}`);return{key:E(`question`),id:n,type:t,instructions:``,criteria:z(t)}}function ye(e,t,n){let r=t.replace(/\.[^.]*$/,``).toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_|_$/g,``)||`image`,i=K(r,e.decision.images.map(e=>e.name),e=>`${r}_${e}`);return{key:E(`image`),name:i,...n}}function be(){return{key:E(`option`),name:``,label:``,isShownInChat:!1,choices:[]}}function xe(e,t){return e.map(e=>t.find(t=>t.value===e)??{key:E(`choice`),value:e,description:``})}function Se(){return{key:E(`criterion`),label:``,text:``}}function z(e){return e===`noul`||e===`box`?[]:F(e===`choice`?[[`yes`,``],[`no`,``]]:[[``,``],[``,``]])}function Ce(){return{identity:{agentId:``,profileType:``,handle:``,system:``,options:[]},included:[`observability`,`labels`],models:{defaultModel:``,allowModelSelect:!1,maxSteps:null,key:``},modelBindings:[],providers:[...t],tools:{t2Loader:``,parallel:!1},toolSpecs:[],inputs:{text:!0,attachmentsAccept:[],voiceAccept:[],maxFiles:null,maxBytes:null,maxTurnBytes:null,limitsByMime:{},contextFrom:[],contextMaxChars:null},outputs:{mode:`text`,schemaId:``,schemaJson:``,streamMode:``,streamThoughts:!0,validationEnabled:!1,maxRetries:null,itemRules:{},repairGuidance:``},turnBehaviour:{resumeEnabled:!1,allowContinue:[],autoContinue:[],maxContinues:null,continueInstruction:``,allowSteering:e({type:`text`}),atStepLimit:`stop`},guardrails:N(),observability:P(),image:{aspectRatio:``,resolution:``,mimeType:``,quality:``,background:``,n:null,seed:null,outputCompression:null,includeText:!1,references:[]},speech:{voice:``,style:``,speed:null,format:``},live:{ingressAudio:v(`audio`),ingressVideo:v(`video`),ingressText:v(`text`),voice:``,sessionResumption:!1,greeting:``,resumedPrompt:``,resumedAfterMs:null,contextCompression:!1,compressionTriggerTokens:null,compressionTargetTokens:null,transcriptionInput:!1,transcriptionOutput:!1,vadActivityHandling:``,vadStartSensitivity:``,vadEndSensitivity:``,vadPrefixPaddingMs:null,vadSilenceDurationMs:null},decision:I(),labels:{}}}var we=new Set([`guardrails`]);function B(e,t){return e.profileTypes.includes(t)&&!(t===`decision`&&we.has(e.id))}function V(e){let t=e.identity.profileType;if(!t)return[`identity`];let n=new Set(e.included);return y.filter(e=>e.role!==`branch`&&B(e,t)&&(!e.optional||n.has(e.id))).map(e=>e.id)}function H(e,t){let n=e.identity.profileType;return n!==``&&p(t).includes(n)}function Te(e,t,n){if((!n||n.includes(t.key))&&t.loadTier===`T2`&&H(e,`tools.t2Loader`)&&!e.tools.t2Loader.trim())return`No T2 loader is set under Tools, so this tool never loads.`}function Ee(e){return H(e,`identity.system`)&&oe(e.guardrails.detect,`canary_leak`)}function De(e){let t=e.identity.profileType;return t!==``&&l.includes(t)}function U(e){let t=e.identity.profileType;return t?y.filter(n=>n.role===`spine`&&n.optional&&B(n,t)&&!e.included.includes(n.id)).map(e=>e.id):[]}function Oe(e){return{...e,attachmentsAccept:e.attachmentsAccept.filter(e=>n(m,e)),voiceAccept:[]}}function ke(e){return{...e,text:!1,attachmentsAccept:[],voiceAccept:e.voiceAccept.length?e.voiceAccept:[`audio/*`]}}function Ae(e,t,n){let r=e.modelBindings.find(e=>e.key===t);return r?{...e,models:n.modelId!==void 0&&e.models.defaultModel===r.modelId?{...e.models,defaultModel:n.modelId}:e.models,modelBindings:e.modelBindings.map(e=>e.key===t?{...e,...n}:e)}:e}function W(e,t){if(t.some(t=>t.modelId===e))return e;let[n,...r]=t;return n&&!r.length?n.modelId:``}function je(e,t){if(!e.modelBindings.find(e=>e.key===t))return e;let n=e.modelBindings.filter(e=>e.key!==t);return{...e,models:{...e.models,defaultModel:W(e.models.defaultModel,n)},modelBindings:n}}function G(e,t){let n=e.identity.profileType,r=n&&n!==`host`?n:`text`,i=e.modelBindings.map(e=>e.modelId),a=te(r,t),o=K(a.modelId,i,e=>`${a.modelId}${e}`);return D({...a,modelId:o})}function Me(e){return k({toolName:K(`my_tool`,e.toolSpecs.map(e=>e.toolName),e=>`my_tool_${e}`)})}function K(e,t,n){let r=new Set(t),i=e;for(let e=2;r.has(i);e++)i=n(e);return i}function Ne(e,t,n){if(t===`host`)return{...e,identity:{...e.identity,profileType:t}};let r=e.modelBindings.filter(r=>{let i=o(e.providers,t,r),a=e.providers.find(e=>e.id===r.provider);return u(a,t,r.protocol)&&!Ie(n,t,i)}),i={...e,identity:{...e.identity,profileType:t},modelBindings:r},s=r.length?r:[G(i,n?.start)],c=!e.models.key&&fe({...i,modelBindings:s}),l=t===`speech`&&!e.speech.voice.trim()&&s.some(n=>a(o(e.providers,t,n)));return{...i,inputs:t===`image`?Oe(e.inputs):t===`transcription`?ke(e.inputs):e.inputs,...l?{speech:{...e.speech,voice:Pe}}:{},models:{...e.models,defaultModel:W(e.models.defaultModel,s),key:c?Le:e.models.key},modelBindings:s}}var Pe=`Kore`,Fe=[`text`,`image`,`speech`,`transcription`,`live`,`decision`];function Ie(e,t,n){if(!e)return!1;let r=t=>e.models(t,n.definition).some(e=>e.id===n.apiId.trim());return!r(t)&&Fe.some(e=>e!==t&&r(e))}var Le=`slot_a`;function Re(e,t){return U(e).includes(t)?{...e,included:[...e.included,t]}:e}function ze(e,t){return{...e,included:e.included.filter(e=>e!==t)}}function q(e){return`modelBinding:${e}`}var J=`toolSpec:`;function Y(e){return`${J}${e}`}function X(e){return e.startsWith(J)?e.slice(9):void 0}var Z=`provider:`;function Q(e){return`${Z}${e}`}function Be(e){return e.startsWith(Z)?e.slice(9):void 0}var Ve=new Map(y.map(e=>[e.id,e.label]));function He(e){return Ve.get(e)??e}function Ue(e,t){let[n,r]=t.split(`:`,2);if(n===`modelBinding`&&r!==void 0)return e.modelBindings.some(e=>e.key===r)?{facet:n,key:r}:void 0;let i=X(t);if(i!==void 0)return e.toolSpecs.some(e=>e.key===i)?{facet:`toolSpec`,key:i}:void 0;let a=V(e);if(r===void 0&&a.includes(t))return{facet:t}}function We(e,t){return t===`models`?e.modelBindings.map(e=>({id:q(e.key),ref:{facet:`modelBinding`,key:e.key},label:e.modelId.trim()||`Unnamed model`,children:[]})):t===`tools`?$(e.toolSpecs):[]}function $(e){return e.map(e=>({id:Y(e.key),ref:{facet:`toolSpec`,key:e.key},label:e.toolName.trim()||`Unnamed tool`,children:[]}))}function Ge(e){let t=V(e).filter(e=>e!==`identity`).map(t=>({id:t,ref:{facet:t},label:He(t),children:We(e,t)}));return{id:`identity`,ref:{facet:`identity`},label:e.identity.agentId.trim()||`Unnamed agent`,children:t}}export{z as A,Ee as B,V as C,U as D,K as E,be as F,b as G,Ne as H,M as I,he as J,me as K,j as L,ye as M,ve as N,Re as O,G as P,Me as R,H as S,ze as T,De as U,je as V,Ae as W,y as X,pe as Y,ue as Z,C as _,Ge as a,D as b,$ as c,_e as d,ge as f,x as g,S as h,Ue as i,Se as j,Te as k,w as l,T as m,Be as n,X as o,R as p,de as q,Q as r,Y as s,q as t,L as u,A as v,E as w,k as x,Ce as y,xe as z};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Gt as e,Qn as t,qn as n}from"./tool-schema-
|
|
2
|
-
`,r:`\r`,t:` `};function h(e,t){let n=``,r=t+1;for(;r<e.length;){let t=e.charAt(r);if(t===`"`)return{text:n,end:r+1};if(t!==`\\`){n+=t,r++;continue}if(r+1>=e.length)break;let i=e.charAt(r+1);if(i===`u`){let t=e.slice(r+2,r+6);if(t.length<4)break;if(/^[0-9a-fA-F]{4}$/.test(t)){n+=String.fromCharCode(Number.parseInt(t,16)),r+=6;continue}}n+=re[i]??i,r+=2}return{text:n}}function g(e,t){let n=t;for(;/\s/.test(e.charAt(n));)n++;return n}function ie(e,t){if(e.charAt(t)===`"`){let n=h(e,t);return n.end===void 0?void 0:_(e,t,n.end)}let n=0;for(let r=t;r<e.length;r++){let i=e.charAt(r);if(i===`"`){let t=h(e,r).end;if(t===void 0)return;r=t-1}else if(i===`{`||i===`[`)n++;else if(i===`}`||i===`]`){if(n===0)return _(e,t,r);if(n--,n===0)return _(e,t,r+1)}else if(i===`,`&&n===0)return _(e,t,r)}}function _(e,t,n){try{return{value:JSON.parse(e.slice(t,n)),end:n}}catch{return}}function v(e){let t={},n=g(e,0);if(e.charAt(n)!==`{`)return t;for(n++;;){if(n=g(e,n),e.charAt(n)===`,`&&(n=g(e,n+1)),e.charAt(n)!==`"`)return t;let r=h(e,n);if(r.end===void 0||(n=g(e,r.end),e.charAt(n)!==`:`)||(n=g(e,n+1),n>=e.length))return t;let i=ie(e,n);if(!i)return e.charAt(n)===`"`&&(t[r.text]=h(e,n).text),t;t[r.text]=i.value,n=i.end}}function y(e,t){if(t.phase===void 0)return{name:t.name,callId:t.callId,...t.operationId?{operationId:t.operationId}:{},arguments:t.arguments,...t.reasoning?{reasoning:t.reasoning}:{},...t.stepId?{stepId:t.stepId}:{},artifacts:[]};if(e===void 0)throw new r(`bad_response`,`Tool event '${t.phase}' for call '${t.callId}' arrived before the call.`);if(e.callId!==t.callId||e.name!==t.name)throw new r(`bad_response`,i(`error.bad_response`));switch(t.phase){case`running`:{let{endedAt:n,outputDraft:r,...i}=e;return{...i,state:t,startedAt:t.at,...t.edited?{edited:t.edited}:{},...t.activity?{activity:t.activity}:{}}}case`complete`:case`error`:return{...b(e),state:t,endedAt:t.at,...t.activityPast?{activityPast:t.activityPast}:{}};case`cancel`:case`gate`:case`background`:return{...b(e),state:t,endedAt:t.at};case`draft`:return{...e,outputDraft:(e.outputDraft??``)+t.text};case`artifact`:return{...e,artifacts:[...e.artifacts,t.artifact]};case`progress`:return se(e,t.data);case`dispatch`:case`trace`:case`warning`:return e}}function b(e){let{outputDraft:t,...n}=e;return n}function x(e,t){return{arguments:{},artifacts:[],...e,name:t.name,callId:t.callId,draft:(e?.draft??``)+t.text}}function S(e,t){if(t.type===`tool_draft`){e.set(t.callId,x(e.get(t.callId),t));return}let{tool:n}=t,r=n.operationId??n.callId;n.phase===void 0&&e.get(n.callId)?.draft!==void 0&&e.delete(n.callId),e.set(r,y(e.get(r),n))}function ae(e){let t=new Map;for(let n of e)(n.type===`tool_draft`||n.type===`tool`)&&S(t,n);return[...t.values()]}function oe(e){if(typeof e!=`object`||!e||!(`agent`in e)||!(`event`in e))return;let{event:n}=e;if(n?.type!==`tool`&&n?.type!==`tool_draft`)return;let r=t.safeParse(n);return r.success?r.data:void 0}function se(e,t){let n=oe(t),r=n&&ce(e.steps??[],n);return r?{...e,steps:r}:e}function ce(e,t){let n=new Map(e.map(e=>[e.operationId??e.callId,e]));if(t.type===`tool`&&t.tool.phase!==void 0){let e=n.get(t.tool.operationId??t.tool.callId);if(e?.callId!==t.tool.callId||e.name!==t.tool.name)return}return S(n,t),[...n.values()]}function le(e){return(e.state?.phase===`gate`?e.state.gate.preparedArguments:void 0)??e.edited?.to??e.arguments}function ue(e,t){return e.type!==`tool`||e.tool.callId!==t?!1:e.tool.phase===`complete`||e.tool.phase===`error`||e.tool.phase===`background`}var de={avif:`image/avif`,gif:`image/gif`,heic:`image/heic`,heif:`image/heif`,jpeg:`image/jpeg`,jpg:`image/jpeg`,png:`image/png`,svg:`image/svg+xml`,webp:`image/webp`,mp4:`video/mp4`,webm:`video/webm`,mov:`video/quicktime`,ogv:`video/ogg`,mp3:`audio/mpeg`,m4a:`audio/mp4`,ogg:`audio/ogg`,wav:`audio/wav`};function fe(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?void 0:de[t.slice(n+1).toLowerCase()]}function pe(e){let t=e.trim();if(t.length===0)return;let n;try{n=new URL(t)}catch{return}if(n.protocol!==`http:`&&n.protocol!==`https:`)return;let r=fe(n.pathname);if(r)return{url:n.href,mimeType:r}}var me=/^(.*)\/thumb(\/.+\/([^/]+))\/(\d+)px-\3(?:\.[a-z0-9]+)?$/i;function he(e){let t=new URL(e),n=t.hostname.split(`.`).slice(-2).join(`.`);for(let e of[...t.searchParams.keys()])e.startsWith(`utm_`)&&t.searchParams.delete(e);let r=me.exec(t.pathname);return{key:`${n}${r?`${r[1]}${r[2]}`:t.pathname}${t.search}`,width:r?Number(r[4]):1/0}}function ge(e){let t=new Map,n=[],r=e=>{if(typeof e==`string`){let r=pe(e);if(!r)return;let i=he(r.url),a=t.get(i.key);if(!a){t.set(i.key,{index:n.length,largest:i.width,smallest:i.width}),n.push(r);return}let o=n[a.index];i.width>a.largest?(a.largest=i.width,n[a.index]={...o,url:r.url,previewUrl:o.previewUrl??o.url}):i.width<a.smallest&&(a.smallest=i.width,n[a.index]={...o,previewUrl:r.url})}else if(Array.isArray(e))for(let t of e)r(t);else if(typeof e==`object`&&e)for(let t of Object.values(e))r(t)};return r(e),n}var C=0;function w(e){return e===`user`?`user-${globalThis.crypto.randomUUID()}`:(C+=1,`${e}-${String(C)}`)}function T(e,t){return e?.kind===t}function E(e,t,n,r){let i=e.at(-1);T(i,t)?i.text+=n:e.push({id:w(r),kind:t,text:n})}function D(e,t){let n=e.at(-1),r=n?.kind===`text`||n?.kind===`thought`;e.splice(r?e.length-1:e.length,0,t)}function O(e,t){return e.find(e=>e.kind===`tool`&&e.id===t)}function k(e,t){let n=`tool-${t.operationId??t.callId}`,r=O(e,n),i=y(r?.tool,t);if(r){r.tool=i;return}let a=t.phase===void 0?O(e,`tool-${t.callId}`):void 0;a?.tool.draft===void 0?e.push({id:n,kind:`tool`,tool:i}):(a.id=n,a.tool=i)}function A(e,t){let n=`tool-${t.callId}`,r=O(e,n),i=x(r?.tool,t);r?r.tool=i:e.push({id:n,kind:`tool`,tool:i})}function j(e){return e.findLast(e=>e.kind===`structured`&&e.draft!==void 0)}function M(e,t,n){let r=j(e),i=(r?.draft??``)+t;r?(r.draft=i,r.value=v(i)):e.push({id:w(n),kind:`structured`,value:v(i),draft:i})}function N(e,t,n){let r=j(e);r?(r.value=t,delete r.draft):e.push({id:w(n),kind:`structured`,value:t})}function P(e,t){return e.type===t.type?e.placeId&&t.placeId?e.placeId===t.placeId:e.uri===t.uri:!1}function F(e,t,n){let r=e.find(e=>e.kind===`citation`&&e.callId===t.callId),i=r?[...r.sources]:[];for(let e of t.sources)i.some(t=>P(t,e))||i.push(e);r?r.sources=i:e.push({id:w(n),kind:`citation`,sources:i,...t.callId===void 0?{}:{callId:t.callId}})}function I(e,t,n,r){if(t.phase===`complete`&&t.output!==void 0)for(let i of ge(t.output))r.has(i.url)||(r.add(i.url),e.push({id:w(n),kind:`media`,mimeType:i.mimeType,url:i.url,...i.previewUrl?{previewUrl:i.previewUrl}:{}}))}function L(e,t){return e.messages.flatMap(e=>{if(e.role!==`user`)return[];let n=e.parts??[],r=[e.content??``,...n.map(e=>`text`in e?e.text:``)].join(``).trim();return[...r?[{id:w(t),kind:`user-text`,text:r}]:[],...n.flatMap(e=>`text`in e?[]:[{id:w(t),kind:e.type===`audio`?`user-voice`:`user-attachment`,name:e.mimeType,mimeType:e.mimeType,...`data`in e?{sizeBytes:Math.floor(e.data.length*3/4),data:e.data}:{sizeBytes:0}}])]})}function R(e,t=`user`){let n=[],r=e.text?.trim();r&&n.push({id:w(t),kind:`user-text`,text:r});for(let r of e.attachments??[])n.push({id:w(t),kind:`user-attachment`,name:r.name,mimeType:r.mimeType,sizeBytes:r.sizeBytes,...r.data===void 0?{}:{data:r.data}});for(let r of e.voice??[])n.push({id:w(t),kind:`user-voice`,name:r.name,mimeType:r.mimeType,sizeBytes:r.sizeBytes,...r.data===void 0?{}:{data:r.data}});return n}function _e(e,t){switch(e.type){case`media`:return e.media?{id:w(t),kind:`media`,mimeType:e.media.mimeType,data:e.media.data}:void 0;case`grounding`:return{id:w(t),kind:`grounding`,grounding:e.grounding};case`evidence`:return{id:w(t),kind:`evidence`,evidence:e.evidence};case`late_results`:return{id:w(t),kind:`late-results`,text:e.text};case`error`:return e.error?{id:w(t),kind:`error`,message:e.error}:void 0;case`done`:return{id:w(t),kind:`turn-done`,stop:e.stop,tokens:e.tokens,interactionId:e.interactionId,compaction:e.compaction!==void 0};default:return}}function ve(e,t,n){if(t.phase===`complete`)for(let r of t.parts??[])r.type!==`text`&&e.push({id:w(n),kind:`media`,mimeType:r.mimeType,...`data`in r?{data:r.data}:{url:r.uri}})}function z(e,t={}){let r=t.idPrefix??`turn`,i=t.showThoughts??!0;C=0;let a=[],o=new Set;for(let t of n(e))switch(t.type){case`thought`:i&&t.text&&E(a,`thought`,t.text,r);break;case`text`:t.text&&E(a,`text`,t.text,r);break;case`tool_draft`:A(a,t);break;case`tool`:k(a,t.tool),I(a,t.tool,r,o),ve(a,t.tool,r);break;case`structured_draft`:M(a,t.text,r);break;case`structured`:N(a,t.structured,r);break;case`citation`:F(a,t,r);break;case`guardrail`:D(a,{id:w(r),kind:`guardrail`,guardrail:t.guardrail});break;case`stage`:for(let e of t.injected??[])a.push(...L(e,r));break;default:{let e=_e(t,r);e&&a.push(e)}}return a}function ye(e,t,n={}){return[...R(e,`user`),...z(t,n)]}function be(e){if(!e)return a;let{detect:t,patterns:n}=e;if(!n)return t;let r=Object.fromEntries(Object.entries(n).map(([e,{theorem:t}])=>[e,{theorem:t,matchers:[]}]));return{...t,sources:r}}function xe(e,t){if(e.text===void 0)return e;let n=o(e.text,`user`,be(t));return{...e,text:n.text??e.text}}function B(e,t,n){let r=s(e,t);if(!r.ok)return{ok:!1,issues:r.issues};let i=xe(t,n);return{ok:!0,draft:i,blocks:R(i)}}function V(e,t){if(t)return e.models[t]}function H(e){return!!(e.allowModelSelect&&Object.keys(e.models).length>=2)}function U(e,t){let n=V(e,t);return n?.allowEffortSelect?Object.keys(n.efforts??{}).length>=2:!1}function W(e,t){let n=V(e,t);if(!n?.efforts)return;let r=n.defaultEffort?.trim();return r&&n.efforts[r]?r:Object.keys(n.efforts)[0]}function Se(e){return H(e)?Object.entries(e.models).map(([e,t])=>({id:e,label:t.apiId})):[]}function Ce(e,t){if(!U(e,t))return[];let n=V(e,t);return n?.efforts?Object.entries(n.efforts).map(([e,t])=>({alias:e,level:t})):[]}function G(e){let t=new Set;for(let n of e)if(n.type===`tool`&&n.tool.phase===`complete`)for(let e of c(n.tool.output)??[])t.add(e);return[...t]}function K(t){let n=e(t,e=>e.type===`done`&&e.tools!==void 0);return n?.type===`done`?n.tools:void 0}function we(t){let n=K(t)?.visible??[],r=e(t,e=>e.type===`done`&&e.steps!==void 0);return{promoted:[...new Set([...n,...G(t)])],stepsTaken:r?.type===`done`?r.steps??0:0}}function q(e){return e?.streaming?.streamThoughts!==!1}function J(e){return e.defaultModel??Object.keys(e.models)[0]}function Te(e,t,n){let r=t.model!==void 0&&Object.hasOwn(e.models,t.model)&&(n===void 0||t.model!==J(n))?t.model:J(e),i=r===void 0?void 0:e.models[r]?.efforts;return{model:r,effort:r===t.model&&t.effort!==void 0&&i!==void 0&&Object.hasOwn(i,t.effort)&&(n===void 0||t.effort!==W(n,r))?t.effort:W(e,r)}}function Y(e){if(!e.operationId)throw new r(`request`,i(`session.gate_expired`));return e.operationId}function Ee(e,t){return t.selectedModel??J(e)}function X(e,t,n){let r=t.selectedEffort;if(!n||!Object.hasOwn(e.models,n))return r;let i=e.models[n];return i.allowEffortSelect?r??i.defaultEffort:r===W(e,n)?void 0:r}function Z(e,t){let n=Ee(e,t),r=e.allowModelSelect||n!==J(e)?n:void 0,i=X(e,t,n);return{...r?{model:r}:{},...i?{effort:i}:{}}}function De(e,t,n){return{name:n.name,input:n.input,...n.gateKind?{gateKind:n.gateKind}:{},sessionPermissions:n.sessionPermissions??t.sessionPermissions,...t.toolSnapshot?{snapshot:t.toolSnapshot}:{},...t.promotedToolIds.length?{promoted:[...t.promotedToolIds]}:{},...Z(e,t)}}function Q(e){return{...e.conversation?{conversation:e.conversation}:{},...e.turnId?{turnId:e.turnId}:{}}}function Oe(e,t,n,r={}){let i=(r.walkAway?.calls??[]).map(e=>({callId:e.callId,operationId:Y(e)}));return{...Q(r),...Z(e,t),input:n,...i.length?{abandon:i}:{},replay:{sessionPermissions:t.sessionPermissions}}}function ke(e,t,n,r={}){return{...Q(r),gateId:n.gateId,operationId:n.operationId,decision:n.decision,...n.secret===void 0?{}:{secret:n.secret},...n.page===void 0?{}:{page:n.page},replay:De(e,t,{...n,gateKind:n.gateKind??(t.gatedTool?.callId===n.gateId?t.gatedTool.gateKind:void 0)})}}function $(e,t){return B(e.inputs,t,e.guardrails)}function Ae(e,t,n,r=[]){return $(e,{...t.trim()?{text:t}:{},...n.length?{attachments:l(n)}:{},...r.length?{voice:l(r)}:{}})}function je(e,t){return z(t,{showThoughts:q(e.outputs)})}export{ae as C,ee as D,te as E,p as O,le as S,ne as T,B as _,Ae as a,y as b,q as c,K as d,W as f,H as g,Se as h,Y as i,m as k,G as l,Ce as m,Oe as n,$ as o,U as p,je as r,Te as s,ke as t,we as u,ye as v,f as w,ue as x,z as y};
|
|
1
|
+
import{Gt as e,Qn as t,qn as n}from"./tool-schema-C7QZtUhR.js";import{c as r}from"./host-patterns-F-KZIzkF.js";import{Kn as i,M as a,Ur as o}from"./shaped-data-BPXuDrSn.js";import{I as s}from"./reader-LWnKsoZI.js";import{g as c}from"./schema-5VLoC-4Z.js";import{r as l}from"./encode-files-DiwDNH4N.js";function u(e,t){let n=typeof t==`string`?t.trim():``;if(!n)throw new r(`request`,`A typed credential must be a non-empty string`);if(e===`bearer`)return{type:`bearer`,token:n};if(e===`api_key`)return{type:`api_key`,key:n};throw new r(`request`,`A '${e}' sign-in takes no typed credential; the host's callback saves it`)}function d(e,t){if(!e)throw new r(`request`,`a typed credential answers only a sign-in gate`);return{slot:e.slot,credential:u(e.authType,t)}}function ee(e,t){if(t!==void 0){if(!Number.isFinite(t)||t<=0)throw new r(`config`,`${e} gateTtlMs must be a positive number of milliseconds; got ${t}.`);return t}}function te(e,t,n){return n!==void 0&&t-e>=n}var f=[`approve`,`deny`,`abandon`];function p(e,t=!1){return e.decision===`approve`?{granted:!0,...e.edited?{edited:e.edited}:{},...t?{signIn:t}:{}}:{granted:!1,cause:e.decision===`deny`?`declined`:`abandoned`,...t?{signIn:t}:{}}}function m(e,t,n){return n!==`session_consent`||e.includes(t)?[...e]:[...e,t]}function ne(e,t,n){let{callId:i,decision:a,input:o,secret:s,page:c}=e;if((o!==void 0||s!==void 0||c!==void 0)&&a!==`approve`)throw new r(`request`,`only an approval takes edited input, a secret, or a page answer (call ${i})`);if(a!==`approve`)return{resume:p({decision:a},t.auth!==void 0),input:t.arguments,sessionPermissions:[...n]};let l=s===void 0?void 0:d(t.auth,s);return{resume:{...p(o===void 0?{decision:a}:{decision:a,edited:{from:t.arguments}},t.auth!==void 0),...t.gateKind?{gateKind:t.gateKind}:{}},input:o??t.arguments,sessionPermissions:m(n,t.name,t.permission),...l?{typed:l}:{},...c?{page:c}:{}}}var re={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
|
|
2
|
+
`,r:`\r`,t:` `};function h(e,t){let n=``,r=t+1;for(;r<e.length;){let t=e.charAt(r);if(t===`"`)return{text:n,end:r+1};if(t!==`\\`){n+=t,r++;continue}if(r+1>=e.length)break;let i=e.charAt(r+1);if(i===`u`){let t=e.slice(r+2,r+6);if(t.length<4)break;if(/^[0-9a-fA-F]{4}$/.test(t)){n+=String.fromCharCode(Number.parseInt(t,16)),r+=6;continue}}n+=re[i]??i,r+=2}return{text:n}}function g(e,t){let n=t;for(;/\s/.test(e.charAt(n));)n++;return n}function ie(e,t){if(e.charAt(t)===`"`){let n=h(e,t);return n.end===void 0?void 0:_(e,t,n.end)}let n=0;for(let r=t;r<e.length;r++){let i=e.charAt(r);if(i===`"`){let t=h(e,r).end;if(t===void 0)return;r=t-1}else if(i===`{`||i===`[`)n++;else if(i===`}`||i===`]`){if(n===0)return _(e,t,r);if(n--,n===0)return _(e,t,r+1)}else if(i===`,`&&n===0)return _(e,t,r)}}function _(e,t,n){try{return{value:JSON.parse(e.slice(t,n)),end:n}}catch{return}}function v(e){let t={},n=g(e,0);if(e.charAt(n)!==`{`)return t;for(n++;;){if(n=g(e,n),e.charAt(n)===`,`&&(n=g(e,n+1)),e.charAt(n)!==`"`)return t;let r=h(e,n);if(r.end===void 0||(n=g(e,r.end),e.charAt(n)!==`:`)||(n=g(e,n+1),n>=e.length))return t;let i=ie(e,n);if(!i)return e.charAt(n)===`"`&&(t[r.text]=h(e,n).text),t;t[r.text]=i.value,n=i.end}}function y(e,t){if(t.phase===void 0)return{name:t.name,callId:t.callId,...t.operationId?{operationId:t.operationId}:{},arguments:t.arguments,...t.reasoning?{reasoning:t.reasoning}:{},...t.stepId?{stepId:t.stepId}:{},artifacts:[]};if(e===void 0)throw new r(`bad_response`,`Tool event '${t.phase}' for call '${t.callId}' arrived before the call.`);if(e.callId!==t.callId||e.name!==t.name)throw new r(`bad_response`,o(`error.bad_response`));switch(t.phase){case`running`:{let{endedAt:n,outputDraft:r,...i}=e;return{...i,state:t,startedAt:t.at,...t.edited?{edited:t.edited}:{},...t.activity?{activity:t.activity}:{}}}case`complete`:case`error`:return{...b(e),state:t,endedAt:t.at,...t.activityPast?{activityPast:t.activityPast}:{}};case`cancel`:case`gate`:case`background`:return{...b(e),state:t,endedAt:t.at};case`draft`:return{...e,outputDraft:(e.outputDraft??``)+t.text};case`artifact`:return{...e,artifacts:[...e.artifacts,t.artifact]};case`progress`:return se(e,t.data);case`dispatch`:case`trace`:case`warning`:return e}}function b(e){let{outputDraft:t,...n}=e;return n}function x(e,t){return{arguments:{},artifacts:[],...e,name:t.name,callId:t.callId,draft:(e?.draft??``)+t.text}}function S(e,t){if(t.type===`tool_draft`){e.set(t.callId,x(e.get(t.callId),t));return}let{tool:n}=t,r=n.operationId??n.callId;n.phase===void 0&&e.get(n.callId)?.draft!==void 0&&e.delete(n.callId),e.set(r,y(e.get(r),n))}function ae(e){let t=new Map;for(let n of e)(n.type===`tool_draft`||n.type===`tool`)&&S(t,n);return[...t.values()]}function oe(e){if(typeof e!=`object`||!e||!(`agent`in e)||!(`event`in e))return;let{event:n}=e;if(n?.type!==`tool`&&n?.type!==`tool_draft`)return;let r=t.safeParse(n);return r.success?r.data:void 0}function se(e,t){let n=oe(t),r=n&&ce(e.steps??[],n);return r?{...e,steps:r}:e}function ce(e,t){let n=new Map(e.map(e=>[e.operationId??e.callId,e]));if(t.type===`tool`&&t.tool.phase!==void 0){let e=n.get(t.tool.operationId??t.tool.callId);if(e?.callId!==t.tool.callId||e.name!==t.tool.name)return}return S(n,t),[...n.values()]}function le(e){return(e.state?.phase===`gate`?e.state.gate.preparedArguments:void 0)??e.edited?.to??e.arguments}function ue(e,t){return e.type!==`tool`||e.tool.callId!==t?!1:e.tool.phase===`complete`||e.tool.phase===`error`||e.tool.phase===`background`}var de={avif:`image/avif`,gif:`image/gif`,heic:`image/heic`,heif:`image/heif`,jpeg:`image/jpeg`,jpg:`image/jpeg`,png:`image/png`,svg:`image/svg+xml`,webp:`image/webp`,mp4:`video/mp4`,webm:`video/webm`,mov:`video/quicktime`,ogv:`video/ogg`,mp3:`audio/mpeg`,m4a:`audio/mp4`,ogg:`audio/ogg`,wav:`audio/wav`};function fe(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?void 0:de[t.slice(n+1).toLowerCase()]}function pe(e){let t=e.trim();if(t.length===0)return;let n;try{n=new URL(t)}catch{return}if(n.protocol!==`http:`&&n.protocol!==`https:`)return;let r=fe(n.pathname);if(r)return{url:n.href,mimeType:r}}var me=/^(.*)\/thumb(\/.+\/([^/]+))\/(\d+)px-\3(?:\.[a-z0-9]+)?$/i;function he(e){let t=new URL(e),n=t.hostname.split(`.`).slice(-2).join(`.`);for(let e of[...t.searchParams.keys()])e.startsWith(`utm_`)&&t.searchParams.delete(e);let r=me.exec(t.pathname);return{key:`${n}${r?`${r[1]}${r[2]}`:t.pathname}${t.search}`,width:r?Number(r[4]):1/0}}function ge(e){let t=new Map,n=[],r=e=>{if(typeof e==`string`){let r=pe(e);if(!r)return;let i=he(r.url),a=t.get(i.key);if(!a){t.set(i.key,{index:n.length,largest:i.width,smallest:i.width}),n.push(r);return}let o=n[a.index];i.width>a.largest?(a.largest=i.width,n[a.index]={...o,url:r.url,previewUrl:o.previewUrl??o.url}):i.width<a.smallest&&(a.smallest=i.width,n[a.index]={...o,previewUrl:r.url})}else if(Array.isArray(e))for(let t of e)r(t);else if(typeof e==`object`&&e)for(let t of Object.values(e))r(t)};return r(e),n}var C=0;function w(e){return e===`user`?`user-${globalThis.crypto.randomUUID()}`:(C+=1,`${e}-${String(C)}`)}function T(e,t){return e?.kind===t}function E(e,t,n,r){let i=e.at(-1);T(i,t)?i.text+=n:e.push({id:w(r),kind:t,text:n})}function D(e,t){let n=e.at(-1),r=n?.kind===`text`||n?.kind===`thought`;e.splice(r?e.length-1:e.length,0,t)}function O(e,t){return e.find(e=>e.kind===`tool`&&e.id===t)}function k(e,t){let n=`tool-${t.operationId??t.callId}`,r=O(e,n),i=y(r?.tool,t);if(r){r.tool=i;return}let a=t.phase===void 0?O(e,`tool-${t.callId}`):void 0;a?.tool.draft===void 0?e.push({id:n,kind:`tool`,tool:i}):(a.id=n,a.tool=i)}function A(e,t){let n=`tool-${t.callId}`,r=O(e,n),i=x(r?.tool,t);r?r.tool=i:e.push({id:n,kind:`tool`,tool:i})}function j(e){return e.findLast(e=>e.kind===`structured`&&e.draft!==void 0)}function M(e,t,n){let r=j(e),i=(r?.draft??``)+t;r?(r.draft=i,r.value=v(i)):e.push({id:w(n),kind:`structured`,value:v(i),draft:i})}function N(e,t,n){let r=j(e);r?(r.value=t,delete r.draft):e.push({id:w(n),kind:`structured`,value:t})}function P(e,t){return e.type===t.type?e.placeId&&t.placeId?e.placeId===t.placeId:e.uri===t.uri:!1}function F(e,t,n){let r=e.find(e=>e.kind===`citation`&&e.callId===t.callId),i=r?[...r.sources]:[];for(let e of t.sources)i.some(t=>P(t,e))||i.push(e);r?r.sources=i:e.push({id:w(n),kind:`citation`,sources:i,...t.callId===void 0?{}:{callId:t.callId}})}function I(e,t,n,r){if(t.phase===`complete`&&t.output!==void 0)for(let i of ge(t.output))r.has(i.url)||(r.add(i.url),e.push({id:w(n),kind:`media`,mimeType:i.mimeType,url:i.url,...i.previewUrl?{previewUrl:i.previewUrl}:{}}))}function L(e,t){return e.messages.flatMap(e=>{if(e.role!==`user`)return[];let n=e.parts??[],r=[e.content??``,...n.map(e=>`text`in e?e.text:``)].join(``).trim();return[...r?[{id:w(t),kind:`user-text`,text:r}]:[],...n.flatMap(e=>`text`in e?[]:[{id:w(t),kind:e.type===`audio`?`user-voice`:`user-attachment`,name:e.mimeType,mimeType:e.mimeType,...`data`in e?{sizeBytes:Math.floor(e.data.length*3/4),data:e.data}:{sizeBytes:0}}])]})}function R(e,t=`user`){let n=[],r=e.text?.trim();r&&n.push({id:w(t),kind:`user-text`,text:r});for(let r of e.attachments??[])n.push({id:w(t),kind:`user-attachment`,name:r.name,mimeType:r.mimeType,sizeBytes:r.sizeBytes,...r.data===void 0?{}:{data:r.data}});for(let r of e.voice??[])n.push({id:w(t),kind:`user-voice`,name:r.name,mimeType:r.mimeType,sizeBytes:r.sizeBytes,...r.data===void 0?{}:{data:r.data}});return n}function _e(e,t){switch(e.type){case`media`:return e.media?{id:w(t),kind:`media`,mimeType:e.media.mimeType,data:e.media.data}:void 0;case`grounding`:return{id:w(t),kind:`grounding`,grounding:e.grounding};case`evidence`:return{id:w(t),kind:`evidence`,evidence:e.evidence};case`late_results`:return{id:w(t),kind:`late-results`,text:e.text};case`error`:return e.error?{id:w(t),kind:`error`,message:e.error}:void 0;case`done`:return{id:w(t),kind:`turn-done`,stop:e.stop,tokens:e.tokens,interactionId:e.interactionId,compaction:e.compaction!==void 0};default:return}}function ve(e,t,n){if(t.phase===`complete`)for(let r of t.parts??[])r.type!==`text`&&e.push({id:w(n),kind:`media`,mimeType:r.mimeType,...`data`in r?{data:r.data}:{url:r.uri}})}function z(e,t={}){let r=t.idPrefix??`turn`,i=t.showThoughts??!0;C=0;let a=[],o=new Set;for(let t of n(e))switch(t.type){case`thought`:i&&t.text&&E(a,`thought`,t.text,r);break;case`text`:t.text&&E(a,`text`,t.text,r);break;case`tool_draft`:A(a,t);break;case`tool`:k(a,t.tool),I(a,t.tool,r,o),ve(a,t.tool,r);break;case`structured_draft`:M(a,t.text,r);break;case`structured`:N(a,t.structured,r);break;case`citation`:F(a,t,r);break;case`guardrail`:D(a,{id:w(r),kind:`guardrail`,guardrail:t.guardrail});break;case`stage`:for(let e of t.injected??[])a.push(...L(e,r));break;default:{let e=_e(t,r);e&&a.push(e)}}return a}function ye(e,t,n={}){return[...R(e,`user`),...z(t,n)]}function be(e){if(!e)return i;let{detect:t,patterns:n}=e;if(!n)return t;let r=Object.fromEntries(Object.entries(n).map(([e,{theorem:t}])=>[e,{theorem:t,matchers:[]}]));return{...t,sources:r}}function xe(e,t){if(e.text===void 0)return e;let n=a(e.text,`user`,be(t));return{...e,text:n.text??e.text}}function B(e,t,n){let r=s(e,t);if(!r.ok)return{ok:!1,issues:r.issues};let i=xe(t,n);return{ok:!0,draft:i,blocks:R(i)}}function V(e,t){if(t)return e.models[t]}function H(e){return!!(e.allowModelSelect&&Object.keys(e.models).length>=2)}function U(e,t){let n=V(e,t);return n?.allowEffortSelect?Object.keys(n.efforts??{}).length>=2:!1}function W(e,t){let n=V(e,t);if(!n?.efforts)return;let r=n.defaultEffort?.trim();return r&&n.efforts[r]?r:Object.keys(n.efforts)[0]}function Se(e){return H(e)?Object.entries(e.models).map(([e,t])=>({id:e,label:t.apiId})):[]}function Ce(e,t){if(!U(e,t))return[];let n=V(e,t);return n?.efforts?Object.entries(n.efforts).map(([e,t])=>({alias:e,level:t})):[]}function G(e){let t=new Set;for(let n of e)if(n.type===`tool`&&n.tool.phase===`complete`)for(let e of c(n.tool.output)??[])t.add(e);return[...t]}function K(t){let n=e(t,e=>e.type===`done`&&e.tools!==void 0);return n?.type===`done`?n.tools:void 0}function we(t){let n=K(t)?.visible??[],r=e(t,e=>e.type===`done`&&e.steps!==void 0);return{promoted:[...new Set([...n,...G(t)])],stepsTaken:r?.type===`done`?r.steps??0:0}}function q(e){return e?.streaming?.streamThoughts!==!1}function J(e){return e.defaultModel??Object.keys(e.models)[0]}function Te(e,t,n){let r=t.model!==void 0&&Object.hasOwn(e.models,t.model)&&(n===void 0||t.model!==J(n))?t.model:J(e),i=r===void 0?void 0:e.models[r]?.efforts;return{model:r,effort:r===t.model&&t.effort!==void 0&&i!==void 0&&Object.hasOwn(i,t.effort)&&(n===void 0||t.effort!==W(n,r))?t.effort:W(e,r)}}function Y(e){if(!e.operationId)throw new r(`request`,o(`session.gate_expired`));return e.operationId}function Ee(e,t){return t.selectedModel??J(e)}function X(e,t,n){let r=t.selectedEffort;if(!n||!Object.hasOwn(e.models,n))return r;let i=e.models[n];return i.allowEffortSelect?r??i.defaultEffort:r===W(e,n)?void 0:r}function Z(e,t){let n=Ee(e,t),r=e.allowModelSelect||n!==J(e)?n:void 0,i=X(e,t,n);return{...r?{model:r}:{},...i?{effort:i}:{}}}function De(e,t,n){return{name:n.name,input:n.input,...n.gateKind?{gateKind:n.gateKind}:{},sessionPermissions:n.sessionPermissions??t.sessionPermissions,...t.toolSnapshot?{snapshot:t.toolSnapshot}:{},...t.promotedToolIds.length?{promoted:[...t.promotedToolIds]}:{},...Z(e,t)}}function Q(e){return{...e.conversation?{conversation:e.conversation}:{},...e.turnId?{turnId:e.turnId}:{}}}function Oe(e,t,n,r={}){let i=(r.walkAway?.calls??[]).map(e=>({callId:e.callId,operationId:Y(e)}));return{...Q(r),...Z(e,t),input:n,...i.length?{abandon:i}:{},replay:{sessionPermissions:t.sessionPermissions}}}function ke(e,t,n,r={}){return{...Q(r),gateId:n.gateId,operationId:n.operationId,decision:n.decision,...n.secret===void 0?{}:{secret:n.secret},...n.page===void 0?{}:{page:n.page},replay:De(e,t,{...n,gateKind:n.gateKind??(t.gatedTool?.callId===n.gateId?t.gatedTool.gateKind:void 0)})}}function $(e,t){return B(e.inputs,t,e.guardrails)}function Ae(e,t,n,r=[]){return $(e,{...t.trim()?{text:t}:{},...n.length?{attachments:l(n)}:{},...r.length?{voice:l(r)}:{}})}function je(e,t){return z(t,{showThoughts:q(e.outputs)})}export{ae as C,ee as D,te as E,p as O,le as S,ne as T,B as _,Ae as a,y as b,q as c,K as d,W as f,H as g,Se as h,Y as i,m as k,G as l,Ce as m,Oe as n,$ as o,U as p,je as r,Te as s,ke as t,we as u,ye as v,f as w,ue as x,z as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{l as e}from"./themeProps-Bo2jNkIC.js";import{t}from"./createReactComponent-DVEyVJ-p.js";import{t as n}from"./IconMathFunction-CyMTpj2z.js";import{t as r}from"./IconMicrophone-BT77cilC.js";import{t as i}from"./IconServer-Dfs13rbh.js";import{t as a}from"./IconTool-BHps7rbl.js";import{t as o}from"./IconWorld-DkkGLUyH.js";var s=t(`outline`,`chart-bar`,`ChartBar`,[[`path`,{d:`M3 13a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -6`,key:`svg-0`}],[`path`,{d:`M15 9a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -10`,key:`svg-1`}],[`path`,{d:`M9 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -14`,key:`svg-2`}],[`path`,{d:`M4 20h14`,key:`svg-3`}]]),c=t(`outline`,`chart-scatter-3d`,`ChartScatter3d`,[[`path`,{d:`M3 20l9 -7`,key:`svg-0`}],[`path`,{d:`M12 3v10l9 7`,key:`svg-1`}],[`path`,{d:`M17 12v.015`,key:`svg-2`}],[`path`,{d:`M17 4.015v.015`,key:`svg-3`}],[`path`,{d:`M21 8.015v.015`,key:`svg-4`}],[`path`,{d:`M12 19.015v.015`,key:`svg-5`}],[`path`,{d:`M3 12.015v.015`,key:`svg-6`}],[`path`,{d:`M7 8.015v.015`,key:`svg-7`}],[`path`,{d:`M3 4.015v.015`,key:`svg-8`}]]),l=t(`outline`,`file-smile`,`FileSmile`,[[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2m-7 -7h.01m3.99 0h.01`,key:`svg-1`}],[`path`,{d:`M10 17a3.5 3.5 0 0 0 4 0`,key:`svg-2`}]]),u=t(`outline`,`gavel`,`Gavel`,[[`path`,{d:`M13 10l7.383 7.418c.823 .82 .823 2.148 0 2.967a2.11 2.11 0 0 1 -2.976 0l-7.407 -7.385`,key:`svg-0`}],[`path`,{d:`M6 9l4 4`,key:`svg-1`}],[`path`,{d:`M13 10l-4 -4`,key:`svg-2`}],[`path`,{d:`M3 21h7`,key:`svg-3`}],[`path`,{d:`M6.793 15.793l-3.586 -3.586a1 1 0 0 1 0 -1.414l2.293 -2.293l.5 .5l3 -3l-.5 -.5l2.293 -2.293a1 1 0 0 1 1.414 0l3.586 3.586a1 1 0 0 1 0 1.414l-2.293 2.293l-.5 -.5l-3 3l.5 .5l-2.293 2.293a1 1 0 0 1 -1.414 0`,key:`svg-4`}]]),d=t(`outline`,`headset`,`Headset`,[[`path`,{d:`M4 14v-3a8 8 0 1 1 16 0v3`,key:`svg-0`}],[`path`,{d:`M18 19c0 1.657 -2.686 3 -6 3`,key:`svg-1`}],[`path`,{d:`M4 14a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v3a2 2 0 0 1 -2 2h-1a2 2 0 0 1 -2 -2v-3`,key:`svg-2`}],[`path`,{d:`M15 14a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v3a2 2 0 0 1 -2 2h-1a2 2 0 0 1 -2 -2v-3`,key:`svg-3`}]]),f=t(`outline`,`letter-t`,`LetterT`,[[`path`,{d:`M6 4l12 0`,key:`svg-0`}],[`path`,{d:`M12 4l0 16`,key:`svg-1`}]]),p=t(`outline`,`list-check`,`ListCheck`,[[`path`,{d:`M3.5 5.5l1.5 1.5l2.5 -2.5`,key:`svg-0`}],[`path`,{d:`M3.5 11.5l1.5 1.5l2.5 -2.5`,key:`svg-1`}],[`path`,{d:`M3.5 17.5l1.5 1.5l2.5 -2.5`,key:`svg-2`}],[`path`,{d:`M11 6l9 0`,key:`svg-3`}],[`path`,{d:`M11 12l9 0`,key:`svg-4`}],[`path`,{d:`M11 18l9 0`,key:`svg-5`}]]),m=t(`outline`,`number`,`Number`,[[`path`,{d:`M4 17v-10l7 10v-10`,key:`svg-0`}],[`path`,{d:`M15 17h5`,key:`svg-1`}],[`path`,{d:`M15 10a2.5 3 0 1 0 5 0a2.5 3 0 1 0 -5 0`,key:`svg-2`}]]),h=t(`outline`,`photo`,`Photo`,[[`path`,{d:`M15 8h.01`,key:`svg-0`}],[`path`,{d:`M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12`,key:`svg-1`}],[`path`,{d:`M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5`,key:`svg-2`}],[`path`,{d:`M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3`,key:`svg-3`}]]),g=t(`outline`,`square-dashed`,`SquareDashed`,[[`path`,{d:`M5 3a2 2 0 0 0 -2 2`,key:`svg-0`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`svg-1`}],[`path`,{d:`M21 19a2 2 0 0 1 -2 2`,key:`svg-2`}],[`path`,{d:`M5 21a2 2 0 0 1 -2 -2`,key:`svg-3`}],[`path`,{d:`M9 3h1`,key:`svg-4`}],[`path`,{d:`M9 21h1`,key:`svg-5`}],[`path`,{d:`M14 3h1`,key:`svg-6`}],[`path`,{d:`M14 21h1`,key:`svg-7`}],[`path`,{d:`M3 9v1`,key:`svg-8`}],[`path`,{d:`M21 9v1`,key:`svg-9`}],[`path`,{d:`M3 14v1`,key:`svg-10`}],[`path`,{d:`M21 14v1`,key:`svg-11`}]]),_=t(`outline`,`volume`,`Volume`,[[`path`,{d:`M15 8a5 5 0 0 1 0 8`,key:`svg-0`}],[`path`,{d:`M17.7 5a9 9 0 0 1 0 14`,key:`svg-1`}],[`path`,{d:`M6 15h-2a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h2l3.5 -4.5a.8 .8 0 0 1 1.5 .5v14a.8 .8 0 0 1 -1.5 .5l-3.5 -4.5`,key:`svg-2`}]]),v=e();function y(e){return(0,v.jsx)(`svg`,{viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":!0,...e,children:(0,v.jsx)(`path`,{d:`M13.85 0a4.16 4.16 0 0 0-2.95 1.217L1.456 10.66a.835.835 0 0 0 0 1.18.835.835 0 0 0 1.18 0l9.442-9.442a2.49 2.49 0 0 1 3.541 0 2.49 2.49 0 0 1 0 3.541L8.59 12.97l-.1.1a.835.835 0 0 0 0 1.18.835.835 0 0 0 1.18 0l.1-.098 7.03-7.034a2.49 2.49 0 0 1 3.542 0l.049.05a2.49 2.49 0 0 1 0 3.54l-8.54 8.54a1.96 1.96 0 0 0 0 2.755l1.753 1.753a.835.835 0 0 0 1.18 0 .835.835 0 0 0 0-1.18l-1.753-1.753a.266.266 0 0 1 0-.394l8.54-8.54a4.185 4.185 0 0 0 0-5.9l-.05-.05a4.16 4.16 0 0 0-2.95-1.218c-.2 0-.401.02-.6.048a4.17 4.17 0 0 0-1.17-3.552A4.16 4.16 0 0 0 13.85 0m0 3.333a.84.84 0 0 0-.59.245L6.275 10.56a4.186 4.186 0 0 0 0 5.902 4.186 4.186 0 0 0 5.902 0L19.16 9.48a.835.835 0 0 0 0-1.18.835.835 0 0 0-1.18 0l-6.985 6.984a2.49 2.49 0 0 1-3.54 0 2.49 2.49 0 0 1 0-3.54l6.983-6.985a.835.835 0 0 0 0-1.18.84.84 0 0 0-.59-.245`})})}var b=l,x={text:f,image:h,speech:_,transcription:r,live:d,decision:u,embedding:c,host:i};function S(e){if(e!==void 0&&Object.hasOwn(x,e))return x[e]}var C={function:n,http:o,mcp:y,agent:b},w={choice:p,score:s,noul:m,box:g};function T(e){return Object.hasOwn(C,e)?C[e]:a}export{S as a,h as c,C as i,d as l,x as n,T as o,w as r,_ as s,b as t,u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=/[\u0300-\u036f]/g,t={đ:`d`,Đ:`d`,ł:`l`,Ł:`l`,ø:`o`,Ø:`o`,ħ:`h`,Ħ:`h`,ŧ:`t`,Ŧ:`t`,ƀ:`b`,Ƀ:`b`,ı:`i`},n=/[đĐłŁøØħĦŧŦƀɃı]/g,r=/[đĐłŁøØħĦŧŦƀɃıİ]/;function i(r){return r.normalize(`NFD`).replace(e,``).replace(n,e=>t[e]??e).normalize(`NFC`).toLowerCase()}function a(e,t){return e.length===0&&t!==` `&&i(t).length===0?null:e.length>0&&e.split(``).every(e=>i(e)===i(t))?t:e+t}function o(e){return e.normalize(`NFC`).replace(/I/g,`ı`).replace(/İ/g,`i`).toLowerCase()}function s(e){return r.test(e)||/[\u0300-\u036f]/.test(e.normalize(`NFD`))}function c(e,t,n=!1){let r=e.trim();if(n)return o(r).startsWith(o(t));let a=i(t);return a.length!==0&&i(r).startsWith(a)}function l(e,t,n){let r=s(n)?[!0,!1]:[!1];for(let i of r)for(let r of e){let e=t(r);if(e!=null&&c(e,n,i))return r}return-1}export{a as n,l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Dn as e}from"./shaped-data-
|
|
1
|
+
import{Dn as e}from"./shaped-data-BPXuDrSn.js";var t=/\{\s*private\s*:/g,n=/\n(?:[ \t]*\n)+/,r=/^\s*when\s/;function i(e){let[t,...n]=e;if(t===void 0)return;if(n.length===0&&typeof t==`string`)return t.trim()||void 0;let r=[...e],i=e.at(-1);typeof t==`string`&&(r[0]=t.trimStart()),typeof i==`string`&&(r[r.length-1]=i.trimEnd());let a=r.filter(e=>e!==``),[o,...s]=a;return s.length===0&&typeof o==`string`?o:a}function a(e){let r=[[]],a=e=>{let[t=``,...i]=e.split(n);r.at(-1)?.push(t),r.push(...i.map(e=>[e]))},o=0;for(let n of e.matchAll(t)){if(n.index<o)continue;let t=1,i=n.index+n[0].length;for(;i<e.length&&t>0;i++)e[i]===`{`?t++:e[i]===`}`&&t--;if(a(e.slice(o,n.index)),t>0)return{ok:!1,message:`The {private: section on line ${String(r.length)} has no closing }.`};let s=e.slice(n.index+n[0].length,i-1).trim();if(!s)return{ok:!1,message:`The {private: section on line ${String(r.length)} is empty.`};r.at(-1)?.push({private:s}),o=i}return a(e.slice(o)),{ok:!0,lines:r.flatMap(e=>{let t=i(e.filter(e=>e!==``));return t===void 0?[]:[t]})}}var o=e.filter(e=>e!==`builtin`),s=`Tool type must be ${o.join(`, `).replace(/, ([^,]+)$/,`, or $1`)}.`;export{a as i,s as n,r,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{d as t,l as n}from"./themeProps-Bo2jNkIC.js";import{t as r}from"./Icon-Cluq4EiW.js";import{t as i}from"./Text-BDwNaqzZ.js";import{b as a,w as o}from"./browser-transport-Cw2eNd0h.js";import{t as s}from"./Tooltip-Dhy5lIDA.js";import{d as c}from"./reader-LWnKsoZI.js";import{n as l,o as u}from"./labels-provider-B6PGDZ7i.js";import{t as d}from"./useLocale-d7ARRGFj.js";import{t as f}from"./HStack-CqE4exX9.js";import{t as p}from"./IconButton-Jbcy-K-d.js";import{t as m}from"./VStack-CCYGIv4A.js";import{_ as h,b as g,g as _,y as v}from"./ConsoleFrame-6cZcgAw3.js";import{c as y,i as b}from"./trace-patterns-DFMwRU00.js";import{n as x}from"./studio-console-B1jS8dTh.js";import{B as S,st as C,ut as w,z as T}from"./index-Df0i5k06.js";var E=e(t(),1),D=n(),O=`var(--duration-medium) var(--ease-standard)`,k=12;function A(){let e=d();return(0,E.useMemo)(()=>({percent:new Intl.NumberFormat(e,{style:`percent`,maximumFractionDigits:0}),decimal:new Intl.NumberFormat(e,{maximumFractionDigits:2}),usd:new Intl.NumberFormat(e,{style:`currency`,currency:`USD`,maximumSignificantDigits:2})}),[e])}function j(e){return y(e?`clear`:`shade2`)}function M({value:e,isLead:t}){return(0,D.jsx)(`div`,{style:{height:k,width:`${String(Math.max(e,.01)*100)}%`,borderRadius:4,background:j(t),transition:`width ${O}`}})}function N({title:e,aside:t,detail:n,answer:r}){let a=l(),o=A(),s=Object.entries(r.probabilities).sort(([,e],[,t])=>t-e);return(0,D.jsx)(b,{title:e,aside:t,detail:n,value:r.choice,note:a(`@theorem.decision.confidence`,{percent:o.percent.format(r.confidence)}),children:(0,D.jsx)(m,{gap:2,role:`list`,children:s.map(([e,t])=>(0,D.jsxs)(m,{gap:1,role:`listitem`,"aria-label":a(`@theorem.decision.option`,{label:e,percent:o.percent.format(t)}),children:[(0,D.jsxs)(f,{gap:2,hAlign:`between`,"aria-hidden":!0,children:[(0,D.jsx)(i,{type:`supporting`,color:`secondary`,maxLines:1,children:e}),(0,D.jsx)(i,{type:`supporting`,hasTabularNumbers:!0,children:o.percent.format(t)})]}),(0,D.jsx)(M,{value:t,isLead:e===r.choice})]},e))})})}var P=56;function F(e){let t=e.split(/[:—–]\s/)[0]?.trim()??``;return t&&t.length<=32&&t!==e?t:e}function I({title:e,aside:t,detail:n,answer:r,labels:a}){let o=l(),s=A(),c=a.length,u=Math.min(c-1,Math.max(0,Math.round(r.score)));return(0,D.jsx)(b,{title:e,aside:t,detail:n,value:a[u]===void 0?s.decimal.format(r.score):F(a[u]),note:[o(`@theorem.decision.score_of`,{score:s.decimal.format(r.score),max:s.decimal.format(c-1)}),o(`@theorem.decision.confidence`,{percent:s.percent.format(r.confidence)})].join(` · `),children:(0,D.jsxs)(m,{gap:1,children:[(0,D.jsxs)(`div`,{"aria-hidden":!0,style:{position:`relative`,display:`flex`,alignItems:`flex-end`,gap:4,height:P},children:[a.map((e,t)=>(0,D.jsx)(`div`,{style:{flex:1,height:`${String(Math.max(.04,r.probabilities[String(t)]??0)*100)}%`,borderRadius:4,background:j(t===u),transition:`height ${O}`}},`${String(t)}:${e}`)),(0,D.jsx)(`div`,{style:{position:`absolute`,insetBlock:-4,left:`${String((r.score+.5)/c*100)}%`,width:0,borderInlineStart:`1.5px dashed var(--color-text-secondary)`,transition:`left ${O}`}})]}),(0,D.jsx)(`div`,{style:{display:`flex`,gap:4},children:a.map((e,t)=>(0,D.jsx)(`div`,{style:{flex:1,minWidth:0},title:e,children:(0,D.jsx)(i,{type:`supporting`,color:`secondary`,maxLines:1,children:F(e)})},`${String(t)}:${e}`))}),(0,D.jsx)(`span`,{style:{position:`absolute`,width:1,height:1,overflow:`hidden`,clipPath:`inset(50%)`},children:a.map((e,t)=>o(`@theorem.decision.option`,{label:e,percent:s.percent.format(r.probabilities[String(t)]??0)})).join(`; `)})]})})}function L({title:e,aside:t,detail:n,answer:r}){let i=A();return(0,D.jsx)(b,{title:e,aside:t,detail:n,value:i.decimal.format(r.noul)})}var R=72,z=168;function B(e){let[t,n]=(0,E.useState)(null);return(0,E.useEffect)(()=>{let t=new Image;t.onload=()=>{n({width:t.naturalWidth,height:t.naturalHeight})},t.src=e},[e]),t}function V(e,t){let n=e.style.color;e.style.color=`var(${t})`;let r=getComputedStyle(e).color;return e.style.color=n,r}function H({source:e,box:t,caption:n}){let r=l(),i=v(e),a=B(i),[o,c]=(0,E.useState)(null);if(!a)return null;let u=h(t),d=a.width*(t.right-t.left)/(a.height*(t.bottom-t.top)),f=r(`@theorem.decision.open_box`);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(s,{content:f,children:(0,D.jsx)(w,{label:f,padding:0,onClick:e=>{let n={outline:V(e.currentTarget,`--color-accent`),shade:V(e.currentTarget,`--color-overlay`)};g(i,t,n).then(c)},children:(0,D.jsx)(`div`,{role:`img`,"aria-label":r(`@theorem.decision.box_in`),style:{position:`relative`,overflow:`hidden`,aspectRatio:String(d),height:z,maxWidth:`100%`,borderRadius:4},children:(0,D.jsx)(`img`,{src:i,alt:``,style:{position:`absolute`,width:`${String(u.width)}%`,height:`${String(u.height)}%`,left:`${String(u.left)}%`,top:`${String(u.top)}%`,maxWidth:`none`}})})})}),(0,D.jsx)(C,{isOpen:o!==null,onOpenChange:e=>{e||c(null)},media:{src:o??i,alt:r(`@theorem.decision.box_marked`),caption:n},hasZoom:!0})]})}function U({title:e,aside:t,detail:n,answer:r,image:i,asked:a}){let o=l(),s=a&&_(a.images,a.state,i),c=A(),{top:u,bottom:d,left:f,right:p}=r.box,m=o(`@theorem.decision.box_edges`,{left:c.percent.format(f),top:c.percent.format(u),right:c.percent.format(p),bottom:c.percent.format(d)});return(0,D.jsx)(b,{title:e,aside:t,detail:n,value:m,note:o(`@theorem.decision.confidence`,{percent:c.percent.format(r.confidence)}),children:s?(0,D.jsx)(H,{source:s,box:r.box,caption:`${e}: ${m}`}):(0,D.jsx)(`div`,{"aria-hidden":!0,style:{position:`relative`,height:R,borderRadius:4,border:`1px solid var(--color-border)`},children:(0,D.jsx)(`div`,{style:{position:`absolute`,insetInlineStart:`${String(f*100)}%`,insetBlockStart:`${String(u*100)}%`,width:`${String((p-f)*100)}%`,height:`${String((d-u)*100)}%`,borderRadius:2,background:j(!0),transition:`all ${O}`}})})})}function W({question:e,answer:t,asked:n,onQuestion:i,detail:a}){let s=l(),c=`${e.id} · ${s(`@theorem.decision.type.${e.type}`)}`;if(!t)return null;let u=s(`@theorem.decision.edit_question`,{question:e.id}),d={title:c,detail:a,aside:i?(0,D.jsx)(p,{label:u,tooltip:u,size:`sm`,variant:`ghost`,icon:(0,D.jsx)(r,{icon:o,size:`xsm`,color:`secondary`}),onClick:()=>{i(e.id)}}):void 0};return t.type===`choice`?(0,D.jsx)(N,{...d,answer:t}):t.type===`score`?(0,D.jsx)(I,{...d,answer:t,labels:e.labels}):t.type===`noul`?(0,D.jsx)(L,{...d,answer:t}):(0,D.jsx)(U,{...d,answer:t,image:e.image,asked:n})}function G({model:e,usage:t,elapsedMs:n,isStale:r,tokens:a,children:o}){let s=l(),c=A();return(0,D.jsx)(S,{children:(0,D.jsxs)(m,{gap:3,style:{opacity:r?.5:1,transition:`opacity ${O}`},"aria-busy":r,children:[o,(0,D.jsx)(T,{children:(0,D.jsx)(i,{type:`supporting`,color:`secondary`,hasTabularNumbers:!0,children:u(s,c.usd,{model:e,usage:t,elapsedMs:n,tokens:a})})})]},n??0)})}function K({iface:e,result:t,elapsedMs:n,isStale:r,asked:i,onQuestion:a,questionText:o}){let s=l();return(0,D.jsx)(G,{model:t.model,usage:t.usage,elapsedMs:n,isStale:r,tokens:e=>s(`@theorem.decision.tokens`,{count:e}),children:(0,D.jsx)(x,{minWidth:260,children:e.questions.map(e=>(0,D.jsx)(T,{children:(0,D.jsx)(W,{question:e,answer:t.answers[e.id],asked:i,onQuestion:a,detail:o?.[e.id]})},e.id))})})}var q={status:`idle`,result:null,elapsedMs:null,startedAt:null,failure:null};function J(e,t){for(let n of t??[])e.traces?.push(n)}function Y(e,t,n){let[r,i]=(0,E.useState)(q),o=(0,E.useRef)(null);(0,E.useEffect)(()=>()=>o.current?.abort(),[]);let s=(0,E.useCallback)(()=>{o.current?.abort(),o.current=null,i(e=>e.status===t?{...e,status:e.result?`done`:`idle`,startedAt:null}:e)},[t]),l=(0,E.useCallback)(async(...r)=>{o.current?.abort();let s=new AbortController;o.current=s,i(e=>({status:t,result:e.result,elapsedMs:e.elapsedMs,startedAt:Date.now(),failure:null}));let l=performance.now();try{let t=await n(e,s.signal,...r);if(s.signal.aborted)return;J(e,t.traces),i({status:`done`,result:t.result,elapsedMs:performance.now()-l,startedAt:null,failure:null})}catch(t){if(s.signal.aborted)return;J(e,c(t)),i(e=>({...e,status:`error`,startedAt:null,failure:a(t)}))}finally{o.current===s&&(o.current=null)}},[e,t,n]);return{...r,call:l,cancel:s}}export{A as a,K as i,G as n,M as r,Y as t};
|