@shumai-one/shumai 0.3.8 → 0.3.10
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/bin/{chunk-fvwz4mgw.js → chunk-02tqxzgz.js} +2 -2
- package/bin/chunk-09c03qdg.js +2 -0
- package/bin/chunk-0fpgfrv8.js +2 -0
- package/bin/{chunk-p1rrkrn4.js → chunk-0hbqkcsd.js} +1 -1
- package/bin/{chunk-3bm3be9d.js → chunk-0qcp4v52.js} +1 -1
- package/bin/chunk-0te5kcy3.js +2 -0
- package/bin/chunk-15zbprbe.js +1 -0
- package/bin/{chunk-drjaw6a5.js → chunk-1ev668rp.js} +2 -2
- package/bin/{chunk-ykarhcph.js → chunk-1qd83phd.js} +1 -1
- package/bin/{chunk-r5rf62aa.js → chunk-1whn0v5n.js} +1 -1
- package/bin/{chunk-mp5etccz.js → chunk-28axgckk.js} +1 -1
- package/bin/{chunk-pqtwzb3s.js → chunk-2mxqjx3x.js} +1 -1
- package/bin/{chunk-y5g2ge6f.js → chunk-2sk6e4q0.js} +1 -1
- package/bin/{chunk-nffrjwb7.js → chunk-2sp0gkaw.js} +2 -2
- package/bin/{chunk-ygcmv04c.js → chunk-2t2wjzme.js} +2 -2
- package/bin/chunk-301pewt3.js +1 -0
- package/bin/chunk-33hax7fe.js +66 -0
- package/bin/{chunk-h9f55mjv.js → chunk-34f4hk54.js} +2 -2
- package/bin/{chunk-rq4h4p2g.js → chunk-39s0cxq1.js} +2 -2
- package/bin/{chunk-2ejky9qv.js → chunk-41de755j.js} +1 -1
- package/bin/{chunk-5fj5w0gg.js → chunk-42et2rqa.js} +2 -2
- package/bin/{chunk-k5yxntns.js → chunk-42f9r1sg.js} +2 -2
- package/bin/chunk-484yr1a7.js +1 -0
- package/bin/{chunk-ta02azkp.js → chunk-4shqnfq1.js} +1 -1
- package/bin/{chunk-nc632fxz.js → chunk-60xawsa6.js} +2 -2
- package/bin/chunk-62ag2nfa.js +2 -0
- package/bin/chunk-63emv4q3.js +1 -0
- package/bin/chunk-6529sh41.js +2 -0
- package/bin/{chunk-0zbwpfsk.js → chunk-661mcdxj.js} +2 -2
- package/bin/{chunk-6pcs8810.js → chunk-69sf7kb1.js} +1 -1
- package/bin/{chunk-bc2bf144.js → chunk-6gx6gdnk.js} +2 -2
- package/bin/chunk-6w395tfy.js +2 -0
- package/bin/chunk-7735r8d7.js +1 -0
- package/bin/{chunk-xexxh1zq.js → chunk-7m07t899.js} +1 -1
- package/bin/{chunk-tfnh9sk9.js → chunk-7r6h3fta.js} +2 -2
- package/bin/chunk-7xwmj4ew.js +2 -0
- package/bin/{chunk-yr8a8nzv.js → chunk-8r2agmv2.js} +2 -2
- package/bin/{chunk-antsxrw9.js → chunk-8zmk029n.js} +1 -1
- package/bin/{chunk-7r22vcjy.js → chunk-90jcmarf.js} +2 -2
- package/bin/{chunk-qyegjbzd.js → chunk-94fyesf6.js} +1 -1
- package/bin/chunk-94yxj3yy.js +2 -0
- package/bin/{chunk-c24an5j3.js → chunk-9rhckjgf.js} +2 -2
- package/bin/chunk-9ykcjdsv.js +3 -0
- package/bin/chunk-9yn5r2hh.js +2 -0
- package/bin/chunk-a80aab0f.js +2 -0
- package/bin/{chunk-x8ksced7.js → chunk-ag0pavv1.js} +2 -2
- package/bin/{chunk-ve826t5r.js → chunk-at5ksmqs.js} +1 -1
- package/bin/{chunk-7c85cyn0.js → chunk-bv5mh0e0.js} +3 -3
- package/bin/{chunk-6pmsknnk.js → chunk-bxexm2hd.js} +47 -47
- package/bin/{chunk-99f9r6xm.js → chunk-cc9fftnv.js} +2 -2
- package/bin/{chunk-15jsnygy.js → chunk-ch25gq27.js} +2 -2
- package/bin/chunk-csky7q56.js +2 -0
- package/bin/{chunk-mjxay7yv.js → chunk-d4ktgq49.js} +1 -1
- package/bin/{chunk-eqf7k7ax.js → chunk-day61cfg.js} +2 -2
- package/bin/{chunk-rjkj0dr9.js → chunk-dgvcraag.js} +2 -2
- package/bin/{chunk-80g5kcm0.js → chunk-e26p9vrv.js} +1 -1
- package/bin/{chunk-xpce3j7g.js → chunk-emyax05s.js} +1 -1
- package/bin/{chunk-2t0asg3w.js → chunk-enq1hf8g.js} +2 -2
- package/bin/{chunk-q0xv46wa.js → chunk-f03whbny.js} +2 -2
- package/bin/{chunk-k0ysbh3h.js → chunk-fk9pd7ra.js} +1 -1
- package/bin/{chunk-ssz62jfs.js → chunk-fscyvjzb.js} +2 -2
- package/bin/{chunk-21rp4vzr.js → chunk-g2bkj92r.js} +2 -2
- package/bin/chunk-g5qfxnz1.js +2 -0
- package/bin/{chunk-ph43tgr6.js → chunk-g6aq2cyq.js} +1 -1
- package/bin/chunk-gh6j1nsm.js +1 -0
- package/bin/{chunk-xktnqktj.js → chunk-gra1fhdp.js} +2 -2
- package/bin/{chunk-28n8xqhm.js → chunk-gtenq4kq.js} +1 -1
- package/bin/chunk-h5jre78a.js +2 -0
- package/bin/{chunk-thqahbva.js → chunk-hcaw54dj.js} +2 -2
- package/bin/{chunk-jfjjh86p.js → chunk-hsemzjvr.js} +2 -2
- package/bin/chunk-hte6gd36.js +1 -0
- package/bin/{chunk-djqs6m7w.js → chunk-j6dea33m.js} +3 -3
- package/bin/{chunk-n8pas7tj.js → chunk-j99cr9mz.js} +2 -2
- package/bin/chunk-jn805ccq.js +1 -0
- package/bin/{chunk-en96pr5c.js → chunk-k2w676wz.js} +2 -2
- package/bin/{chunk-m7d52gfe.js → chunk-k33qdrdp.js} +1 -1
- package/bin/chunk-kmhkhcy6.js +68 -0
- package/bin/chunk-kp4kn4b4.js +2 -0
- package/bin/{chunk-e4se9q6n.js → chunk-m3ghgqc2.js} +1 -1
- package/bin/chunk-m84qgdyj.js +2 -0
- package/bin/{chunk-9acfydwy.js → chunk-mk5hqjjd.js} +1 -1
- package/bin/{chunk-tvzfm7g8.js → chunk-mnhg12fm.js} +2 -2
- package/bin/{chunk-rjr8c8be.js → chunk-n3vzdzdw.js} +2 -2
- package/bin/{chunk-8bhsdk1v.js → chunk-nw03w9pa.js} +1 -1
- package/bin/{chunk-6vwqg1ra.js → chunk-p31qe5mc.js} +2 -2
- package/bin/chunk-p48npmbh.js +2 -0
- package/bin/{chunk-8fsrs7mh.js → chunk-p9w4ar11.js} +1 -1
- package/bin/chunk-pbztc6kv.js +1 -0
- package/bin/{chunk-9ntwrvhz.js → chunk-pg55qp08.js} +2 -2
- package/bin/{chunk-0qpz48vc.js → chunk-pv4scagf.js} +1 -1
- package/bin/chunk-q0hrd0yw.js +2 -0
- package/bin/{chunk-m49ar48r.js → chunk-qev7trtm.js} +2 -2
- package/bin/chunk-qk9npww4.js +2 -0
- package/bin/{chunk-4g4g02e0.js → chunk-qphebjbv.js} +1 -1
- package/bin/{chunk-0pm8c9bq.js → chunk-rakz3pe6.js} +2 -2
- package/bin/chunk-rjga1vn2.js +2 -0
- package/bin/chunk-rt8yqz51.js +1 -0
- package/bin/chunk-s542e1y0.js +1 -0
- package/bin/chunk-s6e91ky2.js +2 -0
- package/bin/chunk-s9s9hhet.js +2 -0
- package/bin/{chunk-2dxd0bar.js → chunk-s9yzt7s3.js} +2 -2
- package/bin/chunk-sjsn35mp.js +1 -0
- package/bin/{chunk-2q26gz0p.js → chunk-stggq92k.js} +1 -1
- package/bin/{chunk-5f9fk8x0.js → chunk-t16qt2ka.js} +3 -3
- package/bin/chunk-tc5evq8x.js +2 -0
- package/bin/chunk-tjrdsmdw.js +1 -0
- package/bin/{chunk-3mx22sn7.js → chunk-tkh0s7hg.js} +2 -2
- package/bin/{chunk-agdza65r.js → chunk-tsym31yb.js} +2 -2
- package/bin/{chunk-twm329fs.js → chunk-v1ybpqrz.js} +1 -1
- package/bin/chunk-vbkwteh4.js +1 -0
- package/bin/chunk-vevscfh2.js +2 -0
- package/bin/chunk-vg33qt6z.js +11 -0
- package/bin/{chunk-ep138kb3.js → chunk-vgwjg37a.js} +2 -2
- package/bin/chunk-vwz2pa54.js +2 -0
- package/bin/chunk-we3vdyhb.js +1 -0
- package/bin/chunk-whn6dvak.js +1 -0
- package/bin/{chunk-2em77vjv.js → chunk-wwjqqqr4.js} +1 -1
- package/bin/{chunk-jqzvazsf.js → chunk-xext4yvc.js} +1 -1
- package/bin/chunk-xr1wr22v.css +1 -0
- package/bin/chunk-xvpttxen.js +7 -0
- package/bin/chunk-y45tzhdn.js +2 -0
- package/bin/{chunk-kmt9fj1z.js → chunk-y5ptk39s.js} +2 -2
- package/bin/{chunk-bznz6h19.js → chunk-y7b5gy17.js} +1 -1
- package/bin/{chunk-2xaq1y16.js → chunk-y8ffp5zj.js} +2 -2
- package/bin/chunk-yfgwknpa.js +78 -0
- package/bin/{chunk-0mmw31pj.js → chunk-z7b132c0.js} +2 -2
- package/bin/{chunk-wy1ytxw7.js → chunk-zdmcc6ps.js} +3 -3
- package/bin/shumai-app.html +1 -1
- package/bin/shumai-app.js +703 -407
- package/package.json +7 -7
- package/prisma/migrations/20260816020719_add_agent_permission/migration.sql +2 -0
- package/prisma/migrations/20260817022118_add_quota_rules_and_records/migration.sql +68 -0
- package/prisma/migrations/20260818025858_remove_agent_skill_call_count_from_quota_resource_type/migration.sql +14 -0
- package/prisma/migrations/20260819091331_add_kanban_schema/migration.sql +164 -0
- package/prisma/migrations/20260821102514_add_kanban_notifications/migration.sql +26 -0
- package/prisma/migrations/20260821133500_add_c_collation_to_kanban_sort_index/migration.sql +10 -0
- package/prisma/migrations/20260822020609_add_kanban_task_assets/migration.sql +17 -0
- package/prisma/migrations/20260822071734_remove_kanban_task_cancelled_status/migration.sql +28 -0
- package/prisma/schema.prisma +257 -0
- package/bin/chunk-16s5kfy8.css +0 -1
- package/bin/chunk-33r4w0yv.js +0 -2
- package/bin/chunk-4cmw4qmt.js +0 -1
- package/bin/chunk-4d3wm83a.js +0 -2
- package/bin/chunk-5386brz2.js +0 -2
- package/bin/chunk-61bxmjd9.js +0 -2
- package/bin/chunk-75segwsp.js +0 -2
- package/bin/chunk-7eyg2kgv.js +0 -1
- package/bin/chunk-8jfm1j41.js +0 -1
- package/bin/chunk-8n6segk5.js +0 -1
- package/bin/chunk-bapy3qv8.js +0 -1
- package/bin/chunk-cm74nd4n.js +0 -1
- package/bin/chunk-cynjx7ha.js +0 -65
- package/bin/chunk-cyq3m4qz.js +0 -1
- package/bin/chunk-ddff7vm3.js +0 -2
- package/bin/chunk-dn8k5ef5.js +0 -3
- package/bin/chunk-dqdqs0d9.js +0 -1
- package/bin/chunk-drvwchyn.js +0 -2
- package/bin/chunk-eb551xw7.js +0 -1
- package/bin/chunk-f3rqamey.js +0 -2
- package/bin/chunk-g3p6h6sw.js +0 -68
- package/bin/chunk-jg31cnqc.js +0 -2
- package/bin/chunk-jk87gxbb.js +0 -2
- package/bin/chunk-jyk483r4.js +0 -1
- package/bin/chunk-khjybf4y.js +0 -1
- package/bin/chunk-p6ep6grv.js +0 -1
- package/bin/chunk-qhxznkjk.js +0 -11
- package/bin/chunk-qmja7bsr.js +0 -2
- package/bin/chunk-scmhhrte.js +0 -2
- package/bin/chunk-sjr6mvgm.js +0 -78
- package/bin/chunk-vpfj3q7r.js +0 -1
- package/bin/chunk-vqakgjsf.js +0 -1
- package/bin/chunk-wgjghs54.js +0 -7
- package/bin/chunk-x788nk6z.js +0 -2
- package/bin/chunk-xyzsmjtk.js +0 -2
- package/bin/chunk-y03s8bkz.js +0 -1
- package/bin/chunk-yxtb7xn8.js +0 -2
- package/bin/chunk-zaft3sfe.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Mb as Z,Nb as v}from"./chunk-s9yzt7s3.js";import{yc as $,zc as h}from"./chunk-xext4yvc.js";import"./chunk-wwjqqqr4.js";var F=class extends v{},G=class{#j;#z;constructor(j){this.#j={...j}}async init(){if(this.#z=new M(this.#j.database),this.#j.onCreateConnection)await this.#j.onCreateConnection(this.#z)}async acquireConnection(){return this.#z}async beginTransaction(){throw Error("D1 does not support interactive transactions. Use the D1 batch() API instead.")}async commitTransaction(){throw Error("D1 does not support interactive transactions. Use the D1 batch() API instead.")}async rollbackTransaction(){throw Error("D1 does not support interactive transactions. Use the D1 batch() API instead.")}async releaseConnection(){}async destroy(){}},M=class{#j;constructor(j){this.#j=j}async executeQuery(j){let z=await this.#j.prepare(j.sql).bind(...j.parameters).all(),J=z.meta.changes!=null?BigInt(z.meta.changes):void 0;return{insertId:z.meta.last_row_id===void 0||z.meta.last_row_id===null?void 0:BigInt(z.meta.last_row_id),rows:z?.results||[],numAffectedRows:J}}async*streamQuery(){throw Error("D1 does not support streaming queries.")}},N=class{#j;#z;constructor(j,z){this.#j=j,this.#z=z}async getSchemas(){return[]}async getTables(j={withInternalKyselyTables:!1}){let z=this.#j.selectFrom("sqlite_master").where("type","in",["table","view"]).where("name","not like","sqlite_%").where("name","not like","_cf_%").select(["name","type","sql"]).$castTo();if(!j.withInternalKyselyTables)z=z.where("name","!=",$).where("name","!=",h);let J=await z.execute();if(J.length===0)return[];let w=J.map((V)=>this.#z.prepare("SELECT * FROM pragma_table_info(?)").bind(V.name)),K=await this.#z.batch(w);return J.map((V,x)=>{let Y=K[x]?.results??[],W=V.sql?.split(/[(),]/)?.find((H)=>H.toLowerCase().includes("autoincrement"))?.split(/\s+/)?.filter(Boolean)?.[0]?.replace(/["`]/g,"");if(!W){let H=Y.filter((B)=>B.pk>0),X=H.length===1?H[0]:void 0;if(X&&X.type.toLowerCase()==="integer")W=X.name}return{name:V.name,isView:V.type==="view",columns:Y.map((H)=>({name:H.name,dataType:H.type,isNullable:!H.notnull,isAutoIncrementing:H.name===W,hasDefaultValue:H.dflt_value!=null}))}})}async getMetadata(j){return{tables:await this.getTables(j)}}},U=class extends Z{},P=class{#j;constructor(j){this.#j={...j}}createDriver(){return new G(this.#j)}createQueryCompiler(){return new U}createAdapter(){return new F}createIntrospector(j){return new N(j,this.#j.database)}};export{P as D1SqliteDialect};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var I=(w)=>w;function J(w,H,A=I){let B=new Map;for(let h of w.tools??[])B.set(A(h.name),h);if(!H)return{immediate:[...B.values()],deferred:new Map};let C=new Set,D=new Set;for(let h of w.messages)if(h.role==="assistant"){for(let v of h.content)if(v.type==="toolCall")D.add(A(v.name))}else if(h.role==="toolResult")for(let v of h.addedToolNames??[]){let G=A(v);if(!D.has(G))C.add(G)}let E=[],F=new Map;for(let[h,v]of B)if(C.has(h))F.set(h,v);else E.push(v);return{immediate:E,deferred:F}}
|
|
3
|
-
export{J as
|
|
3
|
+
export{J as Ql};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Td as GJ,Ud as zJ}from"./chunk-8fsrs7mh.js";import{il as OJ}from"./chunk-pqtwzb3s.js";import{ll as n,ml as WJ,nl as r}from"./chunk-thqahbva.js";import{ol as jJ}from"./chunk-3bm3be9d.js";import"./chunk-ta02azkp.js";import{tl as p}from"./chunk-21rp4vzr.js";import"./chunk-tfnh9sk9.js";import{Il as KJ,Jl as _J}from"./chunk-xexxh1zq.js";import{Ol as a,Ql as LJ}from"./chunk-ph43tgr6.js";import"./chunk-mjxay7yv.js";import{Ul as i}from"./chunk-r5rf62aa.js";import{$l as DJ}from"./chunk-h9f55mjv.js";import{am as YJ,bm as y,cm as NJ,dm as VJ}from"./chunk-m7d52gfe.js";import"./chunk-2em77vjv.js";function o(J){let Q=J.filter((F)=>F!==void 0);if(Q.length===0)return{cleanup:()=>{}};if(Q.length===1)return{signal:Q[0],cleanup:()=>{}};let Z=new AbortController,$=[],X=(F)=>{if(!Z.signal.aborted)Z.abort(F.reason)};for(let F of Q){if(F.aborted){X(F);break}let Y=()=>X(F);F.addEventListener("abort",Y,{once:!0}),$.push({signal:F,listener:Y})}return{signal:Z.signal,cleanup:()=>{for(let{signal:F,listener:Y}of $)F.removeEventListener("abort",Y)}}}var fJ={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function c(J,Q){let Z=J.toLowerCase(),$=J.toUpperCase();return Q?.[Z]||Q?.[$]||p(Z)||p($)||""}function SJ(J){if(J instanceof URL)return J;try{return new URL(J)}catch{return}}function TJ(J,Q,Z){let $=c("no_proxy",Z).toLowerCase();if(!$)return!0;if($==="*")return!1;return $.split(/[,\s]/).every((X)=>{if(!X)return!0;let F=X.match(/^(.+):(\d+)$/),Y=F?F[1]:X,G=F?Number.parseInt(F[2],10):0;if(G&&G!==Q)return!0;if(!/^[.*]/.test(Y))return J!==Y;if(Y.startsWith("*"))Y=Y.slice(1);return!J.endsWith(Y)})}function hJ(J,Q){let Z=SJ(J);if(!Z?.protocol||!Z.host)return"";let $=Z.protocol.split(":",1)[0],X=Z.host.replace(/:\d*$/,""),F=Number.parseInt(Z.port,10)||fJ[$]||0;if(!TJ(X,F,Q))return"";let Y=c(`${$}_proxy`,Q)||c("all_proxy",Q);if(Y&&!Y.includes("://"))Y=`${$}://${Y}`;return Y}var xJ="Unsupported proxy protocol. SOCKS and PAC proxy URLs are not supported; use an HTTP or HTTPS proxy URL.";function e(J,Q){let Z=hJ(J,Q);if(!Z)return;let $;try{$=new URL(Z)}catch(X){throw Error(`Invalid proxy URL ${JSON.stringify(Z)}: ${X instanceof Error?X.message:String(X)}`)}if($.protocol!=="http:"&&$.protocol!=="https:")throw Error(`${xJ} Got ${$.protocol}`);return $}function bJ(){if(typeof process>"u"||!(process.versions?.node||process.versions?.bun))return null;return process.getBuiltinModule?.("node:os")??null}var I=bJ(),kJ="https://chatgpt.com/backend-api",IJ="https://api.openai.com/auth",gJ=0,JJ=1000,vJ=60000,yJ=15000,mJ=3,BJ=new Set(["openai","openai-codex","opencode"]),uJ=1009,pJ="websocket_connection_limit_reached",cJ="previous_response_not_found",lJ=new Set(["completed","incomplete","failed","cancelled","queued","in_progress"]);function dJ(J){return/GoUsageLimitError|FreeUsageLimitError|Monthly usage limit reached|available balance|insufficient_quota|out of budget|quota exceeded|billing/i.test(J)}function iJ(J,Q){if(J===429&&dJ(Q))return!1;if(J===429||J===500||J===502||J===503||J===504)return!0;return/rate.?limit|overloaded|service.?unavailable|upstream.?connect|connection.?refused/i.test(Q)}function aJ(J){let Q=J.get("retry-after-ms");if(Q!==null){let F=Number(Q);if(Number.isFinite(F))return Math.max(0,F)}let Z=J.get("retry-after");if(!Z)return;let $=Number(Z);if(Number.isFinite($))return Math.max(0,$*1000);let X=Date.parse(Z);if(!Number.isNaN(X))return Math.max(0,X-Date.now());return}class t extends Error{}function nJ(J,Q){let Z=Q?.maxRetryDelayMs??vJ;if(Z>0&&J>Z)throw new t(`Server requested ${Math.ceil(J/1000)}s retry delay (max: ${Math.ceil(Z/1000)}s)`);return J}function QJ(J,Q){return new Promise((Z,$)=>{if(Q?.aborted){$(Error("Request was aborted"));return}let X=setTimeout(Z,J);Q?.addEventListener("abort",()=>{clearTimeout(X),$(Error("Request was aborted"))})})}function ZJ(J){if(J===void 0)return;if(!Number.isFinite(J)||J<0)throw Error(`Invalid timeoutMs: ${String(J)}`);return Math.floor(J)}function rJ(){if(typeof process>"u"||!(process.versions?.node||process.versions?.bun))return null;return process.getBuiltinModule?.("node:zlib")??null}function tJ(J){let Q=rJ();if(!Q||typeof Q.zstdCompressSync!=="function")return null;try{let Z=Q.zstdCompressSync(J,{params:{[Q.constants.ZSTD_c_compressionLevel]:mJ}});return new Uint8Array(Z.buffer,Z.byteOffset,Z.byteLength)}catch{return null}}var sJ=(J,Q,Z)=>{let $=new YJ;return(async()=>{let X={role:"assistant",content:[],api:"openai-codex-responses",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 F=Z?.apiKey;if(!F)throw Error(`No API key for provider: ${J.provider}`);let Y=UQ(F),G=a(Q.tools,J.compat?.supportsOpenAIGrammarTools??!1),N=Z?.cacheRetention==="none"?void 0:Z?.sessionId,V=jJ(N),K=oJ(J,Q,Z,V,G),D=await Z?.onPayload?.(K,J);if(D!==void 0)K=D;let R=V||zJ(),z=CQ(J.headers,Z?.headers,Y,F,V),A=MQ(J.headers,Z?.headers,Y,F,R),j=JSON.stringify(K),_=ZJ(Z?.timeoutMs),U=ZJ(Z?.websocketConnectTimeoutMs),L=Z?.transport||"auto",W=!1,O=L!=="sse"&&EJ(N);if(O)$J(N);if(L!=="sse"&&!O){let B=!1,H=!1,M=!1;while(!0){B=!1;try{if(await wQ(JQ(J.baseUrl),K,A,X,$,J,()=>{if(B=!0,!W)W=!0,$.push({type:"start",partial:X})},_,U,N,G,Z),Z?.signal?.aborted)throw Error("Request was aborted");$.push({type:"done",reason:X.stopReason,message:X}),$.end();return}catch(w){let x=Z?.signal?.aborted,b=!B&&$Q(w),S=FQ(w);if(!x&&S&&!M){M=!0;continue}if(!x&&b&&!H){H=!0;continue}if(x||ZQ(w)&&!b)throw w;if(VJ(X,NJ("provider_transport_failure",w,{configuredTransport:L,fallbackTransport:B?void 0:"sse",eventsEmitted:B,phase:B?"after_message_stream_start":"before_message_stream_start",requestBytes:new TextEncoder().encode(j).byteLength})),KQ(N,w),B)throw w;$J(N);break}}}let C=tJ(j);if(C)z.set("content-encoding","zstd");let f=C??j,q,h,u=Z?.maxRetries??gJ;for(let B=0;B<=u;B++){if(Z?.signal?.aborted)throw Error("Request was aborted");try{let H=_!==void 0&&_>0?AbortSignal.timeout(_):void 0,M=o([Z?.signal,H]);try{q=await fetch(qJ(J.baseUrl),{method:"POST",headers:z,body:f,signal:M.signal})}catch(S){if(H?.aborted&&!Z?.signal?.aborted)throw Error(`Codex SSE response headers timed out after ${_}ms`);throw S}finally{M.cleanup()}if(await Z?.onResponse?.({status:q.status,headers:i(q.headers)},J),q.ok)break;let w=await q.text();if(B<u&&iJ(q.status,w)){let S=aJ(q.headers),MJ=S===void 0?JJ*2**B:nJ(S,Z);await QJ(MJ,Z?.signal);continue}let x=new Response(w,{status:q.status,statusText:q.statusText}),b=await PQ(x);throw Error(b.friendlyMessage||b.message)}catch(H){if(H instanceof Error){if(H.name==="AbortError"||H.message==="Request was aborted")throw Error("Request was aborted")}if(h=H instanceof Error?H:Error(String(H)),B<u&&!(h instanceof t)&&!h.message.includes("usage limit")){let M=JJ*2**B;await QJ(M,Z?.signal);continue}throw h}}if(!q?.ok)throw h??Error("Failed after retries");if(!q.body)throw Error("No response body");if(!W)W=!0,$.push({type:"start",partial:X});if(await QQ(q,X,$,J,G,Z),Z?.signal?.aborted)throw Error("Request was aborted");$.push({type:"done",reason:X.stopReason,message:X}),$.end()}catch(F){for(let Y of X.content)delete Y.partialJson,delete Y.customInput;X.stopReason=Z?.signal?.aborted?"aborted":"error",X.errorMessage=_J(KJ(F)),$.push({type:"error",reason:X.stopReason,error:X}),$.end()}})(),$},iQ=(J,Q,Z)=>{let $=Z?.apiKey;if(!$)throw Error(`No API key for provider: ${J.provider}`);let X=LJ(J,Q,Z,$),F=Z?.reasoning?DJ(J,Z.reasoning):void 0;return sJ(J,Q,{...X,reasoningEffort:F==="off"?void 0:F})};function oJ(J,Q,Z,$,X=a(Q.tools,J.compat?.supportsOpenAIGrammarTools??!1)){let F=J.compat?.supportsStrictMode??!0,Y=J.compat?.supportsOpenAIGrammarTools??!1,G=OJ(Q,J.compat?.supportsToolSearch??!1),N=n(J,Q,BJ,{includeSystemPrompt:!1,grammarToolInputProperties:X,deferredTools:G.deferred,toolOptions:{strict:null,supportsStrictMode:F,supportsOpenAIGrammarTools:Y}}),V={model:J.id,store:!1,stream:!0,instructions:Q.systemPrompt||"You are a helpful assistant.",input:N,text:{verbosity:Z?.textVerbosity||"low"},include:["reasoning.encrypted_content"],prompt_cache_key:$,tool_choice:Z?.toolChoice??"auto",parallel_tool_calls:!0};if(Z?.temperature!==void 0)V.temperature=Z.temperature;if(Z?.serviceTier!==void 0)V.service_tier=Z.serviceTier;if(G.immediate.length>0)V.tools=WJ(G.immediate,{strict:null,supportsStrictMode:F,supportsOpenAIGrammarTools:Y});if(Z?.reasoningEffort!==void 0){let K=Z.reasoningEffort==="none"?J.thinkingLevelMap?.off??"none":J.thinkingLevelMap?.[Z.reasoningEffort]??Z.reasoningEffort;if(K!==null)V.reasoning={effort:K,summary:Z.reasoningSummary??"auto"}}return V}function eJ(J,Q){switch(Q){case"flex":return 0.5;case"priority":return J.id==="gpt-5.5"?2.5:2;default:return 1}}function RJ(J,Q,Z){let $=eJ(Z,Q);if($===1)return;J.cost.input*=$,J.cost.output*=$,J.cost.cacheRead*=$,J.cost.cacheWrite*=$,J.cost.total=J.cost.input+J.cost.output+J.cost.cacheRead+J.cost.cacheWrite}function AJ(J,Q){if(J==="default"&&(Q==="flex"||Q==="priority"))return Q;return J??Q}function qJ(J){let Z=(J&&J.trim().length>0?J:kJ).replace(/\/+$/,"");if(Z.endsWith("/codex/responses"))return Z;if(Z.endsWith("/codex"))return`${Z}/responses`;return`${Z}/codex/responses`}function JQ(J){let Q=new URL(qJ(J));if(Q.protocol==="https:")Q.protocol="wss:";if(Q.protocol==="http:")Q.protocol="ws:";return Q.toString()}async function QQ(J,Q,Z,$,X,F){await r(HJ(NQ(J,F?.signal)),Q,Z,$,{serviceTier:F?.serviceTier,grammarToolInputProperties:X,resolveServiceTier:AJ,applyServiceTierPricing:(Y,G)=>RJ(Y,G,$)})}class T extends Error{code;payload;constructor(J,Q){super(J);this.name="CodexApiError",this.code=Q?.code,this.payload=Q?.payload,this.cause=Q?.cause}}class m extends Error{payload;constructor(J,Q){super(J);this.name="CodexProtocolError",this.payload=Q?.payload,this.cause=Q?.cause}}function ZQ(J){return J instanceof T||J instanceof m}function $Q(J){return J instanceof T&&J.code===pJ}function FQ(J){return J instanceof T&&J.code===cJ}function XQ(J){let Q=J.error&&typeof J.error==="object"?J.error:void 0;return{code:typeof J.code==="string"?J.code:typeof Q?.code==="string"?Q.code:void 0,message:typeof J.message==="string"?J.message:typeof Q?.message==="string"?Q.message:void 0}}async function*HJ(J){for await(let Q of J){let Z=typeof Q.type==="string"?Q.type:void 0;if(!Z)continue;if(Z==="error"){let{code:$,message:X}=XQ(Q);throw new T(`Codex error: ${X||$||JSON.stringify(Q)}`,{code:$,payload:Q})}if(Z==="response.failed"){let $=Q.response,X=$?.error?.code,F=$?.error?.message;throw new T(F||"Codex response failed",{code:X,payload:Q})}if(Z==="response.done"||Z==="response.completed"||Z==="response.incomplete"){let $=Q.response,X=$?{...$,status:YQ($.status)}:$;yield{...Q,type:"response.completed",response:X};return}yield Q}}function YQ(J){if(typeof J!=="string")return;return lJ.has(J)?J:void 0}async function*NQ(J,Q){if(!J.body)return;let Z=J.body.getReader(),$=new TextDecoder,X="",F=()=>{Z.cancel().catch(()=>{})};Q?.addEventListener("abort",F,{once:!0});try{while(!0){if(Q?.aborted)throw Error("Request was aborted");let{done:Y,value:G}=await Z.read();if(Q?.aborted)throw Error("Request was aborted");if(Y)break;X+=$.decode(G,{stream:!0});let N=X.indexOf(`
|
|
2
|
+
import{nd as GJ,od as zJ}from"./chunk-p9w4ar11.js";import{Ql as OJ}from"./chunk-2mxqjx3x.js";import{Tl as n,Ul as WJ,Vl as r}from"./chunk-hcaw54dj.js";import{Wl as jJ}from"./chunk-0qcp4v52.js";import"./chunk-4shqnfq1.js";import{$l as p}from"./chunk-g2bkj92r.js";import"./chunk-7r6h3fta.js";import{om as KJ,pm as _J}from"./chunk-7m07t899.js";import{um as a,wm as LJ}from"./chunk-g6aq2cyq.js";import"./chunk-d4ktgq49.js";import{Am as i}from"./chunk-1whn0v5n.js";import{Hm as DJ}from"./chunk-34f4hk54.js";import{Im as YJ,Jm as y,Km as NJ,Lm as VJ}from"./chunk-k33qdrdp.js";import"./chunk-wwjqqqr4.js";function o(J){let Q=J.filter((F)=>F!==void 0);if(Q.length===0)return{cleanup:()=>{}};if(Q.length===1)return{signal:Q[0],cleanup:()=>{}};let Z=new AbortController,$=[],X=(F)=>{if(!Z.signal.aborted)Z.abort(F.reason)};for(let F of Q){if(F.aborted){X(F);break}let Y=()=>X(F);F.addEventListener("abort",Y,{once:!0}),$.push({signal:F,listener:Y})}return{signal:Z.signal,cleanup:()=>{for(let{signal:F,listener:Y}of $)F.removeEventListener("abort",Y)}}}var fJ={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function c(J,Q){let Z=J.toLowerCase(),$=J.toUpperCase();return Q?.[Z]||Q?.[$]||p(Z)||p($)||""}function SJ(J){if(J instanceof URL)return J;try{return new URL(J)}catch{return}}function TJ(J,Q,Z){let $=c("no_proxy",Z).toLowerCase();if(!$)return!0;if($==="*")return!1;return $.split(/[,\s]/).every((X)=>{if(!X)return!0;let F=X.match(/^(.+):(\d+)$/),Y=F?F[1]:X,G=F?Number.parseInt(F[2],10):0;if(G&&G!==Q)return!0;if(!/^[.*]/.test(Y))return J!==Y;if(Y.startsWith("*"))Y=Y.slice(1);return!J.endsWith(Y)})}function hJ(J,Q){let Z=SJ(J);if(!Z?.protocol||!Z.host)return"";let $=Z.protocol.split(":",1)[0],X=Z.host.replace(/:\d*$/,""),F=Number.parseInt(Z.port,10)||fJ[$]||0;if(!TJ(X,F,Q))return"";let Y=c(`${$}_proxy`,Q)||c("all_proxy",Q);if(Y&&!Y.includes("://"))Y=`${$}://${Y}`;return Y}var xJ="Unsupported proxy protocol. SOCKS and PAC proxy URLs are not supported; use an HTTP or HTTPS proxy URL.";function e(J,Q){let Z=hJ(J,Q);if(!Z)return;let $;try{$=new URL(Z)}catch(X){throw Error(`Invalid proxy URL ${JSON.stringify(Z)}: ${X instanceof Error?X.message:String(X)}`)}if($.protocol!=="http:"&&$.protocol!=="https:")throw Error(`${xJ} Got ${$.protocol}`);return $}function bJ(){if(typeof process>"u"||!(process.versions?.node||process.versions?.bun))return null;return process.getBuiltinModule?.("node:os")??null}var I=bJ(),kJ="https://chatgpt.com/backend-api",IJ="https://api.openai.com/auth",gJ=0,JJ=1000,vJ=60000,yJ=15000,mJ=3,BJ=new Set(["openai","openai-codex","opencode"]),uJ=1009,pJ="websocket_connection_limit_reached",cJ="previous_response_not_found",lJ=new Set(["completed","incomplete","failed","cancelled","queued","in_progress"]);function dJ(J){return/GoUsageLimitError|FreeUsageLimitError|Monthly usage limit reached|available balance|insufficient_quota|out of budget|quota exceeded|billing/i.test(J)}function iJ(J,Q){if(J===429&&dJ(Q))return!1;if(J===429||J===500||J===502||J===503||J===504)return!0;return/rate.?limit|overloaded|service.?unavailable|upstream.?connect|connection.?refused/i.test(Q)}function aJ(J){let Q=J.get("retry-after-ms");if(Q!==null){let F=Number(Q);if(Number.isFinite(F))return Math.max(0,F)}let Z=J.get("retry-after");if(!Z)return;let $=Number(Z);if(Number.isFinite($))return Math.max(0,$*1000);let X=Date.parse(Z);if(!Number.isNaN(X))return Math.max(0,X-Date.now());return}class t extends Error{}function nJ(J,Q){let Z=Q?.maxRetryDelayMs??vJ;if(Z>0&&J>Z)throw new t(`Server requested ${Math.ceil(J/1000)}s retry delay (max: ${Math.ceil(Z/1000)}s)`);return J}function QJ(J,Q){return new Promise((Z,$)=>{if(Q?.aborted){$(Error("Request was aborted"));return}let X=setTimeout(Z,J);Q?.addEventListener("abort",()=>{clearTimeout(X),$(Error("Request was aborted"))})})}function ZJ(J){if(J===void 0)return;if(!Number.isFinite(J)||J<0)throw Error(`Invalid timeoutMs: ${String(J)}`);return Math.floor(J)}function rJ(){if(typeof process>"u"||!(process.versions?.node||process.versions?.bun))return null;return process.getBuiltinModule?.("node:zlib")??null}function tJ(J){let Q=rJ();if(!Q||typeof Q.zstdCompressSync!=="function")return null;try{let Z=Q.zstdCompressSync(J,{params:{[Q.constants.ZSTD_c_compressionLevel]:mJ}});return new Uint8Array(Z.buffer,Z.byteOffset,Z.byteLength)}catch{return null}}var sJ=(J,Q,Z)=>{let $=new YJ;return(async()=>{let X={role:"assistant",content:[],api:"openai-codex-responses",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 F=Z?.apiKey;if(!F)throw Error(`No API key for provider: ${J.provider}`);let Y=UQ(F),G=a(Q.tools,J.compat?.supportsOpenAIGrammarTools??!1),N=Z?.cacheRetention==="none"?void 0:Z?.sessionId,V=jJ(N),K=oJ(J,Q,Z,V,G),D=await Z?.onPayload?.(K,J);if(D!==void 0)K=D;let R=V||zJ(),z=CQ(J.headers,Z?.headers,Y,F,V),A=MQ(J.headers,Z?.headers,Y,F,R),j=JSON.stringify(K),_=ZJ(Z?.timeoutMs),U=ZJ(Z?.websocketConnectTimeoutMs),L=Z?.transport||"auto",W=!1,O=L!=="sse"&&EJ(N);if(O)$J(N);if(L!=="sse"&&!O){let B=!1,H=!1,M=!1;while(!0){B=!1;try{if(await wQ(JQ(J.baseUrl),K,A,X,$,J,()=>{if(B=!0,!W)W=!0,$.push({type:"start",partial:X})},_,U,N,G,Z),Z?.signal?.aborted)throw Error("Request was aborted");$.push({type:"done",reason:X.stopReason,message:X}),$.end();return}catch(w){let x=Z?.signal?.aborted,b=!B&&$Q(w),S=FQ(w);if(!x&&S&&!M){M=!0;continue}if(!x&&b&&!H){H=!0;continue}if(x||ZQ(w)&&!b)throw w;if(VJ(X,NJ("provider_transport_failure",w,{configuredTransport:L,fallbackTransport:B?void 0:"sse",eventsEmitted:B,phase:B?"after_message_stream_start":"before_message_stream_start",requestBytes:new TextEncoder().encode(j).byteLength})),KQ(N,w),B)throw w;$J(N);break}}}let C=tJ(j);if(C)z.set("content-encoding","zstd");let f=C??j,q,h,u=Z?.maxRetries??gJ;for(let B=0;B<=u;B++){if(Z?.signal?.aborted)throw Error("Request was aborted");try{let H=_!==void 0&&_>0?AbortSignal.timeout(_):void 0,M=o([Z?.signal,H]);try{q=await fetch(qJ(J.baseUrl),{method:"POST",headers:z,body:f,signal:M.signal})}catch(S){if(H?.aborted&&!Z?.signal?.aborted)throw Error(`Codex SSE response headers timed out after ${_}ms`);throw S}finally{M.cleanup()}if(await Z?.onResponse?.({status:q.status,headers:i(q.headers)},J),q.ok)break;let w=await q.text();if(B<u&&iJ(q.status,w)){let S=aJ(q.headers),MJ=S===void 0?JJ*2**B:nJ(S,Z);await QJ(MJ,Z?.signal);continue}let x=new Response(w,{status:q.status,statusText:q.statusText}),b=await PQ(x);throw Error(b.friendlyMessage||b.message)}catch(H){if(H instanceof Error){if(H.name==="AbortError"||H.message==="Request was aborted")throw Error("Request was aborted")}if(h=H instanceof Error?H:Error(String(H)),B<u&&!(h instanceof t)&&!h.message.includes("usage limit")){let M=JJ*2**B;await QJ(M,Z?.signal);continue}throw h}}if(!q?.ok)throw h??Error("Failed after retries");if(!q.body)throw Error("No response body");if(!W)W=!0,$.push({type:"start",partial:X});if(await QQ(q,X,$,J,G,Z),Z?.signal?.aborted)throw Error("Request was aborted");$.push({type:"done",reason:X.stopReason,message:X}),$.end()}catch(F){for(let Y of X.content)delete Y.partialJson,delete Y.customInput;X.stopReason=Z?.signal?.aborted?"aborted":"error",X.errorMessage=_J(KJ(F)),$.push({type:"error",reason:X.stopReason,error:X}),$.end()}})(),$},iQ=(J,Q,Z)=>{let $=Z?.apiKey;if(!$)throw Error(`No API key for provider: ${J.provider}`);let X=LJ(J,Q,Z,$),F=Z?.reasoning?DJ(J,Z.reasoning):void 0;return sJ(J,Q,{...X,reasoningEffort:F==="off"?void 0:F})};function oJ(J,Q,Z,$,X=a(Q.tools,J.compat?.supportsOpenAIGrammarTools??!1)){let F=J.compat?.supportsStrictMode??!0,Y=J.compat?.supportsOpenAIGrammarTools??!1,G=OJ(Q,J.compat?.supportsToolSearch??!1),N=n(J,Q,BJ,{includeSystemPrompt:!1,grammarToolInputProperties:X,deferredTools:G.deferred,toolOptions:{strict:null,supportsStrictMode:F,supportsOpenAIGrammarTools:Y}}),V={model:J.id,store:!1,stream:!0,instructions:Q.systemPrompt||"You are a helpful assistant.",input:N,text:{verbosity:Z?.textVerbosity||"low"},include:["reasoning.encrypted_content"],prompt_cache_key:$,tool_choice:Z?.toolChoice??"auto",parallel_tool_calls:!0};if(Z?.temperature!==void 0)V.temperature=Z.temperature;if(Z?.serviceTier!==void 0)V.service_tier=Z.serviceTier;if(G.immediate.length>0)V.tools=WJ(G.immediate,{strict:null,supportsStrictMode:F,supportsOpenAIGrammarTools:Y});if(Z?.reasoningEffort!==void 0){let K=Z.reasoningEffort==="none"?J.thinkingLevelMap?.off??"none":J.thinkingLevelMap?.[Z.reasoningEffort]??Z.reasoningEffort;if(K!==null)V.reasoning={effort:K,summary:Z.reasoningSummary??"auto"}}return V}function eJ(J,Q){switch(Q){case"flex":return 0.5;case"priority":return J.id==="gpt-5.5"?2.5:2;default:return 1}}function RJ(J,Q,Z){let $=eJ(Z,Q);if($===1)return;J.cost.input*=$,J.cost.output*=$,J.cost.cacheRead*=$,J.cost.cacheWrite*=$,J.cost.total=J.cost.input+J.cost.output+J.cost.cacheRead+J.cost.cacheWrite}function AJ(J,Q){if(J==="default"&&(Q==="flex"||Q==="priority"))return Q;return J??Q}function qJ(J){let Z=(J&&J.trim().length>0?J:kJ).replace(/\/+$/,"");if(Z.endsWith("/codex/responses"))return Z;if(Z.endsWith("/codex"))return`${Z}/responses`;return`${Z}/codex/responses`}function JQ(J){let Q=new URL(qJ(J));if(Q.protocol==="https:")Q.protocol="wss:";if(Q.protocol==="http:")Q.protocol="ws:";return Q.toString()}async function QQ(J,Q,Z,$,X,F){await r(HJ(NQ(J,F?.signal)),Q,Z,$,{serviceTier:F?.serviceTier,grammarToolInputProperties:X,resolveServiceTier:AJ,applyServiceTierPricing:(Y,G)=>RJ(Y,G,$)})}class T extends Error{code;payload;constructor(J,Q){super(J);this.name="CodexApiError",this.code=Q?.code,this.payload=Q?.payload,this.cause=Q?.cause}}class m extends Error{payload;constructor(J,Q){super(J);this.name="CodexProtocolError",this.payload=Q?.payload,this.cause=Q?.cause}}function ZQ(J){return J instanceof T||J instanceof m}function $Q(J){return J instanceof T&&J.code===pJ}function FQ(J){return J instanceof T&&J.code===cJ}function XQ(J){let Q=J.error&&typeof J.error==="object"?J.error:void 0;return{code:typeof J.code==="string"?J.code:typeof Q?.code==="string"?Q.code:void 0,message:typeof J.message==="string"?J.message:typeof Q?.message==="string"?Q.message:void 0}}async function*HJ(J){for await(let Q of J){let Z=typeof Q.type==="string"?Q.type:void 0;if(!Z)continue;if(Z==="error"){let{code:$,message:X}=XQ(Q);throw new T(`Codex error: ${X||$||JSON.stringify(Q)}`,{code:$,payload:Q})}if(Z==="response.failed"){let $=Q.response,X=$?.error?.code,F=$?.error?.message;throw new T(F||"Codex response failed",{code:X,payload:Q})}if(Z==="response.done"||Z==="response.completed"||Z==="response.incomplete"){let $=Q.response,X=$?{...$,status:YQ($.status)}:$;yield{...Q,type:"response.completed",response:X};return}yield Q}}function YQ(J){if(typeof J!=="string")return;return lJ.has(J)?J:void 0}async function*NQ(J,Q){if(!J.body)return;let Z=J.body.getReader(),$=new TextDecoder,X="",F=()=>{Z.cancel().catch(()=>{})};Q?.addEventListener("abort",F,{once:!0});try{while(!0){if(Q?.aborted)throw Error("Request was aborted");let{done:Y,value:G}=await Z.read();if(Q?.aborted)throw Error("Request was aborted");if(Y)break;X+=$.decode(G,{stream:!0});let N=X.indexOf(`
|
|
3
3
|
|
|
4
4
|
`);while(N!==-1){let V=X.slice(0,N);X=X.slice(N+2);let K=V.split(`
|
|
5
5
|
`).filter((D)=>D.startsWith("data:")).map((D)=>D.slice(5).trim());if(K.length>0){let D=K.join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{B as
|
|
1
|
+
import{Ne as A}from"./chunk-tsym31yb.js";import{Ai as z,_h as v,pi as w}from"./chunk-yfgwknpa.js";var B=(b)=>({queryKey:["projects",b],queryFn:async()=>{let h=await z.api.projects[":projectId"].$get({param:{projectId:b}});if(!h.ok)throw Error("Failed to fetch project");return await h.json()}}),H=w("/projects/$projectId/shares/$shareId")({loader:({context:{queryClient:b},params:{projectId:h}})=>b.ensureQueryData(B(h)),pendingComponent:()=>v(A,{})});
|
|
2
|
+
export{B as ae,H as be};
|