@shumai-one/shumai 0.5.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/bin/{chunk-qxscgcn9.js → chunk-01ym2agz.js} +1 -1
  2. package/bin/{chunk-ae6zgjhd.js → chunk-047n9gfs.js} +2 -2
  3. package/bin/chunk-0a4ahz7r.js +2 -0
  4. package/bin/{chunk-v5hz09a1.js → chunk-0awcpx0a.js} +2 -2
  5. package/bin/{chunk-19q13a80.js → chunk-0fbgfgxv.js} +5 -5
  6. package/bin/{chunk-jt6v15wx.js → chunk-0nnqha4f.js} +1 -1
  7. package/bin/chunk-0tvggyy4.js +1 -0
  8. package/bin/{chunk-zckxc8m6.js → chunk-113baw0m.js} +2 -2
  9. package/bin/{chunk-mneeg71d.js → chunk-1dbjyarc.js} +2 -2
  10. package/bin/{chunk-951r2rx1.js → chunk-1qre79kf.js} +1 -1
  11. package/bin/chunk-27v3yepb.js +1 -0
  12. package/bin/{chunk-5vqbzsjv.js → chunk-2rq3w8sg.js} +1 -1
  13. package/bin/{chunk-v034sfw8.js → chunk-3020am4q.js} +2 -2
  14. package/bin/{chunk-zdzkjp4q.js → chunk-3fjgf7eb.js} +2 -2
  15. package/bin/chunk-3pwwg1xm.js +1 -0
  16. package/bin/{chunk-19jpn3r6.js → chunk-3sfb63fp.js} +1 -1
  17. package/bin/{chunk-wwkhskce.js → chunk-3tg10kwz.js} +2 -2
  18. package/bin/{chunk-0y4zq3y4.js → chunk-4g4pxmef.js} +1 -1
  19. package/bin/{chunk-2pw7xcrn.js → chunk-4jj92zwa.js} +1 -1
  20. package/bin/{chunk-bpxw19ez.js → chunk-4yhvexzk.js} +1 -1
  21. package/bin/chunk-58cbk6e8.js +1 -0
  22. package/bin/{chunk-eqr0znmc.js → chunk-59t9s2jh.js} +1 -1
  23. package/bin/{chunk-n76w2wcr.js → chunk-5e7r7a9d.js} +1 -1
  24. package/bin/{chunk-8tzfcqtb.js → chunk-5m51b7af.js} +1 -1
  25. package/bin/{chunk-m6v8vt2b.js → chunk-65t6rm5d.js} +2 -2
  26. package/bin/chunk-6bed0rz4.js +1 -0
  27. package/bin/{chunk-1nvj833s.js → chunk-6smn0q1n.js} +5 -5
  28. package/bin/{chunk-r249n1xe.js → chunk-6zerk0em.js} +2 -2
  29. package/bin/{chunk-gvas3xkp.js → chunk-7bbsv8g0.js} +1 -1
  30. package/bin/chunk-83bdgs2c.js +1 -0
  31. package/bin/{chunk-93p27bbm.js → chunk-86qtjd30.js} +5 -5
  32. package/bin/{chunk-b5r0be06.js → chunk-8rekh4h9.js} +1 -1
  33. package/bin/{chunk-d2dgazjj.js → chunk-8s9fehda.js} +1 -1
  34. package/bin/{chunk-r776bhsg.js → chunk-8sf2hf31.js} +1 -1
  35. package/bin/{chunk-mn108p93.js → chunk-9d3w678j.js} +1 -1
  36. package/bin/{chunk-xr2v0d6y.js → chunk-9gftd4f7.js} +4 -4
  37. package/bin/{chunk-n9vp9nbg.js → chunk-9rcg8zgs.js} +32 -32
  38. package/bin/{chunk-6jkjx0n2.js → chunk-a23q1kc4.js} +3 -3
  39. package/bin/{chunk-81dawvn4.js → chunk-a6cdt85k.js} +2 -2
  40. package/bin/chunk-a76h3ehe.js +1 -0
  41. package/bin/{chunk-rmvhyqyb.js → chunk-b1bkd2p4.js} +8 -8
  42. package/bin/{chunk-wnqxyqrg.js → chunk-bf5m8f6t.js} +2 -2
  43. package/bin/chunk-cf57fk11.js +2 -0
  44. package/bin/{chunk-0v9srsdz.js → chunk-cv5xx81e.js} +1 -1
  45. package/bin/{chunk-3q5qkfkc.js → chunk-czybv3vy.js} +1 -1
  46. package/bin/{chunk-ggfx2b0f.js → chunk-d4sbcvpa.js} +1 -1
  47. package/bin/{chunk-9ggwc289.js → chunk-d6xezgrg.js} +1 -1
  48. package/bin/{chunk-bbcmhcvc.js → chunk-da86fpjt.js} +2 -2
  49. package/bin/chunk-dzjmwat0.js +14 -0
  50. package/bin/{chunk-rza95y4z.js → chunk-eex8sjfs.js} +2 -2
  51. package/bin/{chunk-9zgqjdx1.js → chunk-emgyjhmx.js} +2 -2
  52. package/bin/{chunk-k3prp6c6.js → chunk-exmwerag.js} +5 -5
  53. package/bin/{chunk-kzr6ecke.js → chunk-f38xyahm.js} +1 -1
  54. package/bin/{chunk-ffj9cq9y.js → chunk-fb1bes2h.js} +1 -1
  55. package/bin/chunk-fbvak7q2.js +1 -0
  56. package/bin/{chunk-15w79661.js → chunk-fg9sr6r9.js} +1 -1
  57. package/bin/{chunk-dppfek34.js → chunk-fyb6t7ct.js} +2 -2
  58. package/bin/chunk-g2ptqqm3.js +3 -0
  59. package/bin/{chunk-t1yamxgk.js → chunk-ggwqxn95.js} +1 -1
  60. package/bin/chunk-ghk54h71.js +13 -0
  61. package/bin/{chunk-kvwec0p3.js → chunk-h1fbev9c.js} +2 -2
  62. package/bin/{chunk-f5z3096k.js → chunk-h9akn41s.js} +2 -2
  63. package/bin/{chunk-asy868kq.js → chunk-hdansxny.js} +1 -1
  64. package/bin/{chunk-grjek810.js → chunk-hjwpd09v.js} +2 -2
  65. package/bin/{chunk-zf5cyxnt.js → chunk-hjzbw975.js} +1 -1
  66. package/bin/{chunk-jgfye6nf.js → chunk-j4p3eqtd.js} +1 -1
  67. package/bin/chunk-jtkxeat4.js +2 -0
  68. package/bin/{chunk-8zgq5sav.js → chunk-jw4g9628.js} +3 -3
  69. package/bin/{chunk-0ge2mm8j.js → chunk-jxebakyq.js} +1 -1
  70. package/bin/{chunk-0asthrjf.js → chunk-kfewyax2.js} +2 -2
  71. package/bin/chunk-kk3m4za5.js +1 -0
  72. package/bin/{chunk-vzdgsfkf.js → chunk-m7tnj47b.js} +1 -1
  73. package/bin/{chunk-w73v578p.js → chunk-maw5ah8t.js} +2 -2
  74. package/bin/{chunk-8ny7wvzb.js → chunk-n0wwtjwv.js} +1 -1
  75. package/bin/{chunk-e439kt05.js → chunk-nahdd2t9.js} +1 -1
  76. package/bin/{chunk-04avc4fn.js → chunk-nv7tztvh.js} +32 -32
  77. package/bin/{chunk-mn208vrv.js → chunk-nyjwdxyj.js} +2 -2
  78. package/bin/{chunk-qmrg2jhs.js → chunk-p0yfxt5e.js} +5 -5
  79. package/bin/{chunk-p0j4wpa5.js → chunk-q27qn367.js} +2 -2
  80. package/bin/{chunk-j53sjkxt.js → chunk-q36sdt2w.js} +1 -1
  81. package/bin/{chunk-vm2pz2hm.js → chunk-q7t5zs7n.js} +2 -2
  82. package/bin/{chunk-cpj562n6.js → chunk-qbj5pe8t.js} +1 -1
  83. package/bin/chunk-qj0bxb1m.js +2 -0
  84. package/bin/{chunk-9bakwac0.js → chunk-qk5hsn6e.js} +4 -4
  85. package/bin/{chunk-6rn094yj.js → chunk-qnyqtaf0.js} +1 -1
  86. package/bin/{chunk-ypkkfwfb.js → chunk-qqkr6h07.js} +2 -2
  87. package/bin/chunk-qyqc5j3a.css +1 -0
  88. package/bin/chunk-qzaf6bre.js +2 -0
  89. package/bin/{chunk-cx32wsa1.js → chunk-r1e59gf0.js} +1 -1
  90. package/bin/chunk-ra5csbkr.js +2 -0
  91. package/bin/{chunk-rtaya5wc.js → chunk-rh8dy99a.js} +2 -2
  92. package/bin/{chunk-ryepy5er.js → chunk-rx9g95wk.js} +4 -4
  93. package/bin/{chunk-2w6gve12.js → chunk-rxyy37wa.js} +3 -3
  94. package/bin/{chunk-7qvvf0yd.js → chunk-scez7ppq.js} +2 -2
  95. package/bin/{chunk-twpc640e.js → chunk-t2a1vq34.js} +1 -1
  96. package/bin/chunk-t879v3b7.js +1 -0
  97. package/bin/{chunk-a8bymrv1.js → chunk-tjavzarz.js} +2 -2
  98. package/bin/{chunk-ce0bhc72.js → chunk-treyx8em.js} +1 -1
  99. package/bin/{chunk-dche0gy0.js → chunk-v3z4z04s.js} +1 -1
  100. package/bin/{chunk-5bk16qdp.js → chunk-v3z63tpw.js} +2 -2
  101. package/bin/{chunk-5rzxekn4.js → chunk-v9bes1fv.js} +1 -1
  102. package/bin/{chunk-d5hbzp7t.js → chunk-vjyget8s.js} +1 -1
  103. package/bin/{chunk-4zksqvwj.js → chunk-vmm9m3nv.js} +2 -2
  104. package/bin/chunk-vvr8tnse.js +211 -0
  105. package/bin/{chunk-tvkekn4z.js → chunk-w3stry4v.js} +1 -1
  106. package/bin/{chunk-3pm6q6kg.js → chunk-w89czwjj.js} +1 -1
  107. package/bin/{chunk-rw5h0n0s.js → chunk-wk0hk00z.js} +1 -1
  108. package/bin/{chunk-15vsw36h.js → chunk-ww9qq8yq.js} +5 -5
  109. package/bin/chunk-x4q082e6.js +2 -0
  110. package/bin/{chunk-98mg3dpd.js → chunk-x6rf77jm.js} +4 -4
  111. package/bin/chunk-x7dyj53k.js +2 -0
  112. package/bin/{chunk-y2dhf3p0.js → chunk-xbw7ffrz.js} +2 -2
  113. package/bin/{chunk-5nqvqvqp.js → chunk-xcrd0y8v.js} +3 -3
  114. package/bin/{chunk-0j22699g.js → chunk-z0z0jn5h.js} +2 -2
  115. package/bin/{chunk-w9z27p0m.js → chunk-zasjhrwc.js} +1 -1
  116. package/bin/chunk-zefds5gg.js +1 -0
  117. package/bin/{chunk-8ayz61rc.js → chunk-zzzgk1d5.js} +3 -3
  118. package/bin/shumai-app.html +1 -1
  119. package/bin/shumai-app.js +390 -373
  120. package/package.json +8 -11
  121. package/prisma/migrations/20261014054332_add_embedding_768/migration.sql +8 -0
  122. package/prisma/schema.prisma +10 -8
  123. package/bin/chunk-2gf95tj0.js +0 -1
  124. package/bin/chunk-2tk5w3jc.js +0 -1
  125. package/bin/chunk-301e7g3z.js +0 -2
  126. package/bin/chunk-3kmjbc3m.js +0 -2
  127. package/bin/chunk-3td60k1m.js +0 -2
  128. package/bin/chunk-42hrvk6k.js +0 -211
  129. package/bin/chunk-8abhmarc.js +0 -2
  130. package/bin/chunk-965102pf.js +0 -3
  131. package/bin/chunk-acn3r2m2.js +0 -1
  132. package/bin/chunk-ce75dw3k.css +0 -1
  133. package/bin/chunk-d9qpgkek.js +0 -2
  134. package/bin/chunk-dv6p6n5e.js +0 -1
  135. package/bin/chunk-gnt9gewm.js +0 -2
  136. package/bin/chunk-k97axrc4.js +0 -13
  137. package/bin/chunk-qb178ntp.js +0 -2
  138. package/bin/chunk-s4r6e6ms.js +0 -1
  139. package/bin/chunk-syjjke3f.js +0 -1
  140. package/bin/chunk-tgfxe0sb.js +0 -1
  141. package/bin/chunk-tjretpx8.js +0 -1
  142. package/bin/chunk-w4yjgez6.js +0 -14
  143. package/bin/chunk-wjcebkpb.js +0 -1
  144. package/bin/chunk-ws71fg50.js +0 -2
  145. package/bin/chunk-yfp3q4da.js +0 -1
  146. package/bin/chunk-z8e4wc59.js +0 -1
@@ -1 +1 @@
1
- import{m,D,u,S,L,t,o,V,B,mt,Re,ze,A,O,jn,js,Pa,C,Ce,Ie,Te,VA,X0,V_,Lf,zc,Hs,Bw,Sl,TS,WE,zI,_n,ut,Nt,M,vr,Me,$t,Ct,im}from"./chunk-42hrvk6k.js";import{Ir}from"./chunk-bpxw19ez.js";import{Ul}from"./chunk-v034sfw8.js";import{nr}from"./chunk-qb178ntp.js";import{Pn,Nn,Dn,xr,It,xt}from"./chunk-t1yamxgk.js";import{fo}from"./chunk-fxg81vtx.js";import{Nr}from"./chunk-d2dgazjj.js";S();var F=(a)=>{if(!a)return"??";return a.split(" ").map((i)=>i[0]).slice(0,2).join("").toUpperCase()};function P(){let{projectId:a}=H.useParams(),{teamId:i,ensureTeamIdForProject:d}=ut(),N=V(),y=Re();m(()=>{d(a)},[a,d]);let{data:n}=nr(im(a)),c=n?.rootFolder,[w,k]=u(240),{shareConfigLeftSidebarCollapsed:p,setShareConfigLeftSidebarCollapsed:I}=$t(),{data:f,isLoading:T,fetchNextPage:b,hasNextPage:g,isFetchingNextPage:l}=mt({queryKey:["shares",a],queryFn:async({pageParam:e})=>{let r=await A.api.projects[":projectId"].shares.$get({param:{projectId:a},query:{first:"20",after:e}});if(!r.ok)throw Error("Failed to fetch share links");return await r.json()},initialPageParam:"",getNextPageParam:(e)=>e.pageInfo?.cursor||void 0,enabled:!!a}),{ref:j,inView:x}=Nt();m(()=>{if(x&&g&&!l)b()},[x,g,l,b]);let h=D(()=>f?.pages.flatMap((e)=>e.data)||[],[f]),{mutate:_}=B({mutationFn:async({id:e,isDisabled:r})=>{let s=await A.api.shares[":shareId"].$put({param:{shareId:e},json:{isDisabled:r}});if(!s.ok)throw Error("Failed to update share link");return await s.json()},onSuccess:()=>{N.invalidateQueries({queryKey:["shares",a]}),M.success(zI())},onError:(e)=>{M.error(Hs({message:e.message}))}});if(!i||!c||!n)return t(Ct,{});let v=async(e)=>{let r=`${window.location.origin}/share/${e}`;if(await fo(r))M.success(Bw())};return t("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:o("div",{className:"flex flex-1 overflow-hidden relative",children:[!p&&t("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>I(!0)}),!p&&o(L,{children:[t("div",{className:"bg-background",style:{width:w},children:t(vr,{teamId:i,projectId:a,projectName:n.name??"",rootFolderId:c})}),t(Ir,{onResize:(e)=>{k((r)=>Math.max(180,Math.min(400,r+e)))},className:"hidden md:block"})]}),o("div",{className:"flex-1 flex flex-col min-h-0 bg-card overflow-hidden",children:[t("header",{className:"h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10",children:o("div",{className:"flex items-center gap-2",children:[t(Pa,{className:"h-5 w-5 text-primary"}),t("h1",{className:"font-bold text-lg text-foreground",children:X0()})]})}),t("div",{className:"flex-1 overflow-y-auto p-6",children:T?t("div",{className:"flex justify-center items-center h-64",children:t("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):h.length===0?o("div",{className:"flex flex-col items-center justify-center h-64 text-muted-foreground gap-3",children:[t(js,{className:"h-10 w-10 text-muted-foreground/50"}),t("p",{children:TS()})]}):o("div",{className:"border border-border rounded-xl bg-background overflow-hidden shadow-xs",children:[o(Pn,{children:[t(Nn,{children:o(xr,{className:"hover:bg-transparent bg-muted/20",children:[t(It,{className:"font-semibold px-4 py-3",children:Sl()}),t(It,{className:"font-semibold px-4 py-3",children:WE()}),t(It,{className:"font-semibold px-4 py-3",children:zc()}),t(It,{className:"font-semibold px-4 py-3 w-[150px]",children:Lf()}),t(It,{className:"font-semibold px-4 py-3 text-right w-[120px]",children:VA()})]})}),t(Dn,{children:h.map((e)=>{let r=`${window.location.origin}/share/${e.id}`;return o(xr,{className:"hover:bg-muted/10 transition-colors",children:[t(xt,{className:"font-medium px-4 py-3.5",children:t("span",{className:"cursor-pointer hover:underline text-foreground",onClick:()=>y({to:"/projects/$projectId/shares/$shareId",params:{projectId:a,shareId:e.id}}),children:e.name})}),t(xt,{className:"px-4 py-3.5 max-w-[300px]",children:o("div",{className:"flex items-center gap-2 group",children:[t("span",{className:"truncate text-xs font-mono bg-muted/50 text-muted-foreground px-2 py-1 rounded-md border border-border cursor-pointer hover:bg-muted transition-colors flex-1",onClick:()=>v(e.id),title:V_(),children:r}),t(C,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>v(e.id),children:t(Nr,{className:"h-3.5 w-3.5"})}),t("a",{href:r,target:"_blank",rel:"noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center",children:t(Ul,{className:"h-3.5 w-3.5"})})]})}),t(xt,{className:"px-4 py-3.5",children:o("div",{className:"flex items-center gap-2",children:[o(Ce,{className:"h-6 w-6",children:[e.creator?.image&&t(Ie,{src:e.creator.image,alt:e.creator.name,className:"object-cover"}),t(Te,{className:"text-[10px]",children:F(e.creator?.name)})]}),t("span",{className:"text-sm font-medium text-foreground truncate max-w-[150px]",children:e.creator?.name||_n()})]})}),t(xt,{className:"px-4 py-3.5 text-muted-foreground text-sm",children:o("div",{className:"flex items-center gap-2",children:[t(jn,{className:"h-3.5 w-3.5 text-muted-foreground/70"}),t("span",{children:new Date(e.createdAt).toLocaleDateString()})]})}),t(xt,{className:"px-4 py-3.5 text-right",children:t("div",{className:"flex justify-end",children:t(Me,{checked:!e.isDisabled,onCheckedChange:(s)=>_({id:e.id,isDisabled:!s})})})})]},e.id)})})]}),t("div",{ref:j,className:"h-10 w-full flex items-center justify-center",children:l&&t(O,{className:"h-6 w-6 animate-spin text-primary"})})]})})]})]})})}var H=ze("/projects/$projectId/shares/")({component:P});export{H as Route};
1
+ import{m,D,u,S,L,t,o,G,B,mt,ke,Ue,A,O,jn,qs,Pa,C,Ce,Ie,Te,GA,e_,Q_,Zf,qc,$s,Uw,Il,TS,WE,zI,An,ut,Nt,M,vr,Me,$t,Ct,cm}from"./chunk-vvr8tnse.js";import{Ir}from"./chunk-4yhvexzk.js";import{ql}from"./chunk-3020am4q.js";import{tr}from"./chunk-ra5csbkr.js";import{Pn,Nn,Dn,xr,It,xt}from"./chunk-ggwqxn95.js";import{fo}from"./chunk-fxg81vtx.js";import{Nr}from"./chunk-8s9fehda.js";S();var F=(a)=>{if(!a)return"??";return a.split(" ").map((i)=>i[0]).slice(0,2).join("").toUpperCase()};function P(){let{projectId:a}=H.useParams(),{teamId:i,ensureTeamIdForProject:d}=ut(),N=G(),y=ke();m(()=>{d(a)},[a,d]);let{data:n}=tr(cm(a)),c=n?.rootFolder,[w,k]=u(240),{shareConfigLeftSidebarCollapsed:p,setShareConfigLeftSidebarCollapsed:I}=$t(),{data:f,isLoading:T,fetchNextPage:b,hasNextPage:g,isFetchingNextPage:l}=mt({queryKey:["shares",a],queryFn:async({pageParam:e})=>{let r=await A.api.projects[":projectId"].shares.$get({param:{projectId:a},query:{first:"20",after:e}});if(!r.ok)throw Error("Failed to fetch share links");return await r.json()},initialPageParam:"",getNextPageParam:(e)=>e.pageInfo?.cursor||void 0,enabled:!!a}),{ref:j,inView:x}=Nt();m(()=>{if(x&&g&&!l)b()},[x,g,l,b]);let h=D(()=>f?.pages.flatMap((e)=>e.data)||[],[f]),{mutate:_}=B({mutationFn:async({id:e,isDisabled:r})=>{let s=await A.api.shares[":shareId"].$put({param:{shareId:e},json:{isDisabled:r}});if(!s.ok)throw Error("Failed to update share link");return await s.json()},onSuccess:()=>{N.invalidateQueries({queryKey:["shares",a]}),M.success(zI())},onError:(e)=>{M.error($s({message:e.message}))}});if(!i||!c||!n)return t(Ct,{});let v=async(e)=>{let r=`${window.location.origin}/share/${e}`;if(await fo(r))M.success(Uw())};return t("div",{className:"flex flex-1 flex-col bg-background min-h-0",children:o("div",{className:"flex flex-1 overflow-hidden relative",children:[!p&&t("div",{className:"md:hidden fixed inset-0 bg-black/50 z-40",onClick:()=>I(!0)}),!p&&o(L,{children:[t("div",{className:"bg-background",style:{width:w},children:t(vr,{teamId:i,projectId:a,projectName:n.name??"",rootFolderId:c})}),t(Ir,{onResize:(e)=>{k((r)=>Math.max(180,Math.min(400,r+e)))},className:"hidden md:block"})]}),o("div",{className:"flex-1 flex flex-col min-h-0 bg-card overflow-hidden",children:[t("header",{className:"h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10",children:o("div",{className:"flex items-center gap-2",children:[t(Pa,{className:"h-5 w-5 text-primary"}),t("h1",{className:"font-bold text-lg text-foreground",children:e_()})]})}),t("div",{className:"flex-1 overflow-y-auto p-6",children:T?t("div",{className:"flex justify-center items-center h-64",children:t("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):h.length===0?o("div",{className:"flex flex-col items-center justify-center h-64 text-muted-foreground gap-3",children:[t(qs,{className:"h-10 w-10 text-muted-foreground/50"}),t("p",{children:TS()})]}):o("div",{className:"border border-border rounded-xl bg-background overflow-hidden shadow-xs",children:[o(Pn,{children:[t(Nn,{children:o(xr,{className:"hover:bg-transparent bg-muted/20",children:[t(It,{className:"font-semibold px-4 py-3",children:Il()}),t(It,{className:"font-semibold px-4 py-3",children:WE()}),t(It,{className:"font-semibold px-4 py-3",children:qc()}),t(It,{className:"font-semibold px-4 py-3 w-[150px]",children:Zf()}),t(It,{className:"font-semibold px-4 py-3 text-right w-[120px]",children:GA()})]})}),t(Dn,{children:h.map((e)=>{let r=`${window.location.origin}/share/${e.id}`;return o(xr,{className:"hover:bg-muted/10 transition-colors",children:[t(xt,{className:"font-medium px-4 py-3.5",children:t("span",{className:"cursor-pointer hover:underline text-foreground",onClick:()=>y({to:"/projects/$projectId/shares/$shareId",params:{projectId:a,shareId:e.id}}),children:e.name})}),t(xt,{className:"px-4 py-3.5 max-w-[300px]",children:o("div",{className:"flex items-center gap-2 group",children:[t("span",{className:"truncate text-xs font-mono bg-muted/50 text-muted-foreground px-2 py-1 rounded-md border border-border cursor-pointer hover:bg-muted transition-colors flex-1",onClick:()=>v(e.id),title:Q_(),children:r}),t(C,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>v(e.id),children:t(Nr,{className:"h-3.5 w-3.5"})}),t("a",{href:r,target:"_blank",rel:"noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center",children:t(ql,{className:"h-3.5 w-3.5"})})]})}),t(xt,{className:"px-4 py-3.5",children:o("div",{className:"flex items-center gap-2",children:[o(Ce,{className:"h-6 w-6",children:[e.creator?.image&&t(Ie,{src:e.creator.image,alt:e.creator.name,className:"object-cover"}),t(Te,{className:"text-[10px]",children:F(e.creator?.name)})]}),t("span",{className:"text-sm font-medium text-foreground truncate max-w-[150px]",children:e.creator?.name||An()})]})}),t(xt,{className:"px-4 py-3.5 text-muted-foreground text-sm",children:o("div",{className:"flex items-center gap-2",children:[t(jn,{className:"h-3.5 w-3.5 text-muted-foreground/70"}),t("span",{children:new Date(e.createdAt).toLocaleDateString()})]})}),t(xt,{className:"px-4 py-3.5 text-right",children:t("div",{className:"flex justify-end",children:t(Me,{checked:!e.isDisabled,onCheckedChange:(s)=>_({id:e.id,isDisabled:!s})})})})]},e.id)})})]}),t("div",{ref:j,className:"h-10 w-full flex items-center justify-center",children:l&&t(O,{className:"h-6 w-6 animate-spin text-primary"})})]})})]})]})})}var H=Ue("/projects/$projectId/shares/")({component:P});export{H as Route};
@@ -1,2 +1,2 @@
1
- import{lt,F,P,pt,D,_,S,t,E,ps,gt,Y,Lt,se,$n,_i,_l,yl}from"./chunk-42hrvk6k.js";S();S();var z=Object.defineProperty,M=(s,e)=>z(s,"name",{value:e,configurable:!0}),k="Toggle",T=F(M(function(e,o){let{pressed:r,defaultPressed:n,onPressedChange:a,...g}=e,[l,i]=Lt({prop:r,onChange:a,defaultProp:n??!1,caller:k});return t(se.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":e.disabled?"":void 0,...g,ref:o,onClick:Y(e.onClick,()=>{if(!e.disabled)i(!l)})})},"Toggle"));S();var A=Object.defineProperty,p=(s,e)=>A(s,"name",{value:e,configurable:!0}),m="ToggleGroup",[R,ie]=gt(m,[_i]),h=_i(),N=F(p(function(e,o){let{type:r,...n}=e;if(r==="single")return t(O,{role:"radiogroup",...n,ref:o});if(r==="multiple")return t(j,{role:"toolbar",...n,ref:o});throw Error(`Missing prop \`type\` expected on \`${m}\``)},"ToggleGroup")),[C,x]=R(m),O=F(p(function(e,o){let{value:r,defaultValue:n,onValueChange:a=p(()=>{},"onValueChange"),...g}=e,[l,i]=Lt({prop:r,defaultProp:n??"",onChange:a,caller:m});return t(C,{scope:e.__scopeToggleGroup,type:"single",value:D(()=>l?[l]:[],[l]),onItemActivate:i,onItemDeactivate:P(()=>i(""),[i]),children:t(I,{...g,ref:o})})},"ToggleGroupImplSingle")),j=F(p(function(e,o){let{value:r,defaultValue:n,onValueChange:a=p(()=>{},"onValueChange"),...g}=e,[l,i]=Lt({prop:r,defaultProp:n??[],onChange:a,caller:m}),u=P((c)=>i((d=[])=>[...d,c]),[i]),f=P((c)=>i((d=[])=>d.filter((w)=>w!==c)),[i]);return t(C,{scope:e.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:f,children:t(I,{...g,ref:o})})},"ToggleGroupImplMultiple")),[B,H]=R(m),I=F(p(function(e,o){let{__scopeToggleGroup:r,disabled:n=!1,rovingFocus:a=!0,orientation:g,dir:l,loop:i=!0,...u}=e,f=h(r),c=$n(l),d={dir:c,...u};return t(B,{scope:r,rovingFocus:a,disabled:n,children:a?t(_l,{asChild:!0,...f,orientation:g,dir:c,loop:i,children:t(se.div,{...d,ref:o})}):t(se.div,{...d,ref:o})})},"ToggleGroupImpl")),v="ToggleGroupItem",L=F(p(function(e,o){let r=x(v,e.__scopeToggleGroup),n=H(v,e.__scopeToggleGroup),a=h(e.__scopeToggleGroup),g=r.value.includes(e.value),l=n.disabled||e.disabled,i={...e,pressed:g,disabled:l},u=_(null);return n.rovingFocus?t(yl,{asChild:!0,...a,focusable:!l,active:g,ref:u,children:t(b,{...i,ref:o})}):t(b,{...i,ref:o})},"ToggleGroupItem")),b=F(p(function(e,o){let{__scopeToggleGroup:r,value:n,...a}=e,g=x(v,r),l={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},i=g.type==="single"?l:void 0;return t(T,{...i,...a,ref:o,onPressedChange:(u)=>{if(u)g.onItemActivate(n);else g.onItemDeactivate(n)}})},"ToggleGroupItemImpl"));var V=ps("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 min-w-9 px-2",sm:"h-8 min-w-8 px-1.5",lg:"h-10 min-w-10 px-2.5"}},defaultVariants:{variant:"default",size:"default"}});var y=lt({size:"default",variant:"default",spacing:0});function Ro({className:s,variant:e,size:o,spacing:r=0,children:n,...a}){return t(N,{"data-slot":"toggle-group","data-variant":e,"data-size":o,"data-spacing":r,style:{"--gap":r},className:E("group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",s),...a,children:t(y.Provider,{value:{variant:e,size:o,spacing:r},children:n})})}function yr({className:s,children:e,variant:o,size:r,...n}){let a=pt(y);return t(L,{"data-slot":"toggle-group-item","data-variant":a.variant||o,"data-size":a.size||r,"data-spacing":a.spacing,className:E(V({variant:a.variant||o,size:a.size||r}),"w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10","data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l",s),...n,children:e})}
1
+ import{lt,F,P,pt,D,_,S,t,E,ps,gt,Y,Lt,se,$n,yi,vl,wl}from"./chunk-vvr8tnse.js";S();S();var z=Object.defineProperty,M=(s,e)=>z(s,"name",{value:e,configurable:!0}),k="Toggle",T=F(M(function(e,o){let{pressed:r,defaultPressed:n,onPressedChange:a,...g}=e,[l,i]=Lt({prop:r,onChange:a,defaultProp:n??!1,caller:k});return t(se.button,{type:"button","aria-pressed":l,"data-state":l?"on":"off","data-disabled":e.disabled?"":void 0,...g,ref:o,onClick:Y(e.onClick,()=>{if(!e.disabled)i(!l)})})},"Toggle"));S();var A=Object.defineProperty,p=(s,e)=>A(s,"name",{value:e,configurable:!0}),m="ToggleGroup",[R,ie]=gt(m,[yi]),h=yi(),N=F(p(function(e,o){let{type:r,...n}=e;if(r==="single")return t(O,{role:"radiogroup",...n,ref:o});if(r==="multiple")return t(j,{role:"toolbar",...n,ref:o});throw Error(`Missing prop \`type\` expected on \`${m}\``)},"ToggleGroup")),[C,x]=R(m),O=F(p(function(e,o){let{value:r,defaultValue:n,onValueChange:a=p(()=>{},"onValueChange"),...g}=e,[l,i]=Lt({prop:r,defaultProp:n??"",onChange:a,caller:m});return t(C,{scope:e.__scopeToggleGroup,type:"single",value:D(()=>l?[l]:[],[l]),onItemActivate:i,onItemDeactivate:P(()=>i(""),[i]),children:t(I,{...g,ref:o})})},"ToggleGroupImplSingle")),j=F(p(function(e,o){let{value:r,defaultValue:n,onValueChange:a=p(()=>{},"onValueChange"),...g}=e,[l,i]=Lt({prop:r,defaultProp:n??[],onChange:a,caller:m}),u=P((c)=>i((d=[])=>[...d,c]),[i]),f=P((c)=>i((d=[])=>d.filter((w)=>w!==c)),[i]);return t(C,{scope:e.__scopeToggleGroup,type:"multiple",value:l,onItemActivate:u,onItemDeactivate:f,children:t(I,{...g,ref:o})})},"ToggleGroupImplMultiple")),[B,H]=R(m),I=F(p(function(e,o){let{__scopeToggleGroup:r,disabled:n=!1,rovingFocus:a=!0,orientation:g,dir:l,loop:i=!0,...u}=e,f=h(r),c=$n(l),d={dir:c,...u};return t(B,{scope:r,rovingFocus:a,disabled:n,children:a?t(vl,{asChild:!0,...f,orientation:g,dir:c,loop:i,children:t(se.div,{...d,ref:o})}):t(se.div,{...d,ref:o})})},"ToggleGroupImpl")),v="ToggleGroupItem",L=F(p(function(e,o){let r=x(v,e.__scopeToggleGroup),n=H(v,e.__scopeToggleGroup),a=h(e.__scopeToggleGroup),g=r.value.includes(e.value),l=n.disabled||e.disabled,i={...e,pressed:g,disabled:l},u=_(null);return n.rovingFocus?t(wl,{asChild:!0,...a,focusable:!l,active:g,ref:u,children:t(b,{...i,ref:o})}):t(b,{...i,ref:o})},"ToggleGroupItem")),b=F(p(function(e,o){let{__scopeToggleGroup:r,value:n,...a}=e,g=x(v,r),l={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},i=g.type==="single"?l:void 0;return t(T,{...i,...a,ref:o,onPressedChange:(u)=>{if(u)g.onItemActivate(n);else g.onItemDeactivate(n)}})},"ToggleGroupItemImpl"));var V=ps("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 min-w-9 px-2",sm:"h-8 min-w-8 px-1.5",lg:"h-10 min-w-10 px-2.5"}},defaultVariants:{variant:"default",size:"default"}});var y=lt({size:"default",variant:"default",spacing:0});function Ro({className:s,variant:e,size:o,spacing:r=0,children:n,...a}){return t(N,{"data-slot":"toggle-group","data-variant":e,"data-size":o,"data-spacing":r,style:{"--gap":r},className:E("group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs",s),...a,children:t(y.Provider,{value:{variant:e,size:o,spacing:r},children:n})})}function yr({className:s,children:e,variant:o,size:r,...n}){let a=pt(y);return t(L,{"data-slot":"toggle-group-item","data-variant":a.variant||o,"data-size":a.size||r,"data-spacing":a.spacing,className:E(V({variant:a.variant||o,size:a.size||r}),"w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10","data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l",s),...n,children:e})}
2
2
  export{Ro,yr};
@@ -0,0 +1 @@
1
+ import{m,S,t,Z,Ue,A,ut,Ct,lm}from"./chunk-vvr8tnse.js";import"./chunk-bf5m8f6t.js";import"./chunk-rx9g95wk.js";import"./chunk-113baw0m.js";import"./chunk-4yhvexzk.js";import{$a}from"./chunk-9rcg8zgs.js";import"./chunk-j4p3eqtd.js";import"./chunk-6zerk0em.js";import{tr}from"./chunk-ra5csbkr.js";import"./chunk-3tg10kwz.js";import"./chunk-x4q082e6.js";import"./chunk-fg9sr6r9.js";import"./chunk-emgyjhmx.js";S();function l(){let{projectId:e}=p.useParams(),{teamId:r,ensureTeamIdForProject:i}=ut();m(()=>{i(e)},[e,i]);let{data:a}=tr(lm(e)),o=a?.rootFolder,{data:d}=Z({queryKey:["folders",o],queryFn:async()=>{let n=await A.api.folders[":folderId"].$get({param:{folderId:o}});if(!n.ok)throw Error("failed to fetch folder");return await n.json()},enabled:!!o});if(!r||!o||!d)return t(Ct,{});return t($a,{teamId:r,projectId:e,projectName:a.name??"",assetId:o,rootFolderId:o,isRoot:!0})}var p=Ue("/projects/$projectId/agentsmd")({component:l});export{p as Route};
@@ -1,2 +1,2 @@
1
- import{I}from"./chunk-42hrvk6k.js";var c=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Mo=I("wrench",c);
1
+ import{I}from"./chunk-vvr8tnse.js";var c=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Mo=I("wrench",c);
2
2
  export{Mo};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- function He(e){return e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"")}function dc(e,n,t){let r=n[t];if(typeof r!=="string")throw Error(`Grammar tool call "${e}" requires argument "${t}" to be a string.`);return r}function fc(e,n,t,r){if(e.closed){if(r&&t===e.input)return;throw Error(`grammar tool input for property "${n}" changed after it was closed`)}if(!t.startsWith(e.input))throw Error(`grammar tool input for property "${n}" changed non-monotonically`);let o=t.slice(e.input.length);if(!r&&o.length===0)return;let i="";if(!e.started)i+=`{${JSON.stringify(n)}:"`,e.started=!0;if(i+=JSON.stringify(o).slice(1,-1),e.input=t,r)i+='"}',e.closed=!0;return i}function C(e){let n=e.parameters;if(n.type!=="object")throw Error("grammar constrained sampling requires an object parameter schema");if(!Array.isArray(n.required)||n.required.length!==1||typeof n.required[0]!=="string")throw Error("grammar constrained sampling requires exactly one required string property");let t=n.required[0];if(!n.properties?.[t])throw Error(`grammar constrained sampling requires a properties entry for ${t}`);if(n.properties[t]?.type!=="string")throw Error(`grammar constrained sampling property ${t} must have type string`);return t}function po(e,n){let t=e.constrainedSampling;if(!t||t.type!=="json_schema")return;if(n)return!0;if(t.strict==="require")throw Error(`Tool "${e.name}" requires JSON-schema constrained sampling, but strict tools are unsupported.`);return}function Xa(e,n){let t=e.constrainedSampling;if(!t||t.type!=="grammar")return;if(!n)return;let r=t.variants.openai_lark,o=t.variants.openai_regex,i=typeof r==="string"&&r.trim().length>0,d=typeof o==="string"&&o.trim().length>0;if(!i&&!d)throw Error(`Tool "${e.name}" cannot use grammar constrained sampling: no supported grammar variant was provided.`);try{return{format:i?"lark":"regex",definition:i?r:o,inputProperty:C(e)}}catch(l){let c=l instanceof Error?l.message:String(l);throw Error(`Tool "${e.name}" cannot use grammar constrained sampling: ${c}.`)}}function Wn(e,n){let t=new Map;for(let r of e??[]){let o=Xa(r,n);if(o)t.set(r.name,o.inputProperty)}return t}function R(e){return e.totalTokens||e.input+e.output+e.cacheRead+e.cacheWrite}function S(e){try{return JSON.stringify(e)??"undefined"}catch{return"[unserializable]"}}function N(e){if(typeof e==="string")return e.length;let n=0;for(let t of e)n+=t.type==="text"?t.text.length:4800;return n}function k(e){return Math.ceil(e.length/4)}function y(e){return Math.ceil(N(e)/4)}function I(e){let n=0;if(e.role==="user")return y(e.content);if(e.role==="toolResult")return y(e.content);for(let t of e.content)if(t.type==="text")n+=t.text.length;else if(t.type==="thinking")n+=t.thinking.length;else n+=t.name.length+S(t.arguments).length;return Math.ceil(n/4)}function O(e){let n=Number.NEGATIVE_INFINITY,t;for(let r=0;r<e.length;r++){let o=e[r];if(o.role==="assistant"){let i=o;if(i.timestamp>=n&&i.stopReason!=="aborted"&&i.stopReason!=="error"&&R(i.usage)>0)t={usage:i.usage,index:r}}n=Math.max(n,o.timestamp)}return t}function E(e){let n=O(e);if(n){let r=R(n.usage),o=0;for(let i=n.index+1;i<e.length;i++)o+=I(e[i]);return{tokens:r+o,usageTokens:r,trailingTokens:o,lastUsageIndex:n.index}}let t=0;for(let r of e)t+=I(r);return{tokens:t,usageTokens:0,trailingTokens:t,lastUsageIndex:null}}function M(e){if(!e||e.length===0)return 0;return k(S(e))}function D(e){return Array.isArray(e)}function w(e){if(D(e))return E(e);let n=E(e.messages);if(n.lastUsageIndex!==null){let r=new Set(e.messages.slice(n.lastUsageIndex+1).filter((i)=>i.role==="toolResult").flatMap((i)=>i.addedToolNames??[])),o=M(e.tools?.filter((i)=>r.has(i.name)));return{tokens:n.tokens+o,usageTokens:n.usageTokens,trailingTokens:n.trailingTokens+o,lastUsageIndex:n.lastUsageIndex}}let t=(e.systemPrompt?k(e.systemPrompt):0)+M(e.tools);return{tokens:n.tokens+t,usageTokens:n.usageTokens,trailingTokens:n.trailingTokens+t,lastUsageIndex:n.lastUsageIndex}}var P=4096,_=1;function uf(e,n,t){if(e.contextWindow<=0)return Math.max(_,t);let r=e.contextWindow-w(n).tokens-P;return Math.min(t,Math.max(_,r))}function Tr(e,n,t,r){return{temperature:t?.temperature,maxTokens:uf(e,n,t?.maxTokens??e.maxTokens),signal:t?.signal,apiKey:r||t?.apiKey,transport:t?.transport,cacheRetention:t?.cacheRetention,sessionId:t?.sessionId,headers:t?.headers,onPayload:t?.onPayload,onResponse:t?.onResponse,timeoutMs:t?.timeoutMs,websocketConnectTimeoutMs:t?.websocketConnectTimeoutMs,maxRetries:t?.maxRetries,maxRetryDelayMs:t?.maxRetryDelayMs,metadata:t?.metadata,env:t?.env}}function v(e){return e==="xhigh"||e==="max"?"high":e}function gm(e,n,t,r){let i={...{minimal:1024,low:2048,medium:8192,high:16384},...r},d=1024,l=v(t),c=i[l],f=e===void 0?n:Math.min(e+c,n);if(f<=c)c=Math.max(0,f-1024);return{maxTokens:f,thinkingBudget:c}}function A(e,n){let t=[],r=!1;for(let o of e){if(o.type==="image"){if(!r)t.push({type:"text",text:n});r=!0;continue}t.push(o),r=o.text===n}return t}function F(e,n){if(n.input.includes("image"))return e;return e.map((t)=>{if(t.role==="user"&&Array.isArray(t.content))return{...t,content:A(t.content,"(image omitted: model does not support images)")};if(t.role==="toolResult")return{...t,content:A(t.content,"(tool image omitted: model does not support images)")};return t})}function mo(e,n,t){let r=new Map,o=e.map((a)=>a.content==null?{...a,content:[]}:a),d=F(o,n).map((a)=>{if(a.role==="user")return a;if(a.role==="toolResult"){let s=r.get(a.toolCallId);if(s&&s!==a.toolCallId)return{...a,toolCallId:s};return a}if(a.role==="assistant"){let s=a,p=s.provider===n.provider&&s.api===n.api&&s.model===n.id,h=s.content.flatMap((u)=>{if(u.type==="thinking"){if(u.redacted)return p?u:[];if(p&&u.thinkingSignature)return u;if(!u.thinking||u.thinking.trim()==="")return[];if(p)return u;return{type:"text",text:u.thinking}}if(u.type==="text"){if(p)return u;return{type:"text",text:u.text}}if(u.type==="toolCall"){let m=u,g=m;if(!p&&m.thoughtSignature)g={...m},delete g.thoughtSignature;if(!p&&t){let x=t(m.id,n,s);if(x!==m.id)r.set(m.id,x),g={...g,id:x}}return g}return u});return{...s,content:h}}return a}),l=[],c=[],f=new Set,T=()=>{if(c.length>0){for(let a of c)if(!f.has(a.id))l.push({role:"toolResult",toolCallId:a.id,toolName:a.name,content:[{type:"text",text:"No result provided"}],isError:!0,timestamp:Date.now()});c=[],f=new Set}};for(let a=0;a<d.length;a++){let s=d[a];if(s.role==="assistant"){T();let p=s;if(p.stopReason==="error"||p.stopReason==="aborted")continue;let h=p.content.filter((u)=>u.type==="toolCall");if(h.length>0)c=h,f=new Set;l.push(s)}else if(s.role==="toolResult")f.add(s.toolCallId),l.push(s);else if(s.role==="user")T(),l.push(s);else l.push(s)}return T(),l}
3
- export{He,dc,fc,po,Xa,Wn,uf,Tr,gm,mo};
2
+ function He(e){return e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"")}function mc(e,n,t){let r=n[t];if(typeof r!=="string")throw Error(`Grammar tool call "${e}" requires argument "${t}" to be a string.`);return r}function hc(e,n,t,r){if(e.closed){if(r&&t===e.input)return;throw Error(`grammar tool input for property "${n}" changed after it was closed`)}if(!t.startsWith(e.input))throw Error(`grammar tool input for property "${n}" changed non-monotonically`);let o=t.slice(e.input.length);if(!r&&o.length===0)return;let i="";if(!e.started)i+=`{${JSON.stringify(n)}:"`,e.started=!0;if(i+=JSON.stringify(o).slice(1,-1),e.input=t,r)i+='"}',e.closed=!0;return i}function C(e){let n=e.parameters;if(n.type!=="object")throw Error("grammar constrained sampling requires an object parameter schema");if(!Array.isArray(n.required)||n.required.length!==1||typeof n.required[0]!=="string")throw Error("grammar constrained sampling requires exactly one required string property");let t=n.required[0];if(!n.properties?.[t])throw Error(`grammar constrained sampling requires a properties entry for ${t}`);if(n.properties[t]?.type!=="string")throw Error(`grammar constrained sampling property ${t} must have type string`);return t}function po(e,n){let t=e.constrainedSampling;if(!t||t.type!=="json_schema")return;if(n)return!0;if(t.strict==="require")throw Error(`Tool "${e.name}" requires JSON-schema constrained sampling, but strict tools are unsupported.`);return}function rl(e,n){let t=e.constrainedSampling;if(!t||t.type!=="grammar")return;if(!n)return;let r=t.variants.openai_lark,o=t.variants.openai_regex,i=typeof r==="string"&&r.trim().length>0,d=typeof o==="string"&&o.trim().length>0;if(!i&&!d)throw Error(`Tool "${e.name}" cannot use grammar constrained sampling: no supported grammar variant was provided.`);try{return{format:i?"lark":"regex",definition:i?r:o,inputProperty:C(e)}}catch(l){let c=l instanceof Error?l.message:String(l);throw Error(`Tool "${e.name}" cannot use grammar constrained sampling: ${c}.`)}}function Wn(e,n){let t=new Map;for(let r of e??[]){let o=rl(r,n);if(o)t.set(r.name,o.inputProperty)}return t}function R(e){return e.totalTokens||e.input+e.output+e.cacheRead+e.cacheWrite}function S(e){try{return JSON.stringify(e)??"undefined"}catch{return"[unserializable]"}}function N(e){if(typeof e==="string")return e.length;let n=0;for(let t of e)n+=t.type==="text"?t.text.length:4800;return n}function k(e){return Math.ceil(e.length/4)}function y(e){return Math.ceil(N(e)/4)}function I(e){let n=0;if(e.role==="user")return y(e.content);if(e.role==="toolResult")return y(e.content);for(let t of e.content)if(t.type==="text")n+=t.text.length;else if(t.type==="thinking")n+=t.thinking.length;else n+=t.name.length+S(t.arguments).length;return Math.ceil(n/4)}function O(e){let n=Number.NEGATIVE_INFINITY,t;for(let r=0;r<e.length;r++){let o=e[r];if(o.role==="assistant"){let i=o;if(i.timestamp>=n&&i.stopReason!=="aborted"&&i.stopReason!=="error"&&R(i.usage)>0)t={usage:i.usage,index:r}}n=Math.max(n,o.timestamp)}return t}function E(e){let n=O(e);if(n){let r=R(n.usage),o=0;for(let i=n.index+1;i<e.length;i++)o+=I(e[i]);return{tokens:r+o,usageTokens:r,trailingTokens:o,lastUsageIndex:n.index}}let t=0;for(let r of e)t+=I(r);return{tokens:t,usageTokens:0,trailingTokens:t,lastUsageIndex:null}}function M(e){if(!e||e.length===0)return 0;return k(S(e))}function D(e){return Array.isArray(e)}function w(e){if(D(e))return E(e);let n=E(e.messages);if(n.lastUsageIndex!==null){let r=new Set(e.messages.slice(n.lastUsageIndex+1).filter((i)=>i.role==="toolResult").flatMap((i)=>i.addedToolNames??[])),o=M(e.tools?.filter((i)=>r.has(i.name)));return{tokens:n.tokens+o,usageTokens:n.usageTokens,trailingTokens:n.trailingTokens+o,lastUsageIndex:n.lastUsageIndex}}let t=(e.systemPrompt?k(e.systemPrompt):0)+M(e.tools);return{tokens:n.tokens+t,usageTokens:n.usageTokens,trailingTokens:n.trailingTokens+t,lastUsageIndex:n.lastUsageIndex}}var P=4096,_=1;function df(e,n,t){if(e.contextWindow<=0)return Math.max(_,t);let r=e.contextWindow-w(n).tokens-P;return Math.min(t,Math.max(_,r))}function Tr(e,n,t,r){return{temperature:t?.temperature,maxTokens:df(e,n,t?.maxTokens??e.maxTokens),signal:t?.signal,apiKey:r||t?.apiKey,transport:t?.transport,cacheRetention:t?.cacheRetention,sessionId:t?.sessionId,headers:t?.headers,onPayload:t?.onPayload,onResponse:t?.onResponse,timeoutMs:t?.timeoutMs,websocketConnectTimeoutMs:t?.websocketConnectTimeoutMs,maxRetries:t?.maxRetries,maxRetryDelayMs:t?.maxRetryDelayMs,metadata:t?.metadata,env:t?.env}}function v(e){return e==="xhigh"||e==="max"?"high":e}function ym(e,n,t,r){let i={...{minimal:1024,low:2048,medium:8192,high:16384},...r},d=1024,l=v(t),c=i[l],f=e===void 0?n:Math.min(e+c,n);if(f<=c)c=Math.max(0,f-1024);return{maxTokens:f,thinkingBudget:c}}function A(e,n){let t=[],r=!1;for(let o of e){if(o.type==="image"){if(!r)t.push({type:"text",text:n});r=!0;continue}t.push(o),r=o.text===n}return t}function F(e,n){if(n.input.includes("image"))return e;return e.map((t)=>{if(t.role==="user"&&Array.isArray(t.content))return{...t,content:A(t.content,"(image omitted: model does not support images)")};if(t.role==="toolResult")return{...t,content:A(t.content,"(tool image omitted: model does not support images)")};return t})}function mo(e,n,t){let r=new Map,o=e.map((a)=>a.content==null?{...a,content:[]}:a),d=F(o,n).map((a)=>{if(a.role==="user")return a;if(a.role==="toolResult"){let s=r.get(a.toolCallId);if(s&&s!==a.toolCallId)return{...a,toolCallId:s};return a}if(a.role==="assistant"){let s=a,p=s.provider===n.provider&&s.api===n.api&&s.model===n.id,h=s.content.flatMap((u)=>{if(u.type==="thinking"){if(u.redacted)return p?u:[];if(p&&u.thinkingSignature)return u;if(!u.thinking||u.thinking.trim()==="")return[];if(p)return u;return{type:"text",text:u.thinking}}if(u.type==="text"){if(p)return u;return{type:"text",text:u.text}}if(u.type==="toolCall"){let m=u,g=m;if(!p&&m.thoughtSignature)g={...m},delete g.thoughtSignature;if(!p&&t){let x=t(m.id,n,s);if(x!==m.id)r.set(m.id,x),g={...g,id:x}}return g}return u});return{...s,content:h}}return a}),l=[],c=[],f=new Set,T=()=>{if(c.length>0){for(let a of c)if(!f.has(a.id))l.push({role:"toolResult",toolCallId:a.id,toolName:a.name,content:[{type:"text",text:"No result provided"}],isError:!0,timestamp:Date.now()});c=[],f=new Set}};for(let a=0;a<d.length;a++){let s=d[a];if(s.role==="assistant"){T();let p=s;if(p.stopReason==="error"||p.stopReason==="aborted")continue;let h=p.content.filter((u)=>u.type==="toolCall");if(h.length>0)c=h,f=new Set;l.push(s)}else if(s.role==="toolResult")f.add(s.toolCallId),l.push(s);else if(s.role==="user")T(),l.push(s);else l.push(s)}return T(),l}
3
+ export{He,mc,hc,po,rl,Wn,df,Tr,ym,mo};