@shumai-one/shumai 0.2.0 → 0.2.1

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 (156) hide show
  1. package/bin/{chunk-fcb14agg.js → chunk-044xt1se.js} +1 -1
  2. package/bin/chunk-0a5k9avd.js +4 -0
  3. package/bin/{chunk-xh2ntgmk.js → chunk-14fh4s1a.js} +2 -2
  4. package/bin/{chunk-y1xs4c5j.js → chunk-1ae8csk6.js} +1 -1
  5. package/bin/{chunk-yk3k5g5w.js → chunk-1w9dnk5p.js} +2 -2
  6. package/bin/chunk-211y81mp.js +1 -0
  7. package/bin/{chunk-twzgpwst.js → chunk-25d1g086.js} +2 -2
  8. package/bin/chunk-29pkpmvy.js +2 -0
  9. package/bin/{chunk-9rw65s3e.js → chunk-2djd6pq1.js} +2 -2
  10. package/bin/chunk-2dsmsa6a.js +3 -0
  11. package/bin/{chunk-08m8mzfa.js → chunk-2dz8nn9v.js} +1 -1
  12. package/bin/{chunk-mnv6pj0k.js → chunk-2xnys7v4.js} +2 -2
  13. package/bin/{chunk-a5kfa0k9.js → chunk-3rmc8nz6.js} +1 -1
  14. package/bin/{chunk-fwf8yne2.js → chunk-46c5xkmn.js} +2 -2
  15. package/bin/{chunk-axx5bh38.js → chunk-4fnak2zn.js} +2 -2
  16. package/bin/{chunk-gk7158n4.js → chunk-50ebjdkv.js} +2 -2
  17. package/bin/{chunk-29ectt6g.js → chunk-58aabg1f.js} +2 -2
  18. package/bin/{chunk-hb5v9ees.js → chunk-5j7axztv.js} +2 -2
  19. package/bin/chunk-5k03xpzq.js +6 -0
  20. package/bin/chunk-6724dtsx.js +2 -0
  21. package/bin/{chunk-q4f5vvtx.js → chunk-6h4ay2p8.js} +2 -2
  22. package/bin/chunk-6w5cn6p3.js +3 -0
  23. package/bin/{chunk-ps4h3387.js → chunk-75jka5v9.js} +2 -2
  24. package/bin/chunk-79n633wf.js +3 -0
  25. package/bin/chunk-7b17fb36.js +6 -0
  26. package/bin/{chunk-dypsm6m2.js → chunk-7h75r7ep.js} +1 -1
  27. package/bin/{chunk-pf8edn5x.js → chunk-7ktvhtp1.js} +2 -2
  28. package/bin/{chunk-6r9w7z15.js → chunk-7mnezagc.js} +2 -2
  29. package/bin/chunk-7we7ex0m.js +3 -0
  30. package/bin/{chunk-z42cyc20.js → chunk-82w2419d.js} +2 -2
  31. package/bin/chunk-861dz0bf.js +8 -0
  32. package/bin/chunk-891h8br6.js +3 -0
  33. package/bin/chunk-8abs8d48.js +12 -0
  34. package/bin/chunk-8qg47kj6.js +3 -0
  35. package/bin/{chunk-kbzm1pwx.js → chunk-976v5s8y.js} +1 -1
  36. package/bin/{chunk-8wv3kdz9.js → chunk-99db4j0k.js} +2 -2
  37. package/bin/{chunk-dgx2zxze.js → chunk-9bpjfkjf.js} +2 -2
  38. package/bin/chunk-9evm8x70.js +1 -0
  39. package/bin/{chunk-ec88pb09.js → chunk-9h3ds7rn.js} +2 -2
  40. package/bin/{chunk-ehfk24cf.js → chunk-9n783gva.js} +1 -1
  41. package/bin/chunk-a5s5ny4z.js +2 -0
  42. package/bin/{chunk-3rajscaz.js → chunk-ag35pxnb.js} +1 -1
  43. package/bin/{chunk-ajqsprm0.js → chunk-azfgjqjx.js} +2 -2
  44. package/bin/{chunk-s8d2045p.js → chunk-b9hb5jzt.js} +1 -1
  45. package/bin/chunk-bepnbw1g.js +2 -0
  46. package/bin/chunk-bg24g9kk.js +1 -0
  47. package/bin/{chunk-1fpqq6ed.js → chunk-c1v946wb.js} +2 -2
  48. package/bin/chunk-c45rh4hk.js +3 -0
  49. package/bin/{chunk-acxm86fh.js → chunk-cj5qwc9c.js} +1 -1
  50. package/bin/{chunk-j8q688sx.js → chunk-cpr05qng.js} +2 -2
  51. package/bin/chunk-d2vxmn9v.js +3 -0
  52. package/bin/chunk-dqtq9t8e.js +1 -0
  53. package/bin/{chunk-4kk5g619.js → chunk-dwf5e5g3.js} +2 -2
  54. package/bin/{chunk-w4y97tzy.js → chunk-dzm2f82x.js} +1 -1
  55. package/bin/chunk-e3c6hyz8.js +4 -0
  56. package/bin/chunk-fgnxtqtk.js +1 -0
  57. package/bin/chunk-fxvb6g2r.js +1 -0
  58. package/bin/{chunk-7ddaxdpf.js → chunk-ga0drqj7.js} +1 -1
  59. package/bin/{chunk-n5hfy93f.js → chunk-ga3mh3cd.js} +3 -3
  60. package/bin/chunk-gd5xwgp6.js +2 -0
  61. package/bin/chunk-hcz4snm7.js +8 -0
  62. package/bin/{chunk-dyybbn07.js → chunk-hmsb7ehr.js} +1 -1
  63. package/bin/{chunk-49ej1y67.js → chunk-hqptebzb.js} +2 -2
  64. package/bin/{chunk-mv79zk8q.js → chunk-hy50c4pw.js} +3 -3
  65. package/bin/chunk-jbde7evp.js +8 -0
  66. package/bin/{chunk-mjan6b09.js → chunk-jfjcxyhf.js} +3 -3
  67. package/bin/{chunk-hdk93ghf.js → chunk-jyjnt0s9.js} +2 -2
  68. package/bin/chunk-k1r17nfa.js +7 -0
  69. package/bin/{chunk-3qdn3pty.js → chunk-k5bekrrp.js} +1 -1
  70. package/bin/{chunk-3x62t1m0.js → chunk-kj751zje.js} +1 -1
  71. package/bin/chunk-kjkmh26f.js +1 -0
  72. package/bin/{chunk-m7jfszqt.js → chunk-m11g9hx7.js} +2 -2
  73. package/bin/{chunk-e5833tbd.js → chunk-m3dwydr3.js} +2 -2
  74. package/bin/{chunk-5a2maxwp.js → chunk-mg6fce5x.js} +2 -2
  75. package/bin/{chunk-xpqcvxej.js → chunk-mjncyjwf.js} +1 -1
  76. package/bin/{chunk-33ee1cvv.js → chunk-mk1jewvw.js} +2 -2
  77. package/bin/{chunk-gdm6y33a.js → chunk-mv8c5fky.js} +1 -1
  78. package/bin/chunk-mwh2n8yt.js +3 -0
  79. package/bin/{chunk-ysq64j13.js → chunk-n4meg9wb.js} +1 -1
  80. package/bin/{chunk-k5w64spz.js → chunk-nceqrqey.js} +2 -2
  81. package/bin/{chunk-wv4fe1fj.js → chunk-ngd23mtc.js} +2 -2
  82. package/bin/{chunk-m54p1cvp.js → chunk-p3emandj.js} +2 -2
  83. package/bin/{chunk-1wq9hjjr.js → chunk-phw4ne8b.js} +1 -1
  84. package/bin/{chunk-22dje1f5.js → chunk-pmx9760x.js} +1 -1
  85. package/bin/chunk-pv76qkym.js +2 -0
  86. package/bin/{chunk-d1ka11hc.js → chunk-pvy0gccg.js} +1 -1
  87. package/bin/chunk-pxw97qbq.js +3 -0
  88. package/bin/chunk-q09dfja5.js +3 -0
  89. package/bin/chunk-q72ax3m8.js +12 -0
  90. package/bin/{chunk-zsdwska1.js → chunk-q9sgjs4d.js} +1 -1
  91. package/bin/chunk-qag3w2dd.js +3 -0
  92. package/bin/{chunk-2cmg5sfn.js → chunk-qf7n519d.js} +2 -2
  93. package/bin/{chunk-3n1k9qt5.js → chunk-qj2kpkje.js} +1 -1
  94. package/bin/{chunk-cp18trqb.js → chunk-qjjr3fff.js} +2 -2
  95. package/bin/{chunk-fwe9g818.js → chunk-s1n39qte.js} +1 -1
  96. package/bin/chunk-s2725w64.js +1 -0
  97. package/bin/{chunk-09wp20mv.js → chunk-saq5797j.js} +1 -1
  98. package/bin/{chunk-d2y3rbjm.js → chunk-sp75qe28.js} +1 -1
  99. package/bin/{chunk-4hnrd4qh.js → chunk-sy8rqacm.js} +1 -1
  100. package/bin/{chunk-6mn3jqm9.js → chunk-t1mxqskx.js} +2 -2
  101. package/bin/chunk-t84t3v6q.js +1 -0
  102. package/bin/{chunk-eadb78m8.js → chunk-ta7bfdrn.js} +1 -1
  103. package/bin/{chunk-2s5a64nr.js → chunk-ttsqdsxr.js} +2 -2
  104. package/bin/chunk-v05d1aeq.js +2 -0
  105. package/bin/{chunk-yhj8c5re.js → chunk-v3j7acwn.js} +2 -2
  106. package/bin/{chunk-kpy0kpna.js → chunk-v98yavtp.js} +2 -2
  107. package/bin/chunk-vreq89j6.js +1 -0
  108. package/bin/{chunk-pqm0g14r.js → chunk-w1d5vmtc.js} +2 -2
  109. package/bin/chunk-w88219ex.js +3 -0
  110. package/bin/{chunk-vgvmt2m1.js → chunk-wbhsmhgp.js} +2 -2
  111. package/bin/{chunk-nwtb6dt1.js → chunk-wf4d1anc.js} +5 -5
  112. package/bin/{chunk-frm7vz6v.js → chunk-wfex9jw0.js} +2 -2
  113. package/bin/chunk-x9q2vzn8.js +7 -0
  114. package/bin/chunk-xv4mfppt.js +2 -0
  115. package/bin/{chunk-r3n9zpfw.js → chunk-y4s3xr4n.js} +2 -2
  116. package/bin/{chunk-9n0etqsy.js → chunk-ydagqpny.js} +1 -1
  117. package/bin/{chunk-aakzq0w1.js → chunk-ymyyap80.js} +1 -1
  118. package/bin/{chunk-5tmf3c0g.js → chunk-zn9jbc6t.js} +2 -2
  119. package/bin/{chunk-3rt9mnj3.js → chunk-ztmj61z9.js} +1 -1
  120. package/bin/shumai-app.html +1 -1
  121. package/bin/shumai-app.js +248 -247
  122. package/package.json +7 -7
  123. package/prisma/migrations/20260722022359_add_skill_permission/migration.sql +2 -0
  124. package/prisma/schema.prisma +1 -0
  125. package/bin/chunk-0at8vxt5.js +0 -3
  126. package/bin/chunk-0zv7f9ca.js +0 -2
  127. package/bin/chunk-2k4vp654.js +0 -2
  128. package/bin/chunk-2tbya52d.js +0 -2
  129. package/bin/chunk-2vs3evc7.js +0 -14
  130. package/bin/chunk-33169en9.js +0 -8
  131. package/bin/chunk-3m39v371.js +0 -1
  132. package/bin/chunk-6c4c7t0n.js +0 -1
  133. package/bin/chunk-6frqqxkv.js +0 -1
  134. package/bin/chunk-7rhjej0x.js +0 -3
  135. package/bin/chunk-7wvgtw25.js +0 -3
  136. package/bin/chunk-8s0ae37g.js +0 -1
  137. package/bin/chunk-94h8644q.js +0 -2
  138. package/bin/chunk-ac2ky3q0.js +0 -12
  139. package/bin/chunk-cthpdt54.js +0 -11
  140. package/bin/chunk-d0earxhc.js +0 -4
  141. package/bin/chunk-d0n8nxp3.js +0 -3
  142. package/bin/chunk-d22pyc5n.js +0 -1
  143. package/bin/chunk-dmgjse02.js +0 -4
  144. package/bin/chunk-g7wrxnmd.js +0 -1
  145. package/bin/chunk-jrvrg4fx.js +0 -1
  146. package/bin/chunk-k712q1zj.js +0 -2
  147. package/bin/chunk-kef0rnwn.js +0 -1
  148. package/bin/chunk-n296vcfw.js +0 -3
  149. package/bin/chunk-n6jgyv4y.js +0 -3
  150. package/bin/chunk-nar4s9v9.js +0 -3
  151. package/bin/chunk-nn8e9j7c.js +0 -1
  152. package/bin/chunk-qqesrgjk.js +0 -7
  153. package/bin/chunk-qz9xht6d.js +0 -2
  154. package/bin/chunk-symna5cj.js +0 -1
  155. package/bin/chunk-w4t9n9te.js +0 -6
  156. package/bin/chunk-z14hh99h.js +0 -2
@@ -0,0 +1,7 @@
1
+ // @bun
2
+ import{Sb as m,Tb as c}from"./chunk-7we7ex0m.js";import{Yb as s}from"./chunk-s1n39qte.js";import{Zb as d}from"./chunk-mwh2n8yt.js";import{ec as l,fc as a}from"./chunk-w88219ex.js";import{hc as i,jc as n}from"./chunk-2dsmsa6a.js";import{kc as w}from"./chunk-ta7bfdrn.js";import{lc as p}from"./chunk-pxw97qbq.js";import{Xe as T}from"./chunk-ngd23mtc.js";import{$e as g,af as r}from"./chunk-q09dfja5.js";import{bf as k}from"./chunk-d2vxmn9v.js";import{rk as h}from"./chunk-dzm2f82x.js";import"./chunk-v3j7acwn.js";import"./chunk-976v5s8y.js";function C(J,X){if(!J)return!1;let Q=X.toLowerCase();for(let[Y,_]of Object.entries(J))if(Y.toLowerCase()===Q&&_!==null&&_.trim().length>0)return!0;return!1}function t(J,X,Q){if(X)return X;if(C(Q,"authorization")||C(Q,"cf-aig-authorization"))return"unused";throw Error(`No API key for provider: ${J}`)}function $J(J){for(let X of J){if(X.role==="toolResult")return!0;if(X.role==="assistant"){if(X.content.some((Q)=>Q.type==="toolCall"))return!0}}return!1}function u(J){return J.type==="text"}function qJ(J){return J.type==="thinking"}function ZJ(J){return J.type==="toolCall"}function KJ(J){return J.type==="image"}function jJ(J){if(typeof J!=="object"||J===null)return!1;let X=J;return X.type==="reasoning.encrypted"&&typeof X.id==="string"&&X.id.length>0&&typeof X.data==="string"&&X.data.length>0}function e(J,X){if(J)return J;if(d("PI_CACHE_RETENTION",X)==="long")return"long";return"short"}var zJ=(J,X,Q)=>{let Y=new k;return(async()=>{let _={role:"assistant",content:[],api:J.api,provider:J.provider,model:J.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let H=t(J.provider,Q?.apiKey,Q?.headers),K=f(J),$=e(Q?.cacheRetention,Q?.env),q=$==="none"?void 0:Q?.sessionId,j=HJ(J,X,H,Q?.headers,q,K),V=LJ(J,X,Q,K,$),O=await Q?.onPayload?.(V,J);if(O!==void 0)V=O;let P={...Q?.signal?{signal:Q.signal}:{},...Q?.timeoutMs!==void 0?{timeout:Q.timeoutMs}:{},maxRetries:Q?.maxRetries??0},{data:A,response:F}=await j.chat.completions.create(V,P).withResponse();await Q?.onResponse?.({status:F.status,headers:p(F.headers)},J),Y.push({type:"start",partial:_});let E=null,L=null,G=!1,v=new Map,U=new Map,I=new Map,B=_.content,y=(Z)=>B.indexOf(Z),JJ=(Z)=>{let z=y(Z);if(z===-1)return;if(Z.type==="text")Y.push({type:"text_end",contentIndex:z,content:Z.text,partial:_});else if(Z.type==="thinking")Y.push({type:"thinking_end",contentIndex:z,content:Z.thinking,partial:_});else if(Z.type==="toolCall")Z.arguments=T(Z.partialArgs),delete Z.partialArgs,delete Z.streamIndex,Y.push({type:"toolcall_end",contentIndex:z,toolCall:Z,partial:_})},QJ=()=>{if(!E)E={type:"text",text:""},B.push(E),Y.push({type:"text_start",contentIndex:y(E),partial:_});return E},XJ=(Z)=>{if(!L)L={type:"thinking",thinking:"",thinkingSignature:Z},B.push(L),Y.push({type:"thinking_start",contentIndex:y(L),partial:_});return L},YJ=(Z)=>{if(!Z.id)return;let z=I.get(Z.id);if(z)Z.thoughtSignature=z,I.delete(Z.id)},_J=(Z)=>{let z=typeof Z.index==="number"?Z.index:void 0,N=z!==void 0?v.get(z):void 0;if(!N&&Z.id)N=U.get(Z.id);if(!N){if(N={type:"toolCall",id:Z.id||"",name:Z.function?.name||"",arguments:{},partialArgs:"",streamIndex:z},z!==void 0)v.set(z,N);if(Z.id)U.set(Z.id,N);B.push(N),Y.push({type:"toolcall_start",contentIndex:y(N),partial:_})}if(z!==void 0&&N.streamIndex===void 0)N.streamIndex=z,v.set(z,N);if(Z.id)U.set(Z.id,N);return YJ(N),N};for await(let Z of A){if(!Z||typeof Z!=="object")continue;if(_.responseId||=Z.id,typeof Z.model==="string"&&Z.model.length>0&&Z.model!==J.id)_.responseModel||=Z.model;if(Z.usage)_.usage=b(Z.usage,J);let z=Array.isArray(Z.choices)?Z.choices[0]:void 0;if(!z)continue;if(!Z.usage&&z.usage)_.usage=b(z.usage,J);if(z.finish_reason){let N=yJ(z.finish_reason);if(_.stopReason=N.stopReason,N.errorMessage)_.errorMessage=N.errorMessage;G=!0}if(z.delta){if(z.delta.content!==null&&z.delta.content!==void 0&&z.delta.content.length>0){let W=QJ();W.text+=z.delta.content,Y.push({type:"text_delta",contentIndex:y(W),delta:z.delta.content,partial:_})}let N=["reasoning_content","reasoning","reasoning_text"],R=z.delta,M=null;for(let W of N){let S=R[W];if(typeof S==="string"&&S.length>0){M=W;break}}if(M){let W=R[M];if(typeof W==="string"&&W.length>0){let S=J.provider==="opencode-go"&&M==="reasoning"?"reasoning_content":M,D=XJ(S);D.thinking+=W,Y.push({type:"thinking_delta",contentIndex:y(D),delta:W,partial:_})}}if(z?.delta?.tool_calls)for(let W of z.delta.tool_calls){let S=_J(W);if(!S.id&&W.id)S.id=W.id,U.set(W.id,S);if(!S.name&&W.function?.name)S.name=W.function.name;let D="";if(W.function?.arguments)D=W.function.arguments,S.partialArgs=(S.partialArgs??"")+W.function.arguments,S.arguments=T(S.partialArgs);Y.push({type:"toolcall_delta",contentIndex:y(S),delta:D,partial:_})}let x=z.delta.reasoning_details;if(Array.isArray(x)){for(let W of x)if(jJ(W)){let S=JSON.stringify(W),D=U.get(W.id);if(D)D.thoughtSignature=S;else I.set(W.id,S)}}}}for(let Z of B)JJ(Z);if(Q?.signal?.aborted)throw Error("Request was aborted");if(_.stopReason==="aborted")throw Error("Request was aborted");if(_.stopReason==="error")throw Error(_.errorMessage||"Provider returned an error stop reason");if(!G)throw Error("Stream ended without finish_reason");Y.push({type:"done",reason:_.stopReason,message:_}),Y.end()}catch(H){for(let $ of _.content)delete $.index,delete $.partialArgs,delete $.streamIndex;_.stopReason=Q?.signal?.aborted?"aborted":"error",_.errorMessage=a(l(H));let K=H?.error?.metadata?.raw;if(K&&!_.errorMessage.includes(String(K)))_.errorMessage+=`
3
+ ${K}`;Y.push({type:"error",reason:_.stopReason,error:_}),Y.end()}})(),Y},hJ=(J,X,Q)=>{t(J.provider,Q?.apiKey,Q?.headers);let Y=i(J,X,Q,Q?.apiKey),_=Q?.reasoning?r(J,Q.reasoning):void 0,H=_==="off"?void 0:_,K=Q?.toolChoice;return zJ(J,X,{...Y,reasoningEffort:H,toolChoice:K})};function HJ(J,X,Q,Y,_,H=f(J)){let K={...J.headers};if(J.provider==="github-copilot"){let $=m(X.messages),q=c({messages:X.messages,hasImages:$});Object.assign(K,q)}if(_&&H.sendSessionAffinityHeaders)if(H.sessionAffinityFormat==="openrouter")K["x-session-id"]=_;else{if(H.sessionAffinityFormat==="openai")K.session_id=_;K["x-client-request-id"]=_,K["x-session-affinity"]=_}if(Y)Object.assign(K,Y);return new h({apiKey:Q,baseURL:J.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:K})}function LJ(J,X,Q,Y=f(J),_=e(Q?.cacheRetention,Q?.env)){let H=EJ(J,X,Y),K=GJ(Y,_),$={model:J.id,messages:H,stream:!0,prompt_cache_key:J.baseUrl.includes("api.openai.com")&&_!=="none"||_==="long"&&Y.supportsLongCacheRetention?s(Q?.sessionId):void 0,prompt_cache_retention:_==="long"&&Y.supportsLongCacheRetention?"24h":void 0};if(Y.supportsUsageInStreaming!==!1)$.stream_options={include_usage:!0};if(Y.supportsStore)$.store=!1;if(Q?.maxTokens)if(Y.maxTokensField==="max_tokens")$.max_tokens=Q.maxTokens;else $.max_completion_tokens=Q.maxTokens;if(Q?.temperature!==void 0)$.temperature=Q.temperature;if(X.tools&&X.tools.length>0){if($.tools=DJ(X.tools,Y),Y.zaiToolStream)$.tool_stream=!0}else if($J(X.messages))$.tools=[];if(K)NJ(H,$.tools,K);if(Q?.toolChoice)$.tool_choice=Q.toolChoice;if(Y.thinkingFormat==="zai"&&J.reasoning){let q=$;if(q.thinking=Q?.reasoningEffort?{type:"enabled",clear_thinking:!1}:{type:"disabled"},Q?.reasoningEffort&&Y.supportsReasoningEffort){let j=J.thinkingLevelMap?.[Q.reasoningEffort],V=j===void 0?Q.reasoningEffort:j;if(typeof V==="string")q.reasoning_effort=V}}else if(Y.thinkingFormat==="qwen"&&J.reasoning)$.enable_thinking=!!Q?.reasoningEffort;else if(Y.thinkingFormat==="qwen-chat-template"&&J.reasoning)$.chat_template_kwargs={enable_thinking:!!Q?.reasoningEffort,preserve_thinking:!0};else if(Y.thinkingFormat==="chat-template"&&J.reasoning){let q=VJ(J,Q,Y);if(q)$.chat_template_kwargs=q}else if(Y.thinkingFormat==="deepseek"&&J.reasoning){if(Q?.reasoningEffort)$.thinking={type:"enabled"};else if(J.thinkingLevelMap?.off!==null)$.thinking={type:"disabled"};if(Q?.reasoningEffort&&Y.supportsReasoningEffort)$.reasoning_effort=J.thinkingLevelMap?.[Q.reasoningEffort]??Q.reasoningEffort}else if(Y.thinkingFormat==="openrouter"&&J.reasoning){let q=$;if(Q?.reasoningEffort)q.reasoning={effort:J.thinkingLevelMap?.[Q.reasoningEffort]??Q.reasoningEffort};else if(J.thinkingLevelMap?.off!==null)q.reasoning={effort:J.thinkingLevelMap?.off??"none"}}else if(Y.thinkingFormat==="ant-ling"&&J.reasoning&&Q?.reasoningEffort){let q=J.thinkingLevelMap?.[Q.reasoningEffort];if(typeof q==="string")$.reasoning={effort:q}}else if(Y.thinkingFormat==="together"&&J.reasoning){let q=$;if(q.reasoning={enabled:!!Q?.reasoningEffort},Q?.reasoningEffort&&Y.supportsReasoningEffort)q.reasoning_effort=J.thinkingLevelMap?.[Q.reasoningEffort]??Q.reasoningEffort}else if(Y.thinkingFormat==="string-thinking"&&J.reasoning){let q=$;if(Q?.reasoningEffort)q.thinking=J.thinkingLevelMap?.[Q.reasoningEffort]??Q.reasoningEffort;else if(J.thinkingLevelMap?.off!==null)q.thinking=J.thinkingLevelMap?.off??"none"}else if(Q?.reasoningEffort&&J.reasoning&&Y.supportsReasoningEffort)$.reasoning_effort=J.thinkingLevelMap?.[Q.reasoningEffort]??Q.reasoningEffort;else if(!Q?.reasoningEffort&&J.reasoning&&Y.supportsReasoningEffort){let q=J.thinkingLevelMap?.off;if(typeof q==="string")$.reasoning_effort=q}if(J.compat?.openRouterRouting)$.provider=J.compat.openRouterRouting;if(J.compat?.vercelGatewayRouting){let q=J.compat.vercelGatewayRouting;if(q.only||q.order){let j={};if(q.only)j.only=q.only;if(q.order)j.order=q.order;$.providerOptions={gateway:j}}}return $}function VJ(J,X,Q){let Y={};for(let[_,H]of Object.entries(Q.chatTemplateKwargs)){let K=WJ(J,X,H);if(K!==void 0)Y[_]=K}return Object.keys(Y).length>0?Y:void 0}function WJ(J,X,Q){if(typeof Q!=="object"||Q===null)return Q;let Y=X?.reasoningEffort;if(!Y&&Q.omitWhenOff)return;if(Q.$var==="thinking.enabled")return!!Y;let _=Y?J.thinkingLevelMap?.[Y]:J.thinkingLevelMap?.off;return _===void 0?Y:typeof _==="string"?_:void 0}function GJ(J,X){if(J.cacheControlFormat!=="anthropic"||X==="none")return;let Q=X==="long"&&J.supportsLongCacheRetention?"1h":void 0;return{type:"ephemeral",...Q?{ttl:Q}:{}}}function NJ(J,X,Q){SJ(J,Q),FJ(X,Q),OJ(J,Q)}function SJ(J,X){for(let Q of J)if(Q.role==="system"||Q.role==="developer"){PJ(Q,X);return}}function OJ(J,X){for(let Q=J.length-1;Q>=0;Q--){let Y=J[Q];if(Y.role==="user"||Y.role==="assistant"){if(AJ(Y,X))return}}}function FJ(J,X){if(!J||J.length===0)return;let Q=J[J.length-1];Q.cache_control=X}function PJ(J,X){return o(J,X)}function AJ(J,X){if(J.role==="user"||J.role==="assistant")return o(J,X);return!1}function o(J,X){let Q=J.content;if(typeof Q==="string"){if(Q.length===0)return!1;return J.content=[{type:"text",text:Q,cache_control:X}],!0}if(!Array.isArray(Q))return!1;for(let Y=Q.length-1;Y>=0;Y--){let _=Q[Y];if(_?.type==="text"){let H=_;return H.cache_control=X,!0}}return!1}function EJ(J,X,Q){let Y=[],_=($)=>{if($.includes("|")){let[q]=$.split("|");return q.replace(/[^a-zA-Z0-9_-]/g,"_").slice(0,40)}if(J.provider==="openai")return $.length>40?$.slice(0,40):$;return $},H=n(X.messages,J,($)=>_($));if(X.systemPrompt){let q=J.reasoning&&Q.supportsDeveloperRole?"developer":"system";Y.push({role:q,content:w(X.systemPrompt)})}let K=null;for(let $=0;$<H.length;$++){let q=H[$];if(Q.requiresAssistantAfterToolResult&&K==="toolResult"&&q.role==="user")Y.push({role:"assistant",content:"I have processed the tool results."});if(q.role==="user")if(typeof q.content==="string")Y.push({role:"user",content:w(q.content)});else{let j=q.content.map((V)=>{if(V.type==="text")return{type:"text",text:w(V.text)};else return{type:"image_url",image_url:{url:`data:${V.mimeType};base64,${V.data}`}}});if(j.length===0)continue;Y.push({role:"user",content:j})}else if(q.role==="assistant"){let j={role:"assistant",content:Q.requiresAssistantAfterToolResult?"":null},V=q.content.filter(u).filter((L)=>L.text.trim().length>0).map((L)=>({type:"text",text:w(L.text)})),O=V.map((L)=>L.text).join(""),P=q.content.filter(qJ).filter((L)=>L.thinking.trim().length>0);if(P.length>0)if(Q.requiresThinkingAsText){let L=P.map((G)=>w(G.thinking)).join(`
4
+
5
+ `);j.content=[{type:"text",text:L},...V]}else{if(O.length>0)j.content=O;let L=P[0].thinkingSignature;if(J.provider==="opencode-go"&&L==="reasoning")L="reasoning_content";if(L&&L.length>0)j[L]=P.map((G)=>G.thinking).join(`
6
+ `)}else if(O.length>0)j.content=O;let A=q.content.filter(ZJ);if(A.length>0){j.tool_calls=A.map((G)=>({id:G.id,type:"function",function:{name:G.name,arguments:JSON.stringify(G.arguments)}}));let L=A.filter((G)=>G.thoughtSignature).map((G)=>{try{return JSON.parse(G.thoughtSignature)}catch{return null}}).filter(Boolean);if(L.length>0)j.reasoning_details=L}if(Q.requiresReasoningContentOnAssistantMessages&&J.reasoning&&j.reasoning_content===void 0)j.reasoning_content="";let F=j.content;if(!(F!==null&&F!==void 0&&(typeof F==="string"?F.length>0:F.length>0))&&!j.tool_calls)continue;Y.push(j)}else if(q.role==="toolResult"){let j=[],V=$;for(;V<H.length&&H[V].role==="toolResult";V++){let O=H[V],P=O.content.filter(u).map((G)=>G.text).join(`
7
+ `),A=O.content.some((G)=>G.type==="image"),E=P.length>0?P:A?"(see attached image)":"(no tool output)",L={role:"tool",content:w(E),tool_call_id:O.toolCallId};if(Q.requiresToolResultName&&O.toolName)L.name=O.toolName;if(Y.push(L),A&&J.input.includes("image")){for(let G of O.content)if(KJ(G))j.push({type:"image_url",image_url:{url:`data:${G.mimeType};base64,${G.data}`}})}}if($=V-1,j.length>0){if(Q.requiresAssistantAfterToolResult)Y.push({role:"assistant",content:"I have processed the tool results."});Y.push({role:"user",content:[{type:"text",text:"Attached image(s) from tool result:"},...j]}),K="user"}else K="toolResult";continue}K=q.role}return Y}function DJ(J,X){return J.map((Q)=>({type:"function",function:{name:Q.name,description:Q.description,parameters:Q.parameters,...X.supportsStrictMode!==!1&&{strict:!1}}}))}function b(J,X){let Q=J.prompt_tokens||0,Y=J.prompt_tokens_details?.cached_tokens??J.prompt_cache_hit_tokens??0,_=J.prompt_tokens_details?.cache_write_tokens||0,H=Math.max(0,Q-Y-_),K=J.completion_tokens||0,$={input:H,output:K,cacheRead:Y,cacheWrite:_,reasoning:J.completion_tokens_details?.reasoning_tokens||0,totalTokens:H+K+Y+_,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}};return g(X,$),$}function yJ(J){if(J===null)return{stopReason:"stop"};switch(J){case"stop":case"end":return{stopReason:"stop"};case"length":return{stopReason:"length"};case"function_call":case"tool_calls":return{stopReason:"toolUse"};case"content_filter":return{stopReason:"error",errorMessage:"Provider finish_reason: content_filter"};case"network_error":return{stopReason:"error",errorMessage:"Provider finish_reason: network_error"};default:return{stopReason:"error",errorMessage:`Provider finish_reason: ${J}`}}}function wJ(J){let{provider:X,baseUrl:Q}=J,Y=X==="zai"||X==="zai-coding-cn"||Q.includes("api.z.ai")||Q.includes("open.bigmodel.cn"),_=X==="together"||Q.includes("api.together.ai")||Q.includes("api.together.xyz"),H=X==="moonshotai"||X==="moonshotai-cn"||Q.includes("api.moonshot."),K=X==="openrouter"||Q.includes("openrouter.ai"),$=X==="cloudflare-workers-ai"||Q.includes("api.cloudflare.com"),q=X==="cloudflare-ai-gateway"||Q.includes("gateway.ai.cloudflare.com"),j=X==="nvidia"||Q.includes("integrate.api.nvidia.com"),V=X==="ant-ling"||Q.includes("api.ant-ling.com"),O=j||X==="cerebras"||Q.includes("cerebras.ai")||X==="xai"||Q.includes("api.x.ai")||_||Q.includes("chutes.ai")||Q.includes("deepseek.com")||Y||H||X==="opencode"||Q.includes("opencode.ai")||$||q||V,P=Q.includes("chutes.ai")||H||q||_||j||V,A=X==="xai"||Q.includes("api.x.ai"),F=X==="deepseek"||Q.includes("deepseek.com"),E=K&&(J.id.startsWith("anthropic/")||J.id.startsWith("openai/")),L=X==="openrouter"&&J.id.startsWith("anthropic/")?"anthropic":void 0;return{supportsStore:!O,supportsDeveloperRole:E||!O&&!K,supportsReasoningEffort:!A&&!Y&&!H&&!_&&!q&&!j&&!V,supportsUsageInStreaming:!0,maxTokensField:P?"max_tokens":"max_completion_tokens",requiresToolResultName:!1,requiresAssistantAfterToolResult:!1,requiresThinkingAsText:!1,requiresReasoningContentOnAssistantMessages:F,thinkingFormat:F?"deepseek":Y?"zai":_?"together":V?"ant-ling":K?"openrouter":"openai",openRouterRouting:{},vercelGatewayRouting:{},chatTemplateKwargs:{},zaiToolStream:!1,supportsStrictMode:!H&&!_&&!q&&!j,cacheControlFormat:L,sendSessionAffinityHeaders:!1,sessionAffinityFormat:K?"openrouter":"openai",supportsLongCacheRetention:!(_||$||q||j||V)}}function f(J){let X=wJ(J);if(!J.compat)return X;return{supportsStore:J.compat.supportsStore??X.supportsStore,supportsDeveloperRole:J.compat.supportsDeveloperRole??X.supportsDeveloperRole,supportsReasoningEffort:J.compat.supportsReasoningEffort??X.supportsReasoningEffort,supportsUsageInStreaming:J.compat.supportsUsageInStreaming??X.supportsUsageInStreaming,maxTokensField:J.compat.maxTokensField??X.maxTokensField,requiresToolResultName:J.compat.requiresToolResultName??X.requiresToolResultName,requiresAssistantAfterToolResult:J.compat.requiresAssistantAfterToolResult??X.requiresAssistantAfterToolResult,requiresThinkingAsText:J.compat.requiresThinkingAsText??X.requiresThinkingAsText,requiresReasoningContentOnAssistantMessages:J.compat.requiresReasoningContentOnAssistantMessages??X.requiresReasoningContentOnAssistantMessages,thinkingFormat:J.compat.thinkingFormat??X.thinkingFormat,openRouterRouting:J.compat.openRouterRouting??{},vercelGatewayRouting:J.compat.vercelGatewayRouting??X.vercelGatewayRouting,chatTemplateKwargs:J.compat.chatTemplateKwargs??X.chatTemplateKwargs,zaiToolStream:J.compat.zaiToolStream??X.zaiToolStream,supportsStrictMode:J.compat.supportsStrictMode??X.supportsStrictMode,cacheControlFormat:J.compat.cacheControlFormat??X.cacheControlFormat,sendSessionAffinityHeaders:J.compat.sendSessionAffinityHeaders??X.sendSessionAffinityHeaders,sessionAffinityFormat:J.compat.sessionAffinityFormat??X.sessionAffinityFormat,supportsLongCacheRetention:J.compat.supportsLongCacheRetention??X.supportsLongCacheRetention}}export{hJ as streamSimple,zJ as stream,EJ as convertMessages};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Pb as a}from"./chunk-79n633wf.js";import"./chunk-976v5s8y.js";export default a();
@@ -1,2 +1,2 @@
1
- import{Eg as e,bg as r,hj as c,rg as n}from"./chunk-nwtb6dt1.js";var i=(o)=>({queryKey:["projects",o],queryFn:async()=>{let t=await e.api.projects[":projectId"].$get({param:{projectId:o}});if(!t.ok)throw Error("Failed to fetch project");return await t.json()}}),l=(o)=>({queryKey:["collections",o],queryFn:async()=>{let t=await e.api.collections[":collectionId"].$get({param:{collectionId:o}});if(!t.ok)throw Error("Failed to fetch collection");return await t.json()}}),u=n("/projects/$projectId/collections/$collectionId")({loader:({context:{queryClient:o},params:{projectId:t}})=>o.ensureQueryData(i(t)),pendingComponent:()=>r("div",{children:c.loading_collection()})});
2
- export{i as se,l as te,u as ue};
1
+ import{Tg as r,Zj as c,hh as n,uh as e}from"./chunk-wf4d1anc.js";var i=(o)=>({queryKey:["projects",o],queryFn:async()=>{let t=await e.api.projects[":projectId"].$get({param:{projectId:o}});if(!t.ok)throw Error("Failed to fetch project");return await t.json()}}),l=(o)=>({queryKey:["collections",o],queryFn:async()=>{let t=await e.api.collections[":collectionId"].$get({param:{collectionId:o}});if(!t.ok)throw Error("Failed to fetch collection");return await t.json()}}),u=n("/projects/$projectId/collections/$collectionId")({loader:({context:{queryClient:o},params:{projectId:t}})=>o.ensureQueryData(i(t)),pendingComponent:()=>r("div",{children:c.loading_collection()})});
2
+ export{i as cf,l as df,u as ef};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  function f(b){if(b===void 0)return;let d=Array.from(b);if(d.length<=64)return b;return d.slice(0,64).join("")}
3
- export{f as pb};
3
+ export{f as qk};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{rj as V,sj as k,tj as _,uj as E}from"./chunk-gdm6y33a.js";import{wj as b,xj as f,yj as A}from"./chunk-29ectt6g.js";import"./chunk-a5kfa0k9.js";import{Aj as L}from"./chunk-fwe9g818.js";import{Bj as N}from"./chunk-w4y97tzy.js";import"./chunk-1fpqq6ed.js";import"./chunk-yhj8c5re.js";import{Gj as B}from"./chunk-n296vcfw.js";import{Sj as M}from"./chunk-08m8mzfa.js";import{Wj as D,Xj as U}from"./chunk-3rajscaz.js";import"./chunk-eadb78m8.js";import"./chunk-kbzm1pwx.js";var y=new Set(["openai","openai-codex","opencode"]);function H(w){if(w)return w;if(typeof process<"u"&&process.env.PI_CACHE_RETENTION==="long")return"long";return"short"}function S(w){return{sendSessionIdHeader:w.compat?.sendSessionIdHeader??!0,supportsLongCacheRetention:w.compat?.supportsLongCacheRetention??!0}}function T(w,F){return F==="long"&&w.supportsLongCacheRetention?"24h":void 0}function C(w){if(w instanceof Error){let F=w.status,z=typeof F==="number"?F:void 0;if(z!==void 0)return`OpenAI API error (${z}): ${w.message}`;return w.message}try{return JSON.stringify(w)}catch{return String(w)}}var I=(w,F,z)=>{let G=new U;return(async()=>{let Q={role:"assistant",content:[],api:w.api,provider:w.provider,model:w.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let W=z?.apiKey;if(!W)throw Error(`No API key for provider: ${w.provider}`);let X=H(z?.cacheRetention)==="none"?void 0:z?.sessionId,Z=v(w,F,W,z?.headers,X),Y=x(w,F,z),$=await z?.onPayload?.(Y,w);if($!==void 0)Y=$;let j={...z?.signal?{signal:z.signal}:{},...z?.timeoutMs!==void 0?{timeout:z.timeoutMs}:{},maxRetries:z?.maxRetries??0},{data:K,response:q}=await Z.responses.create(Y,j).withResponse();if(await z?.onResponse?.({status:q.status,headers:B(q.headers)},w),G.push({type:"start",partial:Q}),await A(K,Q,G,w,{serviceTier:z?.serviceTier,applyServiceTierPricing:(P,O)=>h(P,O,w)}),z?.signal?.aborted)throw Error("Request was aborted");if(Q.stopReason==="aborted"||Q.stopReason==="error")throw Error("An unknown error occurred");G.push({type:"done",reason:Q.stopReason,message:Q}),G.end()}catch(W){for(let J of Q.content)delete J.index,delete J.partialJson;Q.stopReason=z?.signal?.aborted?"aborted":"error",Q.errorMessage=C(W),G.push({type:"error",reason:Q.stopReason,error:Q}),G.end()}})(),G},i=(w,F,z)=>{let G=z?.apiKey;if(!G)throw Error(`No API key for provider: ${w.provider}`);let Q=M(w,z,G),W=z?.reasoning?D(w,z.reasoning):void 0;return I(w,F,{...Q,reasoningEffort:W==="off"?void 0:W})};function v(w,F,z,G,Q){let W=S(w),J={...w.headers};if(w.provider==="github-copilot"){let Z=_(F.messages),Y=E({messages:F.messages,hasImages:Z});Object.assign(J,Y)}if(Q){if(W.sendSessionIdHeader)J.session_id=Q;J["x-client-request-id"]=Q}if(G)Object.assign(J,G);let X=w.provider==="cloudflare-ai-gateway"?{...J,Authorization:J.Authorization??null,"cf-aig-authorization":`Bearer ${z}`}:J;return new N({apiKey:z,baseURL:V(w.provider)?k(w):w.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:X})}function x(w,F,z){let G=b(w,F,y),Q=H(z?.cacheRetention),W=S(w),J={model:w.id,input:G,stream:!0,prompt_cache_key:Q==="none"?void 0:L(z?.sessionId),prompt_cache_retention:T(W,Q),store:!1};if(z?.maxTokens)J.max_output_tokens=z?.maxTokens;if(z?.temperature!==void 0)J.temperature=z?.temperature;if(z?.serviceTier!==void 0)J.service_tier=z.serviceTier;if(F.tools&&F.tools.length>0)J.tools=f(F.tools);if(w.reasoning){if(z?.reasoningEffort||z?.reasoningSummary){let X=z?.reasoningEffort?w.thinkingLevelMap?.[z.reasoningEffort]??z.reasoningEffort:"medium";J.reasoning={effort:X,summary:z?.reasoningSummary||"auto"},J.include=["reasoning.encrypted_content"]}else if(w.provider!=="github-copilot"&&w.thinkingLevelMap?.off!==null)J.reasoning={effort:w.thinkingLevelMap?.off??"none"}}return J}function R(w,F){switch(F){case"flex":return 0.5;case"priority":return w.id==="gpt-5.5"?2.5:2;default:return 1}}function h(w,F,z){let G=R(z,F);if(G===1)return;w.cost.input*=G,w.cost.output*=G,w.cost.cacheRead*=G,w.cost.cacheWrite*=G,w.cost.total=w.cost.input+w.cost.output+w.cost.cacheRead+w.cost.cacheWrite}export{i as streamSimpleOpenAIResponses,I as streamOpenAIResponses};
2
+ import{hk as V,ik as k,jk as _,kk as E}from"./chunk-mv8c5fky.js";import{mk as b,nk as f,ok as A}from"./chunk-58aabg1f.js";import"./chunk-7h75r7ep.js";import{qk as L}from"./chunk-ydagqpny.js";import{rk as N}from"./chunk-dzm2f82x.js";import"./chunk-c1v946wb.js";import"./chunk-v3j7acwn.js";import{wk as B}from"./chunk-ga0drqj7.js";import{Ik as M}from"./chunk-2dz8nn9v.js";import{Mk as D,Nk as U}from"./chunk-ag35pxnb.js";import"./chunk-pmx9760x.js";import"./chunk-976v5s8y.js";var y=new Set(["openai","openai-codex","opencode"]);function H(w){if(w)return w;if(typeof process<"u"&&process.env.PI_CACHE_RETENTION==="long")return"long";return"short"}function S(w){return{sendSessionIdHeader:w.compat?.sendSessionIdHeader??!0,supportsLongCacheRetention:w.compat?.supportsLongCacheRetention??!0}}function T(w,F){return F==="long"&&w.supportsLongCacheRetention?"24h":void 0}function C(w){if(w instanceof Error){let F=w.status,z=typeof F==="number"?F:void 0;if(z!==void 0)return`OpenAI API error (${z}): ${w.message}`;return w.message}try{return JSON.stringify(w)}catch{return String(w)}}var I=(w,F,z)=>{let G=new U;return(async()=>{let Q={role:"assistant",content:[],api:w.api,provider:w.provider,model:w.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:"stop",timestamp:Date.now()};try{let W=z?.apiKey;if(!W)throw Error(`No API key for provider: ${w.provider}`);let X=H(z?.cacheRetention)==="none"?void 0:z?.sessionId,Z=v(w,F,W,z?.headers,X),Y=x(w,F,z),$=await z?.onPayload?.(Y,w);if($!==void 0)Y=$;let j={...z?.signal?{signal:z.signal}:{},...z?.timeoutMs!==void 0?{timeout:z.timeoutMs}:{},maxRetries:z?.maxRetries??0},{data:K,response:q}=await Z.responses.create(Y,j).withResponse();if(await z?.onResponse?.({status:q.status,headers:B(q.headers)},w),G.push({type:"start",partial:Q}),await A(K,Q,G,w,{serviceTier:z?.serviceTier,applyServiceTierPricing:(P,O)=>h(P,O,w)}),z?.signal?.aborted)throw Error("Request was aborted");if(Q.stopReason==="aborted"||Q.stopReason==="error")throw Error("An unknown error occurred");G.push({type:"done",reason:Q.stopReason,message:Q}),G.end()}catch(W){for(let J of Q.content)delete J.index,delete J.partialJson;Q.stopReason=z?.signal?.aborted?"aborted":"error",Q.errorMessage=C(W),G.push({type:"error",reason:Q.stopReason,error:Q}),G.end()}})(),G},i=(w,F,z)=>{let G=z?.apiKey;if(!G)throw Error(`No API key for provider: ${w.provider}`);let Q=M(w,z,G),W=z?.reasoning?D(w,z.reasoning):void 0;return I(w,F,{...Q,reasoningEffort:W==="off"?void 0:W})};function v(w,F,z,G,Q){let W=S(w),J={...w.headers};if(w.provider==="github-copilot"){let Z=_(F.messages),Y=E({messages:F.messages,hasImages:Z});Object.assign(J,Y)}if(Q){if(W.sendSessionIdHeader)J.session_id=Q;J["x-client-request-id"]=Q}if(G)Object.assign(J,G);let X=w.provider==="cloudflare-ai-gateway"?{...J,Authorization:J.Authorization??null,"cf-aig-authorization":`Bearer ${z}`}:J;return new N({apiKey:z,baseURL:V(w.provider)?k(w):w.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:X})}function x(w,F,z){let G=b(w,F,y),Q=H(z?.cacheRetention),W=S(w),J={model:w.id,input:G,stream:!0,prompt_cache_key:Q==="none"?void 0:L(z?.sessionId),prompt_cache_retention:T(W,Q),store:!1};if(z?.maxTokens)J.max_output_tokens=z?.maxTokens;if(z?.temperature!==void 0)J.temperature=z?.temperature;if(z?.serviceTier!==void 0)J.service_tier=z.serviceTier;if(F.tools&&F.tools.length>0)J.tools=f(F.tools);if(w.reasoning){if(z?.reasoningEffort||z?.reasoningSummary){let X=z?.reasoningEffort?w.thinkingLevelMap?.[z.reasoningEffort]??z.reasoningEffort:"medium";J.reasoning={effort:X,summary:z?.reasoningSummary||"auto"},J.include=["reasoning.encrypted_content"]}else if(w.provider!=="github-copilot"&&w.thinkingLevelMap?.off!==null)J.reasoning={effort:w.thinkingLevelMap?.off??"none"}}return J}function R(w,F){switch(F){case"flex":return 0.5;case"priority":return w.id==="gpt-5.5"?2.5:2;default:return 1}}function h(w,F,z){let G=R(z,F);if(G===1)return;w.cost.input*=G,w.cost.output*=G,w.cost.cacheRead*=G,w.cost.cacheWrite*=G,w.cost.total=w.cost.input+w.cost.output+w.cost.cacheRead+w.cost.cacheWrite}export{i as streamSimpleOpenAIResponses,I as streamOpenAIResponses};
@@ -1,2 +1,2 @@
1
- import{Yf as f}from"./chunk-mnv6pj0k.js";import{bg as b,cg as q}from"./chunk-nwtb6dt1.js";function z(){return q("div",{className:"flex h-screen flex-col bg-background min-h-0",children:[q("div",{className:"flex h-14 items-center justify-between border-b px-6 shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-24"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-32"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-8 w-8 rounded-md"}),b(f,{className:"h-8 w-20 rounded-md"})]})]}),q("div",{className:"flex flex-1 overflow-hidden",children:[q("div",{className:"w-[240px] border-r p-4 space-y-4 hidden md:block shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-4 rounded"}),b(f,{className:"h-4 w-24"})]}),q("div",{className:"pl-4 space-y-3",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-28"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-20"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-24"})]})]})]}),q("div",{className:"flex-1 p-6 space-y-6 overflow-y-auto",children:[q("div",{className:"flex items-center justify-between border-b pb-4",children:[q("div",{className:"flex items-center gap-4",children:[b(f,{className:"h-5 w-40"}),b(f,{className:"h-4 w-20"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-8 w-8 rounded"}),b(f,{className:"h-8 w-8 rounded"}),b(f,{className:"h-8 w-32 rounded"})]})]}),q("div",{className:"space-y-4",children:[b("div",{className:"flex items-center gap-2",children:b(f,{className:"h-4 w-24"})}),b("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5",children:Array.from({length:10}).map((w,v)=>q("div",{className:"flex flex-col rounded-lg border bg-card p-3 space-y-3",children:[b(f,{className:"aspect-square w-full rounded-md"}),q("div",{className:"space-y-2",children:[b(f,{className:"h-4 w-3/4"}),q("div",{className:"flex justify-between items-center",children:[b(f,{className:"h-3 w-1/4"}),b(f,{className:"h-3 w-1/3"})]})]})]},v))})]})]})]})]})}function A(){return q("div",{className:"h-screen flex flex-col bg-background",children:[q("div",{className:"flex h-14 items-center justify-between border-b px-6 shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-16"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-28"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-32"})]}),b("div",{className:"flex items-center gap-2",children:b(f,{className:"h-8 w-20 rounded"})})]}),q("div",{className:"flex flex-1 overflow-hidden",children:[q("div",{className:"w-[280px] border-r p-4 flex flex-col gap-4 shrink-0 hidden md:flex",children:[b(f,{className:"h-5 w-24"}),b("div",{className:"space-y-3 flex-1 overflow-y-auto",children:Array.from({length:4}).map((w,v)=>q("div",{className:"flex gap-3 p-2 rounded border",children:[b(f,{className:"h-12 w-12 rounded bg-muted shrink-0"}),q("div",{className:"space-y-2 flex-1",children:[b(f,{className:"h-3 w-2/3"}),b(f,{className:"h-2 w-1/2"})]})]},v))})]}),q("div",{className:"flex-1 bg-muted/20 p-6 flex flex-col justify-between relative min-w-0",children:[b("div",{className:"flex-1 flex items-center justify-center",children:b(f,{className:"w-full max-w-4xl aspect-video rounded-lg shadow-lg"})}),q("div",{className:"mt-4 flex items-center justify-between shrink-0",children:[q("div",{className:"flex items-center gap-4",children:[b(f,{className:"h-8 w-8 rounded-full"}),b(f,{className:"h-4 w-32"})]}),b(f,{className:"h-4 w-24"})]})]}),q("div",{className:"w-[360px] border-l p-4 flex flex-col gap-6 shrink-0 hidden lg:flex bg-card",children:[q("div",{className:"space-y-4",children:[b(f,{className:"h-5 w-32"}),b("div",{className:"space-y-3",children:Array.from({length:3}).map((w,v)=>q("div",{className:"flex justify-between items-center py-1 border-b",children:[b(f,{className:"h-3 w-20"}),b(f,{className:"h-3 w-32"})]},v))})]}),q("div",{className:"flex-1 flex flex-col gap-4",children:[b(f,{className:"h-5 w-24"}),b("div",{className:"space-y-3 flex-1 overflow-y-auto",children:Array.from({length:3}).map((w,v)=>q("div",{className:"flex gap-3 p-3 rounded-lg border bg-muted/10",children:[b(f,{className:"h-8 w-8 rounded-full shrink-0"}),q("div",{className:"space-y-2 flex-1",children:[q("div",{className:"flex justify-between",children:[b(f,{className:"h-3 w-24"}),b(f,{className:"h-2 w-12"})]}),b(f,{className:"h-3 w-full"}),b(f,{className:"h-3 w-5/6"})]})]},v))})]})]})]})]})}
2
- export{z as Uf,A as Vf};
1
+ import{qg as f}from"./chunk-2xnys7v4.js";import{Tg as b,Ug as q}from"./chunk-wf4d1anc.js";function z(){return q("div",{className:"flex h-screen flex-col bg-background min-h-0",children:[q("div",{className:"flex h-14 items-center justify-between border-b px-6 shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-24"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-32"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-8 w-8 rounded-md"}),b(f,{className:"h-8 w-20 rounded-md"})]})]}),q("div",{className:"flex flex-1 overflow-hidden",children:[q("div",{className:"w-[240px] border-r p-4 space-y-4 hidden md:block shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-4 rounded"}),b(f,{className:"h-4 w-24"})]}),q("div",{className:"pl-4 space-y-3",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-28"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-20"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-3 w-3 rounded"}),b(f,{className:"h-3 w-24"})]})]})]}),q("div",{className:"flex-1 p-6 space-y-6 overflow-y-auto",children:[q("div",{className:"flex items-center justify-between border-b pb-4",children:[q("div",{className:"flex items-center gap-4",children:[b(f,{className:"h-5 w-40"}),b(f,{className:"h-4 w-20"})]}),q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-8 w-8 rounded"}),b(f,{className:"h-8 w-8 rounded"}),b(f,{className:"h-8 w-32 rounded"})]})]}),q("div",{className:"space-y-4",children:[b("div",{className:"flex items-center gap-2",children:b(f,{className:"h-4 w-24"})}),b("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5",children:Array.from({length:10}).map((w,v)=>q("div",{className:"flex flex-col rounded-lg border bg-card p-3 space-y-3",children:[b(f,{className:"aspect-square w-full rounded-md"}),q("div",{className:"space-y-2",children:[b(f,{className:"h-4 w-3/4"}),q("div",{className:"flex justify-between items-center",children:[b(f,{className:"h-3 w-1/4"}),b(f,{className:"h-3 w-1/3"})]})]})]},v))})]})]})]})]})}function A(){return q("div",{className:"h-screen flex flex-col bg-background",children:[q("div",{className:"flex h-14 items-center justify-between border-b px-6 shrink-0",children:[q("div",{className:"flex items-center gap-2",children:[b(f,{className:"h-4 w-16"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-28"}),b("span",{className:"text-muted-foreground",children:"/"}),b(f,{className:"h-4 w-32"})]}),b("div",{className:"flex items-center gap-2",children:b(f,{className:"h-8 w-20 rounded"})})]}),q("div",{className:"flex flex-1 overflow-hidden",children:[q("div",{className:"w-[280px] border-r p-4 flex flex-col gap-4 shrink-0 hidden md:flex",children:[b(f,{className:"h-5 w-24"}),b("div",{className:"space-y-3 flex-1 overflow-y-auto",children:Array.from({length:4}).map((w,v)=>q("div",{className:"flex gap-3 p-2 rounded border",children:[b(f,{className:"h-12 w-12 rounded bg-muted shrink-0"}),q("div",{className:"space-y-2 flex-1",children:[b(f,{className:"h-3 w-2/3"}),b(f,{className:"h-2 w-1/2"})]})]},v))})]}),q("div",{className:"flex-1 bg-muted/20 p-6 flex flex-col justify-between relative min-w-0",children:[b("div",{className:"flex-1 flex items-center justify-center",children:b(f,{className:"w-full max-w-4xl aspect-video rounded-lg shadow-lg"})}),q("div",{className:"mt-4 flex items-center justify-between shrink-0",children:[q("div",{className:"flex items-center gap-4",children:[b(f,{className:"h-8 w-8 rounded-full"}),b(f,{className:"h-4 w-32"})]}),b(f,{className:"h-4 w-24"})]})]}),q("div",{className:"w-[360px] border-l p-4 flex flex-col gap-6 shrink-0 hidden lg:flex bg-card",children:[q("div",{className:"space-y-4",children:[b(f,{className:"h-5 w-32"}),b("div",{className:"space-y-3",children:Array.from({length:3}).map((w,v)=>q("div",{className:"flex justify-between items-center py-1 border-b",children:[b(f,{className:"h-3 w-20"}),b(f,{className:"h-3 w-32"})]},v))})]}),q("div",{className:"flex-1 flex flex-col gap-4",children:[b(f,{className:"h-5 w-24"}),b("div",{className:"space-y-3 flex-1 overflow-y-auto",children:Array.from({length:3}).map((w,v)=>q("div",{className:"flex gap-3 p-3 rounded-lg border bg-muted/10",children:[b(f,{className:"h-8 w-8 rounded-full shrink-0"}),q("div",{className:"space-y-2 flex-1",children:[q("div",{className:"flex justify-between",children:[b(f,{className:"h-3 w-24"}),b(f,{className:"h-2 w-12"})]}),b(f,{className:"h-3 w-full"}),b(f,{className:"h-3 w-5/6"})]})]},v))})]})]})]})]})}
2
+ export{z as zf,A as Af};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  var q=new Set;function F(b){return q.add(b),()=>{q.delete(b)}}function A(b){if(b instanceof Error)return b.message||b.name;if(typeof b==="string")return b;return String(b)}function B(b){if(!(b instanceof Error))return{name:"ThrownValue",message:A(b)};let k=b.code;return{name:b.name||void 0,message:b.message||b.name,stack:b.stack,code:typeof k==="string"||typeof k==="number"?k:void 0}}function H(b,k,z){return{type:b,timestamp:Date.now(),error:B(k),details:z}}function J(b,k){b.diagnostics=[...b.diagnostics??[],k]}
3
- export{F as Hb,A as Ib,H as Jb,J as Kb};
3
+ export{F as Se,A as Te,H as Ue,J as Ve};
@@ -25,7 +25,7 @@
25
25
  <meta name="theme-color" content="#ffffff" />
26
26
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
27
27
  <title>Shumai</title>
28
- <link rel="stylesheet" crossorigin href="./chunk-4zq8vxcy.css"><script type="module" crossorigin src="./chunk-frm7vz6v.js"></script></head>
28
+ <link rel="stylesheet" crossorigin href="./chunk-4zq8vxcy.css"><script type="module" crossorigin src="./chunk-wfex9jw0.js"></script></head>
29
29
  <body>
30
30
  <div id="root"></div>
31
31