@qitqode/qitqode-android-arm64 0.2.14 → 0.2.15
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/bun +2 -2
- package/bundle/{chunk-6wmtbebc.js → chunk-2fged9vy.js} +1 -1
- package/bundle/{chunk-358wdvj7.js → chunk-2pw56zpj.js} +1 -1
- package/bundle/{chunk-6kch0q2d.js → chunk-2tkgtasa.js} +1 -1
- package/bundle/{chunk-07b4pkk6.js → chunk-4b56k59w.js} +1 -1
- package/bundle/{chunk-47jkx37s.js → chunk-4gzggzc0.js} +1 -1
- package/bundle/{chunk-fpzkyzny.js → chunk-4jfnhghx.js} +1 -1
- package/bundle/{chunk-4hvenszg.js → chunk-4xcwnwd6.js} +1 -1
- package/bundle/{chunk-1mfdmm2t.js → chunk-4yd2vvh6.js} +1 -1
- package/bundle/{chunk-y1v7mf1a.js → chunk-5asf8f41.js} +72 -72
- package/bundle/chunk-5re7995e.js +2 -0
- package/bundle/{chunk-nrzca9yd.js → chunk-6k0y2332.js} +1 -1
- package/bundle/{chunk-pp10epga.js → chunk-6qwnty59.js} +1 -1
- package/bundle/{chunk-fd04358e.js → chunk-6zdzbmzs.js} +298 -297
- package/bundle/{chunk-2w79k0mh.js → chunk-76wm7tw8.js} +1 -1
- package/bundle/{chunk-k6gdmqff.js → chunk-7t63wz2f.js} +1 -1
- package/bundle/{chunk-hx13a8es.js → chunk-83n11xym.js} +1 -1
- package/bundle/{chunk-e8s4mp5n.js → chunk-878sb0es.js} +1 -1
- package/bundle/{chunk-4p9fny77.js → chunk-8mqcar7f.js} +1 -1
- package/bundle/{chunk-j1bv93m4.js → chunk-ae1b15bd.js} +1 -1
- package/bundle/{chunk-avzaqy6a.js → chunk-apneazwv.js} +1 -1
- package/bundle/{chunk-gnh8c49b.js → chunk-aw5yv01t.js} +1 -1
- package/bundle/{chunk-1gdt9q05.js → chunk-b6m5tr80.js} +1 -1
- package/bundle/{chunk-7xc73qb1.js → chunk-baq0wk3q.js} +1 -1
- package/bundle/{chunk-ffz334ab.js → chunk-c1wc4b5q.js} +1 -1
- package/bundle/{chunk-2ascwm7j.js → chunk-csy1v12x.js} +1 -1
- package/bundle/{chunk-9z7y4x7q.js → chunk-djdfpezf.js} +1 -1
- package/bundle/{chunk-9zsp3qkh.js → chunk-dpbm03yh.js} +1 -1
- package/bundle/{chunk-7a4sb6q7.js → chunk-e37gd3p2.js} +1 -1
- package/bundle/{chunk-bga4kqd1.js → chunk-estc7tzt.js} +1 -1
- package/bundle/{chunk-9gxyt2ay.js → chunk-f0x3q5dj.js} +1 -1
- package/bundle/{chunk-vnstr4g1.js → chunk-ffynh19k.js} +1 -1
- package/bundle/{chunk-y3dpyz2d.js → chunk-fgr9xshx.js} +1 -1
- package/bundle/{chunk-qpggztkq.js → chunk-fswt9qc0.js} +1 -1
- package/bundle/{chunk-2g4kxtz0.js → chunk-gww6abk3.js} +1 -1
- package/bundle/{chunk-qqsj69m2.js → chunk-h6b5966p.js} +1 -1
- package/bundle/{chunk-jvx7jtm4.js → chunk-hmm0gj34.js} +1 -1
- package/bundle/{chunk-8b9z8j3z.js → chunk-hmmn62jg.js} +1 -1
- package/bundle/{chunk-26e51217.js → chunk-j89sv999.js} +1 -1
- package/bundle/{chunk-05bkxat0.js → chunk-k4wfq9cn.js} +1 -1
- package/bundle/{chunk-n6pn4f3r.js → chunk-k8dbc1p5.js} +1 -1
- package/bundle/{chunk-9thgxbze.js → chunk-k9b4005p.js} +1 -1
- package/bundle/{chunk-9znfb8f2.js → chunk-kegvr7wt.js} +1 -1
- package/bundle/{chunk-00r3he5x.js → chunk-kht2kwam.js} +1 -1
- package/bundle/{chunk-gkf7x1yj.js → chunk-knqpyc7s.js} +1 -1
- package/bundle/chunk-mdxtt9wv.js +8 -0
- package/bundle/{chunk-8jkqyf9n.js → chunk-mnjz8nqs.js} +1 -1
- package/bundle/{chunk-zpjtse0z.js → chunk-mq3w4z8k.js} +2 -2
- package/bundle/{chunk-0ks20gz1.js → chunk-mreacz8r.js} +1 -1
- package/bundle/{chunk-ykvgmje9.js → chunk-n4qbnecw.js} +1 -1
- package/bundle/{chunk-gvf6ek9f.js → chunk-pqzx9ha6.js} +1 -1
- package/bundle/{chunk-kdqhwa65.js → chunk-q896qkhe.js} +1 -1
- package/bundle/{chunk-ngygp66y.js → chunk-qk6jh32z.js} +1 -1
- package/bundle/{chunk-6d4xc6br.js → chunk-rk4c0zat.js} +1 -1
- package/bundle/{chunk-dn0437c1.js → chunk-rt49c6js.js} +1 -1
- package/bundle/{chunk-34yk99ep.js → chunk-tkbjcznz.js} +1 -1
- package/bundle/{chunk-7s9msscb.js → chunk-vgmgg994.js} +1 -1
- package/bundle/{chunk-chnr7pe5.js → chunk-vsv4p060.js} +1 -1
- package/bundle/{chunk-vzkdzhn0.js → chunk-w0t1ajhg.js} +1 -1
- package/bundle/{chunk-w4fr00s7.js → chunk-wne3v1fk.js} +1 -1
- package/bundle/{chunk-w214dwws.js → chunk-wyavgt96.js} +1 -1
- package/bundle/{chunk-ae1g5y4r.js → chunk-xxck1man.js} +1 -1
- package/bundle/{chunk-g738e799.js → chunk-y4cz5s3h.js} +1 -1
- package/bundle/{chunk-583d91xq.js → chunk-yhpwceqg.js} +1 -1
- package/bundle/{chunk-y5ydtbpd.js → chunk-yms3bsm7.js} +1 -1
- package/bundle/{chunk-wmj3xndt.js → chunk-ytfq6rn9.js} +1 -1
- package/bundle/{chunk-qz20b42s.js → chunk-yvtkx4x4.js} +1 -1
- package/bundle/{chunk-jwv6fda1.js → chunk-ywj77e0m.js} +1 -1
- package/bundle/{chunk-y18ptwk2.js → chunk-z93n3cbm.js} +1 -1
- package/bundle/{chunk-6y0wgz2j.js → chunk-zbt53cb5.js} +1 -1
- package/bundle/{chunk-bm8azfnt.js → chunk-zhhcfqhh.js} +1 -1
- package/bundle/{chunk-2q78bdtj.js → chunk-zwxp07yc.js} +1 -1
- package/bundle/index.js +3 -3
- package/bundle/worker.js +1 -1
- package/package.json +1 -1
- package/bundle/chunk-1a08ffyd.js +0 -2
- package/bundle/chunk-jvvctqjd.js +0 -8
package/bundle/worker.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{eg as V}from"./chunk-5rvvfgfy.js";import{jg as x}from"./chunk-
|
|
2
|
+
import{eg as V}from"./chunk-5rvvfgfy.js";import{jg as x}from"./chunk-y4cz5s3h.js";import"./chunk-yhpwceqg.js";import"./chunk-878sb0es.js";import"./chunk-f0x3q5dj.js";import"./chunk-5qhsfjzq.js";import"./chunk-nfg7nt13.js";import"./chunk-4s1n38ds.js";import"./chunk-76wm7tw8.js";import{$g as S,Ah as O}from"./chunk-6zdzbmzs.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import{cl as Z,vj as Y}from"./chunk-5asf8f41.js";import{el as N}from"./chunk-2pw56zpj.js";import{Ml as q,pl as P}from"./chunk-rt49c6js.js";import"./chunk-4gzggzc0.js";import"./chunk-31a47ptm.js";import"./chunk-ywj77e0m.js";import"./chunk-83n11xym.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-ae1b15bd.js";import"./chunk-6qwnty59.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-kegvr7wt.js";import"./chunk-2tkgtasa.js";import"./chunk-6cztstry.js";import{Js as z}from"./chunk-4yd2vvh6.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import{bt as C}from"./chunk-06tgmvh6.js";import"./chunk-fdmz0502.js";import"./chunk-5re7995e.js";import{Et as j,ft as X,it as G}from"./chunk-mnjz8nqs.js";import"./chunk-6yshpz0z.js";import{Pt as T,Yt as W}from"./chunk-5dvy83ms.js";import"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import"./chunk-sh03ka27.js";var $=W.create({service:"upgrade"});function k(D,E){if(D===!1)return"disabled";if(D===!0&&E==="patch")return"install";return"notify"}async function M(){if(G)return;let D=await O.runPromise(Z.Service.use((J)=>J.getGlobal())),E=await O.runPromise(N.Service.use((J)=>J.method())),K=await O.runPromise(N.Service.use((J)=>J.latest(E))).catch((J)=>{$.warn("failed to check for updates",{method:E,error:String(J)})});if(!K)return;if(!N.isNewerVersion(X,K)){$.warn("ignoring non-newer update version",{current:X,latest:K});return}if(T.QITQODE_ALWAYS_NOTIFY_UPDATE){await Y.publish(N.Event.UpdateAvailable,{version:K});return}if(T.QITQODE_DISABLE_AUTOUPDATE)return;let _=N.getReleaseType(X,K),Q=k(D.autoupdate,_);if(Q==="disabled")return;if(Q==="notify"){await Y.publish(N.Event.UpdateAvailable,{version:K});return}if(E==="unknown")return;await O.runPromise(N.Service.use((J)=>J.upgrade(E,K))).then(()=>Y.publish(N.Event.Updated,{version:K})).catch((J)=>{$.warn("auto-upgrade failed",{method:E,target:K,error:String(J)})})}import{writeHeapSnapshot as w}from"v8";j("worker");await W.init({print:process.argv.includes("--print-logs"),dev:N.isLocal(),level:(()=>{if(N.isLocal())return"DEBUG";return"INFO"})()});V.start();C("worker");P.on("event",(D)=>{z.emit("global.event",D)});var U,H={async ping(){return"pong"},async fetch(D){let E={...D.headers},K=L();if(K&&!E.authorization&&!E.Authorization)E.Authorization=K;let _=new Request(D.url,{method:D.method,headers:E,body:D.body}),Q=await x.Default().app.fetch(_),J=await Q.text();return{status:Q.status,headers:Object.fromEntries(Q.headers.entries()),body:J}},snapshot(){return w("server.heapsnapshot")},async server(D){if(U)await U.stop(!0);return U=await x.listen(D),{url:U.url.toString()}},async checkUpgrade(D){await q.provide({directory:D.directory,init:()=>O.runPromise(S),fn:async()=>{await M().catch(()=>{})}})},async reload(){await O.runPromise(Z.Service.use((D)=>D.invalidate(!0)))},async shutdown(){if(W.Default.info("worker shutting down"),await q.disposeAll(),U)await U.stop(!0)}};z.listen(H);function L(){let D=T.QITQODE_SERVER_PASSWORD;if(!D)return;let E=T.QITQODE_SERVER_USERNAME??"qitqode";return`Basic ${btoa(`${E}:${D}`)}`}export{H as rpc};
|
package/package.json
CHANGED
package/bundle/chunk-1a08ffyd.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{zt as Y}from"./chunk-8jkqyf9n.js";import{Lt as p,Mt as B,Nt as O,Ot as G}from"./chunk-5dvy83ms.js";import{wP as N}from"./chunk-sh03ka27.js";var $={free:{providerID:"qlex",modelID:"free"},adaptive:{providerID:"qlex",modelID:"adaptive"},fast:{providerID:"qlex",modelID:"fast"},economical:{providerID:"qlex",modelID:"economical"},planner:{providerID:"qlex",modelID:"planner"},repair:{providerID:"qlex",modelID:"repair"},"max-int":{providerID:"qlex",modelID:"max-int"},orchestrated:{providerID:"qlex",modelID:"orchestrated"}},X=["free","fast","economical","adaptive","planner","repair","max-int","orchestrated"],Q=new Set(["decisions","quick-decisions"]);function u(x){let J=x?.split("/").at(-1);return J!==void 0&&Q.has(J)}var V={free:"Free (no cost)",adaptive:"Adaptive",fast:"Fast",economical:"Economy",planner:"Planner",repair:"Repair","max-int":"Max intelligence",orchestrated:"Orchestrated"},M={free:{output:128000,recommendedStep:32000,context:262144,reasoning:!0,reasoningReserve:8192,visibleOutputFloor:512,recommendedTotal:9600,viableTotalFloor:9600},fast:{output:65536,recommendedStep:50000,context:1048576,reasoning:!1,reasoningReserve:0,visibleOutputFloor:2048,recommendedTotal:50000,viableTotalFloor:2048},economical:{output:209715,recommendedStep:32000,context:1048576,reasoning:!0,reasoningReserve:8192,visibleOutputFloor:512,recommendedTotal:9600,viableTotalFloor:9600},adaptive:{output:128000,recommendedStep:32000,context:1050000,reasoning:!0,reasoningReserve:8192,visibleOutputFloor:2048,recommendedTotal:32000,viableTotalFloor:2048},planner:{output:128000,recommendedStep:32000,context:1050000,reasoning:!1,reasoningReserve:0,visibleOutputFloor:2048,recommendedTotal:32000,viableTotalFloor:2048},repair:{output:128000,recommendedStep:32000,context:1050000,reasoning:!1,reasoningReserve:0,visibleOutputFloor:2048,recommendedTotal:32000,viableTotalFloor:2048},"max-int":{output:128000,recommendedStep:32000,context:1e6,reasoning:!0,reasoningReserve:8192,visibleOutputFloor:2048,recommendedTotal:32000,viableTotalFloor:2048},orchestrated:{output:128000,recommendedStep:32000,context:200000,reasoning:!1,reasoningReserve:0,visibleOutputFloor:2048,recommendedTotal:32000,viableTotalFloor:2048}},H={},F="pending",P=new Set;function h(){return F}function b(){F="pending",w()}function y(x){return P.add(x),()=>P.delete(x)}function w(){for(let x of[...P])try{x()}catch{}}function q(){for(let x of Object.keys(H))delete H[x];F="unavailable",w()}function f(x){return typeof x==="number"&&Number.isFinite(x)&&x>=0&&x<=10}function c(x){if(x===void 0){q();return}let J=x!==null&&typeof x==="object"&&!Array.isArray(x)?x:void 0;if(J?.success===!1){q();return}let j=J?.success===!0&&Object.prototype.hasOwnProperty.call(J,"data")?J.data:x,W={};if(j===null||typeof j!=="object"||Array.isArray(j)){q();return}for(let[K,Z]of Object.entries(j)){if(!Z||typeof Z!=="object"||Array.isArray(Z)){q();return}let z=Z;if(!f(z.intelligence)||!f(z.speed)||!f(z.cost)){q();return}W[K]={intelligence:z.intelligence,speed:z.speed,cost:z.cost}}for(let K of Object.keys(H))delete H[K];Object.assign(H,W),F="live",w()}function C(x){if(!Array.isArray(x)||x.length===0)return;let J=x.filter((K)=>!Q.has(K.id));if(J.length===0){for(let K of Q)delete $[K],delete V[K];return}let j={},W={};for(let K of J){let Z=$[K.id],z=K.modelID??Z?.modelID??K.id;j[K.id]={providerID:K.providerID??Z?.providerID??"qlex",modelID:u(z)?Z?.modelID??K.id:z},W[K.id]=K.label??V[K.id]??K.id}for(let K of Object.keys($))delete $[K];Object.assign($,j);for(let K of Object.keys(V))delete V[K];Object.assign(V,W)}var D={};N(D,{tiers:()=>d,tierRatingsState:()=>h,tierRatings:()=>E,tierBudgetFacts:()=>v,streamUrl:()=>m,streamBaseUrl:()=>R,sanitizeUpstreamError:()=>s,qlexProviderMeta:()=>n,onTierRatingsChange:()=>y,omniqueryBaseUrl:()=>l,mergeLiveTiers:()=>o,mergeLiveTierRatings:()=>_,markTierRatingsUnavailable:()=>q,loadLiveRatings:()=>S,isDecisionTier:()=>k,evaluatePermission:()=>I,copy:()=>r,beginTierRatingsLoad:()=>b,bashPrefixWith:()=>T,assertChatTierSupported:()=>g,TIER_RATINGS:()=>H,AGENT_PROMPT_NAMES:()=>a});var U=3,L=[250,750];async function S(x){for(let J=0;J<U;J++){let j=await x();if(j!==void 0)return j;let W=L[J];if(W!==void 0)await new Promise((K)=>setTimeout(K,W))}return}function o(x){C(x)}function _(x){c(x)}function d(){let x=new Set(X);return[...X.filter((j)=>$[j]!==void 0),...Object.keys($).filter((j)=>!x.has(j))].flatMap((j)=>{if(Q.has(j))return[];let W=$[j];if(!W)return[];return[{id:j,label:V[j]??j,providerID:W.providerID,modelID:W.modelID}]})}function v(x){return M[x]}function E(){return H}function k(x){let J=x.startsWith("qlex/")?x.slice(5):x;return Q.has(J)}function g(x){if(k(x))throw Error(`Tier "${x}" is not available for chat. QitQode does not use decision-only models. Use one of the available chat tiers: ${X.join(", ")}.`);if(!$[x])throw Error(`Tier "${x}" is not a recognized chat tier. Available chat tiers: ${X.join(", ")}.`)}function I(x,J,...j){return j.flat().findLast((Z)=>Y(x,Z.permission)&&Y(J,Z.pattern))??{action:"ask",permission:x,pattern:"*"}}function T(x,J){for(let j=J.length;j>0;j--){let W=J.slice(0,j).join(" "),K=x[W];if(K!==void 0)return J.slice(0,K)}if(J.length===0)return[];return J.slice(0,1)}function A(){return(process.env.QITQODE_BACKEND_URL?.trim()||p).replace(/\/+$/,"")}function m(){return`${A()}/streamTier`}function R(){return new URL(m()).origin}function l(){return A()}function n(){return B}function s(x){return O(x)}function r(){return G}var a=["generate","explore","dream","distill","summary","compaction","title"];export{$ as dt,D as et};
|
package/bundle/chunk-jvvctqjd.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{a as $B,b as zB}from"./chunk-6d4xc6br.js";import"./chunk-6y0wgz2j.js";import"./chunk-rn3je2hv.js";import{B as VB,C as XB}from"./chunk-tz1sv9kt.js";import{D as BB,F as JB}from"./chunk-ajyfms68.js";import"./chunk-9z7y4x7q.js";import{aa as YB,ba as ZB}from"./chunk-6j53vtzd.js";import"./chunk-p0852vfn.js";import"./chunk-ej0yzstw.js";import{fe as e}from"./chunk-w8nj5ph5.js";import{Xf as p,Yf as w,Zf as O,_f as g}from"./chunk-bga4kqd1.js";import{cg as z}from"./chunk-psmwrvqs.js";import{Eg as t}from"./chunk-9gxyt2ay.js";import{Ah as x}from"./chunk-fd04358e.js";import"./chunk-qn1fhqyw.js";import"./chunk-674pexjx.js";import"./chunk-zjyaze0d.js";import"./chunk-xdcwx384.js";import"./chunk-rd08wx37.js";import"./chunk-fp2xgnjn.js";import{Pj as n,Sk as r,wj as A}from"./chunk-y1v7mf1a.js";import"./chunk-358wdvj7.js";import{Ll as T}from"./chunk-dn0437c1.js";import"./chunk-47jkx37s.js";import"./chunk-31a47ptm.js";import"./chunk-jwv6fda1.js";import"./chunk-hx13a8es.js";import"./chunk-h036zy9e.js";import"./chunk-j3agzs13.js";import"./chunk-3152y1q9.js";import"./chunk-71jmhvef.js";import"./chunk-qrztx1b4.js";import"./chunk-j1bv93m4.js";import{Yo as o,cp as a,rp as s}from"./chunk-pp10epga.js";import"./chunk-crqycrs4.js";import"./chunk-1bq15kf0.js";import"./chunk-pdcxmr6x.js";import"./chunk-cqtkxwd8.js";import"./chunk-a1mbach4.js";import"./chunk-m6967jtv.js";import"./chunk-j2snkw45.js";import"./chunk-bmdqb48f.js";import"./chunk-3cs1qf8x.js";import"./chunk-4xqwt6dr.js";import"./chunk-g77kddrs.js";import"./chunk-9znfb8f2.js";import"./chunk-6kch0q2d.js";import"./chunk-6cztstry.js";import{Is as i}from"./chunk-1mfdmm2t.js";import"./chunk-fkq0v5qv.js";import"./chunk-1e75j4m1.js";import"./chunk-2w3n0q9m.js";import"./chunk-6dd2dx69.js";import"./chunk-fdmz0502.js";import{dt as d}from"./chunk-1a08ffyd.js";import{Bt as f,Ct as c,Dt as u,Ft as l}from"./chunk-8jkqyf9n.js";import{Jt as L}from"./chunk-6yshpz0z.js";import{St as P}from"./chunk-5dvy83ms.js";import{eu as E,gu as y}from"./chunk-ffx0cr44.js";import"./chunk-33mzqyyb.js";import"./chunk-sg9enzsp.js";import"./chunk-5q98z8ck.js";import"./chunk-wfpnv00c.js";import{gI as N}from"./chunk-9kc2th5c.js";import"./chunk-hf39qx6t.js";import"./chunk-x0de4z05.js";import{yP as k}from"./chunk-sh03ka27.js";import D from"path";import{fileURLToPath as MB}from"url";import{writeHeapSnapshot as GB}from"v8";import QB,{EOL as M}from"os";var WB={free:"free",adaptive:"adaptive",fast:"fast",economical:"economical",maxInt:"max-int",orchestrated:"orchestrated"},m=ZB;function R(B){if(B.agent)return B.agent;return m}function bB(B,J){if(D.isAbsolute(B)||B.includes("/")||B.includes("\\")||B.startsWith(".")||B.startsWith("~"))return{error:"Directory not found: "+J};return{error:`Unknown command "${B}"`,hint:"Run `qitqode --help` to see the available commands, or pass an existing directory to start the TUI there."}}function jB(B){for(let[J,Z]of Object.entries(WB))if(B[J]){let X=d[Z];if(X)return`${X.providerID}/${X.modelID}`}return}function FB(B){return async(Z,X)=>{let G=new Request(Z,X),Y=G.body?await G.text():void 0,H=await B.call("fetch",{url:G.url,method:G.method,headers:Object.fromEntries(G.headers.entries()),body:Y});return new Response(H.body,{status:H.status,headers:H.headers})}}function _B(B){return{subscribe:async(J)=>{return B.on("global.event",(Z)=>{J(Z)})}}}async function qB(){if(typeof globalThis.QITQODE_WORKER_PATH<"u")return globalThis.QITQODE_WORKER_PATH;let B=new URL("./cli/cmd/tui/worker.js",import.meta.url);if(await E(MB(B)))return B;return new URL("./worker.ts",import.meta.url)}async function yB(B){let J=process.stdin.isTTY?void 0:await Bun.stdin.text();if(!B)return J;if(!J)return B;return J+`
|
|
3
|
-
`+B}async function v(B){let J=o({baseUrl:B.url,fetch:B.fetch,directory:B.directory}),Z=[{permission:"question",action:"deny",pattern:"*"},{permission:"plan_enter",action:"deny",pattern:"*"},{permission:"plan_exit",action:"deny",pattern:"*"}],X=await XB(J.session,B)??(await J.session.create({permission:Z})).data?.id;if(!X){z.error("headless: failed to create session");return}let G=await J.event.subscribe(),Y=YB({sessionID:X,query:async()=>{return(await J.session.status()).data?.[X]}}),H=G.stream[Symbol.asyncIterator](),U=Y.completion.then(()=>"DONE");(async()=>{try{while(!0){let Q=await Promise.race([H.next(),U]);if(Q==="DONE")break;let K=Q;if(K.done)break;let b=K.value;Y.onEvent(b);let W=b.properties;if(b.type==="message.part.updated"){let $=W?.part;if(!$||$.sessionID!==X)continue;if($.type==="text"&&$.time?.end){let V=String($.text??"").trim();if(V)process.stdout.write(V+M)}}if(b.type==="permission.asked"){if(!W||W.sessionID!==X)continue;await J.permission.reply({requestID:String(W.id),reply:"once"})}if(b.type==="session.error"){if(!W||W.sessionID!==X||!W.error)continue;let $=W.error,V=$?.data!==null&&typeof $?.data==="object"&&"message"in $.data?String($.data.message):String($?.name??$);z.error(V)}}}finally{Y.stop(),await H.return?.(void 0).catch(()=>{})}})().catch((Q)=>{console.error(Q),process.exit(1)});let h=B.model?r.parseModel(B.model):void 0;await J.session.prompt({sessionID:X,agent:B.agent,model:h,parts:[{type:"text",text:B.prompt}]}),Y.markStarted(),await Y.completion}var sB=e({command:"$0 [project]",describe:"start qitqode tui",builder:(B)=>p(B).positional("project",{type:"string",describe:"path to start qitqode in"}).options(g).option("never-ask",{type:"boolean",describe:"start in never-ask mode \u2014 auto-decide without asking (permissions excluded), toggle at runtime with /never-ask",default:!1}).check((J)=>{if(J.dark&&J.light)throw Error("--dark and --light are mutually exclusive");if(J.sso&&!J.headless)throw Error("--sso requires --headless");if(J.sso&&J["api-key"]!==void 0)throw Error("--sso and --api-key are mutually exclusive");let Z=Object.keys(WB).filter((X)=>J[X]);if(Z.length>1)throw Error(`${Z.map((X)=>`--${X}`).join(" and ")} are mutually exclusive \u2014 choose one tier flag`);if(Z.length===1&&J.model)throw Error(`--${Z[0]} and --model are mutually exclusive \u2014 use one or the other`);return!0}),handler:async(B)=>{if(B.monochrome)process.env.QITQODE_TUI_ACCESSIBLE="1",process.env.NO_COLOR="1";let J=JB();try{BB();let Z=VB(B);if(Z){z.error(Z),process.exitCode=1;return}let X=jB(B)??B.model,G=y(process.env.PWD??process.cwd()),Y=B.project?y(D.isAbsolute(B.project)?B.project:D.join(G,B.project)):y(process.cwd());if(B.project&&!await E(Y)){let V=bB(B.project,Y);if(z.error(V.error),V.hint)z.println(V.hint);process.exitCode=1;return}let H=T(Y);if(H){if(B.project){z.error("Cannot start in "+Y+": "+H),process.exitCode=1;return}let V=y(QB.homedir());if(T(V)){z.error("Cannot start in "+Y+": "+H),process.exitCode=1;return}P.warn("unsafe start directory, falling back to home",{requested:Y,home:V}),Y=V}let U=await qB();try{process.chdir(Y)}catch{z.error("Failed to change directory to "+Y);return}let C=y(process.cwd()),h=l({[c]:"worker",[f]:u()}),Q=new Worker(U,{env:h});Q.onerror=(V)=>{P.error("thread error",{message:V.message,filename:V.filename,lineno:V.lineno,colno:V.colno,error:V.error})};let K=i(Q),b=()=>{K.call("reload",void 0).catch((V)=>{P.warn("worker reload failed",{error:L(V)})})};process.on("SIGUSR2",b);let W=!1,$=async()=>{if(W)return;W=!0,process.off("SIGUSR2",b),await n(K.call("shutdown",void 0),5000).catch((V)=>{P.warn("worker shutdown failed",{error:L(V)})}),Q.terminate()};try{let V=import("./chunk-2g4kxtz0.js"),HB=import("./chunk-vnstr4g1.js").then(({TuiConfig:q})=>q.get()),S=await yB(B.prompt),KB=await HB;if(B.headless&&w(O(B))){z.error("--headless cannot be combined with network-listener flags (--port, --hostname, --mdns)"),process.exitCode=1;return}let I=O(B),_=w(I)?{url:(await K.call("server",I)).url,fetch:void 0,events:void 0}:{url:"http://qitqode.internal",fetch:FB(K),events:_B(K)};if(setTimeout(()=>{K.call("checkUpgrade",{directory:C}).catch(()=>{})},1000).unref?.(),B.headless){if(!S){z.error("--headless requires a prompt: pass --prompt or pipe input via stdin"),process.exitCode=1;return}if(B.sso){try{let j=await t({tryOpen:!1,onCode:(F)=>{if(process.stdout.write(M),process.stdout.write(" To sign in, open: "+F.verificationUri+M),process.stdout.write(" and enter code: "+F.userCode+M),F.verificationUriComplete)process.stdout.write(M+" Or open this link directly:"+M+" "+F.verificationUriComplete+M);process.stdout.write(M+" Waiting for approval... (ctrl+c to cancel)"+M)}});await x.runPromise(N.gen(function*(){yield*(yield*A.Service).set("forgewise",s(j,{rotateRefreshToken:!0}))})),process.stdout.write(" Signed in as "+(j.name||j.email)+M)}catch(j){z.error("SSO sign-in failed: "+L(j)),process.exitCode=1;return}await v({url:_.url,fetch:_.fetch,prompt:S,model:X,agent:R(B)??m,directory:C,continue:B.continue,sessionID:B.session,fork:B.fork});return}let q=$B(typeof B["api-key"]==="string"?String(B["api-key"]):"");if(q)await x.runPromise(zB(q));else if(!await x.runPromise(N.gen(function*(){if(yield*N.promise(()=>a()))return!0;return!!(yield*(yield*A.Service).get("forgewise"))}))){z.error(`Not signed in. Use one of:
|
|
4
|
-
qitqode auth login (browser / device-code flow)
|
|
5
|
-
qitqode auth login --api-key (paste a Qortex API key)
|
|
6
|
-
--api-key <key> (inline for this run)
|
|
7
|
-
$QLEX_API_KEY (environment variable)
|
|
8
|
-
$QITQODE_KEY (environment variable)`),process.exitCode=1;return}await v({url:_.url,fetch:_.fetch,prompt:S,model:X,agent:R(B)??m,directory:C,continue:B.continue,sessionID:B.session,fork:B.fork})}else{let{tui:q}=await V;await q({url:_.url,async onSnapshot(){let j=GB("tui.heapsnapshot"),F=await K.call("snapshot",void 0);return[j,F]},config:KB,directory:C,fetch:_.fetch,events:_.events,args:{continue:B.continue,sessionID:B.session,agent:R(B),model:X,prompt:S,fork:B.fork,neverAsk:B["never-ask"]||B.fullauto||!1,fullauto:B.fullauto||!1,themeMode:B.dark?"dark":B.light?"light":void 0,monochrome:B.monochrome||!1,headless:!1}})}}finally{await $()}}finally{J?.()}}});export{R as resolveStartupAgent,bB as missingProjectReport,sB as TuiThreadCommand};
|