xling 0.9.3 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/{base-ByGb-buX.js → base-CEyMUsWC.js} +1 -1
- package/dist/{claude-CZjzo_vw.js → claude-D9MrNBhj.js} +1 -1
- package/dist/{cli-mode-Dwno4mFu.js → cli-mode-Bf47_bgy.js} +1 -1
- package/dist/codex-D6DXh3qW.js +1 -0
- package/dist/commands/council/index.js +1 -1
- package/dist/commands/discuss/index.js +1 -1
- package/dist/commands/git/prc.js +1 -1
- package/dist/commands/git/prr.js +1 -1
- package/dist/commands/git/prv.js +1 -1
- package/dist/commands/git/worktree.js +1 -1
- package/dist/commands/git/wta.js +1 -1
- package/dist/commands/git/wtl.js +1 -1
- package/dist/commands/git/wtp.js +1 -1
- package/dist/commands/git/wtr.js +1 -1
- package/dist/commands/git/wts.js +1 -1
- package/dist/commands/p/index.js +1 -1
- package/dist/commands/proxy/index.js +1 -1
- package/dist/commands/settings/auth.js +1 -1
- package/dist/commands/settings/get.js +1 -1
- package/dist/commands/settings/inspect.js +1 -1
- package/dist/commands/settings/list.js +3 -2
- package/dist/commands/settings/set.js +1 -1
- package/dist/commands/settings/switch.js +1 -1
- package/dist/commands/settings/sync.js +1 -1
- package/dist/commands/sx/index.js +1 -1
- package/dist/commands/version/index.js +1 -1
- package/dist/{config-DhyjcFWC.d.ts → config-CZ03ghwF.d.ts} +4 -0
- package/dist/config-FuKh2Fd0.js +1 -0
- package/dist/{create-DB4bq8QJ.js → create-DCRzCnyk.js} +1 -1
- package/dist/{dispatcher-lVQvxVFN.js → dispatcher-Dpcz8jAO.js} +1 -1
- package/dist/{dispatcher-BXgtQGot.js → dispatcher-o1x1DtvC.js} +1 -1
- package/dist/domain/xling/config.d.ts +1 -1
- package/dist/domain/xling/config.js +1 -1
- package/dist/domain/xling/template.d.ts +1 -1
- package/dist/{engine-CcJYqeBF.d.ts → engine-C35P2p3k.d.ts} +1 -1
- package/dist/{errorClassifier-CaWTVD6J.d.ts → errorClassifier-BGYR4YzP.d.ts} +1 -1
- package/dist/{gemini-MJF_2wHM.js → gemini-4dzAg7tf.js} +1 -1
- package/dist/{loadBalancer-siiWIAn5.d.ts → loadBalancer-CvpnwHns.d.ts} +2 -2
- package/dist/{pr-BTXjfqhU.js → pr-BbiioEzE.js} +1 -1
- package/dist/{providerRegistry-GGyWVdUI.js → providerRegistry-C_6DDXNa.js} +1 -1
- package/dist/{providerRegistry-D4Oi53ij.d.ts → providerRegistry-DG8Nc-Jc.d.ts} +1 -1
- package/dist/{router-DM5UlqKd.d.ts → router-C6XdK2_5.d.ts} +2 -2
- package/dist/router-XRA1VbiH.js +6 -0
- package/dist/{runner-CzE8hY3w.js → runner-DKqtR8qk.js} +1 -1
- package/dist/{server-Blu0N8C7.js → server-BDFIbkqt.js} +1 -1
- package/dist/server-Bt2qmyZ_.js +1 -0
- package/dist/server-CWmflSUF.d.ts +27 -0
- package/dist/services/council/runner.d.ts +3 -3
- package/dist/services/discuss/cli-mode.d.ts +3 -3
- package/dist/services/discuss/cli-mode.js +1 -1
- package/dist/services/discuss/engine.d.ts +4 -4
- package/dist/services/discuss/engine.js +1 -1
- package/dist/services/discuss/interactive-selector.js +1 -1
- package/dist/services/discuss/room.d.ts +3 -3
- package/dist/services/discuss/server.js +1 -1
- package/dist/services/discuss/ui-mode.js +1 -1
- package/dist/services/git/create.js +1 -1
- package/dist/services/git/dispatcher.js +1 -1
- package/dist/services/git/pr.js +1 -1
- package/dist/services/git/utils.js +1 -1
- package/dist/services/git/view.js +1 -1
- package/dist/services/git/worktree.js +1 -1
- package/dist/services/p/backend-router.js +1 -1
- package/dist/services/p/interactive-mode.d.ts +3 -3
- package/dist/services/p/interactive-mode.js +1 -1
- package/dist/services/p/prompt-builder.js +1 -1
- package/dist/services/prompt/client.d.ts +1 -1
- package/dist/services/prompt/providerRegistry.d.ts +2 -2
- package/dist/services/prompt/providerRegistry.js +1 -1
- package/dist/services/prompt/router.d.ts +3 -3
- package/dist/services/prompt/router.js +1 -1
- package/dist/services/proxy/errorClassifier.d.ts +3 -3
- package/dist/services/proxy/errorClassifier.js +1 -1
- package/dist/services/proxy/index.d.ts +5 -5
- package/dist/services/proxy/index.js +1 -1
- package/dist/services/proxy/loadBalancer.d.ts +3 -3
- package/dist/services/proxy/loadBalancer.js +1 -1
- package/dist/services/proxy/server.d.ts +5 -4
- package/dist/services/proxy/server.js +1 -1
- package/dist/services/proxy/types.d.ts +2 -2
- package/dist/services/settings/adapters/base.js +1 -1
- package/dist/services/settings/adapters/claude.js +1 -1
- package/dist/services/settings/adapters/codex.js +1 -1
- package/dist/services/settings/adapters/gemini.js +1 -1
- package/dist/services/settings/adapters/xling.d.ts +1 -1
- package/dist/services/settings/adapters/xling.js +1 -1
- package/dist/services/settings/dispatcher.js +1 -1
- package/dist/services/settings/fsStore.js +1 -1
- package/dist/services/settings/sync.js +1 -1
- package/dist/services/shortcuts/runner.d.ts +2 -2
- package/dist/services/shortcuts/runner.js +1 -1
- package/dist/services/shortcuts/types.d.ts +2 -2
- package/dist/{sync-CpPe1zb-.js → sync-BVGUwK0U.js} +1 -1
- package/dist/{types-BYtr5Ckh.d.ts → types-BUZTxIIw.d.ts} +1 -1
- package/dist/{types-D4wEP_zo.d.ts → types-DSkij3xY.d.ts} +1 -1
- package/dist/ui/assets/StreamdownWrapper-DWffBHOG.js +116 -0
- package/dist/ui/assets/code-block-JS6V4U2P-BItqi03x.js +2 -0
- package/dist/ui/assets/{index-Do9ZHsY_.js → index-CLBPU8NI.js} +11 -11
- package/dist/ui/assets/mermaid-ZSTFYFNX-BK4R0Mb9.js +1 -0
- package/dist/ui/index.html +1 -1
- package/dist/{ui-mode-C0SuJqFC.js → ui-mode-xR6MIPNF.js} +1 -1
- package/dist/{view-mnr17loS.js → view-7FWP6c6N.js} +1 -1
- package/dist/{xling-CLR_wN_C.js → xling-BReZTlb3.js} +1 -1
- package/package.json +14 -13
- package/dist/codex-Bmt5WNFl.js +0 -1
- package/dist/config-CyEc62Ow.js +0 -1
- package/dist/router-BFwoY1oV.js +0 -6
- package/dist/server-BdoxM-Hm.d.ts +0 -10
- package/dist/server-Cv8j1V3-.js +0 -1
- package/dist/ui/assets/StreamdownWrapper-GACXJGXU.js +0 -112
- /package/dist/{backend-router-Dffk30tH.js → backend-router-Bn5Ji9HX.js} +0 -0
- /package/dist/{engine-BIfnMHrh.js → engine-BcmRqbIP.js} +0 -0
- /package/dist/{errorClassifier-DXqKOyf7.js → errorClassifier-CXL0O9lB.js} +0 -0
- /package/dist/{fsStore-B91A8JU2.js → fsStore-DVJLVT4G.js} +0 -0
- /package/dist/{interactive-mode-13Ivau8I.js → interactive-mode-Dw0oBqXz.js} +0 -0
- /package/dist/{interactive-selector-CZ2jnaH6.js → interactive-selector-Ca4qOz6C.js} +0 -0
- /package/dist/{loadBalancer-SUWdVxKD.js → loadBalancer-DUCjd5HG.js} +0 -0
- /package/dist/{prompt-builder-BdyAH1va.js → prompt-builder-dkjHNFY9.js} +0 -0
- /package/dist/{utils-BsAY2qu5.js → utils-C_M78-mm.js} +0 -0
- /package/dist/{worktree-cwq_UJ6N.js → worktree-y8aBlgNK.js} +0 -0
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ place.
|
|
|
76
76
|
- `council`: Ask multiple models the same question, have them cross-judge, and return the winning or synthesized answer.
|
|
77
77
|
- `proxy`: Start an OpenAI-compatible proxy with load balancing, API key rotation, and optional access key protection.
|
|
78
78
|
- `sx`: Execute command shortcuts/aliases defined in xling config.
|
|
79
|
-
- `settings:list|get|set|switch|inspect`: Inspect, edit,
|
|
79
|
+
- `settings:list|get|set|switch|inspect|sync|auth`: Inspect, edit, switch, sync, and manage Codex auth profiles across scopes.
|
|
80
80
|
- `git:prc|prr|prv`: Create, checkout, and view GitHub pull requests with automatic gh/git fallbacks.
|
|
81
81
|
- `git:wta|wtl|wtp|wtr|wts`: Manage git worktrees (add/list/prune/remove/switch) with guard rails and subshell support.
|
|
82
82
|
- `version`: Print the installed xling version.
|
|
@@ -111,6 +111,8 @@ place.
|
|
|
111
111
|
- [`settings:set`](docs/settings.md#settingsset): open the target config in your editor of choice; handles variant creation.
|
|
112
112
|
- [`settings:switch`](docs/settings.md#settingsswitch): flip active profiles (Codex) or Claude variants with safety checks.
|
|
113
113
|
- [`settings:inspect`](docs/settings.md#settingsinspect): deep-dive into parsed settings with validation output.
|
|
114
|
+
- [`settings:sync`](docs/settings.md#settingssync): sync Codex and Claude `config.toml` files with diff/backup support.
|
|
115
|
+
- [`settings:auth`](docs/settings.md#settingsauth): save, delete, restore, or list Codex auth profiles.
|
|
114
116
|
|
|
115
117
|
#### Git worktree helpers
|
|
116
118
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as e,u as t}from"./errors-Bjek6jHm.js";import{c as n,f as r,h as i,o as a}from"./fsStore-
|
|
1
|
+
import{m as e,u as t}from"./errors-Bjek6jHm.js";import{c as n,f as r,h as i,o as a}from"./fsStore-DVJLVT4G.js";var o=class{validateAndResolvePath(e){if(!this.validateScope(e))throw new t(e);return this.resolvePath(e)}async list(e){let t=this.validateAndResolvePath(e);return{type:`entries`,entries:this.readConfig(t),filePath:t}}async switchProfile(t,n,r){throw new e(`switch-profile`,this.toolId)}async inspect(e,t){let r=this.validateAndResolvePath(e);if(!a(r))return{path:r,exists:!1};let i=n(r),o=this.readConfig(r);return{path:r,exists:!0,content:JSON.stringify(o,null,2),size:i?.size,lastModified:i?.lastModified}}async edit(t,n){throw new e(`edit`,this.toolId)}readConfig(e){return r(e)}writeConfig(e,t,n=!0){i(e,t,n)}};export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./errors-Bjek6jHm.js";import{n as t,t as n}from"./editor-BfE8c36f.js";import{t as r}from"./format-Banh09CC.js";import{a as i,c as a,h as o,m as s,s as c}from"./fsStore-
|
|
1
|
+
import{p as e}from"./errors-Bjek6jHm.js";import{n as t,t as n}from"./editor-BfE8c36f.js";import{t as r}from"./format-Banh09CC.js";import{a as i,c as a,h as o,m as s,s as c}from"./fsStore-DVJLVT4G.js";import{t as l}from"./base-CEyMUsWC.js";import{t as u}from"./claudeDefault-DlA26Mhl.js";import*as d from"node:fs";import*as f from"node:path";var p=class extends l{toolId=`claude`;async list(e){let t=s(this.validateAndResolvePath(e)),n=f.dirname(t),r=f.basename(t),i=[this.#e(t,e,!0)];if(d.existsSync(n)){let t=d.readdirSync(n,{withFileTypes:!0});for(let a of t){if(!a.isFile()||a.name===r||!this.#r(a.name))continue;let t=f.join(n,a.name);i.push(this.#e(t,e,!1))}}return{type:`files`,files:this.#i(i)}}resolvePath(e){switch(e){case`user`:return`~/.claude/settings.json`;case`project`:return`.claude/settings.json`;case`local`:return`.claude/settings.local.json`;default:throw Error(`Unsupported scope for Claude: ${e}`)}}validateScope(e){return[`user`,`project`,`local`].includes(e)}async switchProfile(t,n,i){let a=s(this.validateAndResolvePath(t)),o=n.trim();if(!o)throw Error(`Variant name cannot be empty`);let l=c(f.dirname(a),o,a);if(!l)throw new e(o);let u=this.readConfig(l),d={};try{d=this.readConfig(a)}catch{d={}}let p=r(d,u);if(i?.preview)return{success:!0,preview:!0,filePath:a,diff:p??void 0,data:{from:l,to:a,hasChanges:!!p},message:p?`Preview generated. Review diff before applying.`:`Current settings already match the selected variant.`};if(!p)return{success:!0,message:`Current settings already match the selected variant.`,filePath:a};let m=i?.backup??!1;return this.writeConfig(a,u,m),{success:!0,message:`Switched to ${f.basename(l)}`,filePath:a,data:{from:l,to:a}}}async edit(e,r){let a=s(this.validateAndResolvePath(e)),l=f.dirname(a),u=r.name?.trim(),p=t(r.ide);i(l);let m=a,h=`default`;if(u&&u!==``&&u!==`default`){let e=c(l,u,a);if(e)m=e;else if(m=f.join(l,`settings.${u}.json`),!d.existsSync(m)){let e=this.#n(a);o(m,e,!1)}h=u}else if(!d.existsSync(m)){let e=this.#n(a);o(m,e,!1)}return await n(p,m),{success:!0,message:`Opened ${h} settings in ${p}`,filePath:m,data:{variant:h,ide:p}}}#e(e,t,n){let r=a(e);return{filename:f.basename(e),variant:this.#t(e),path:e,scope:t,active:n,exists:!!r,size:r?.size,lastModified:r?.lastModified}}#t(e){let t=f.basename(e),n=t.match(/^settings(?:[._-](.+))?\.json$/);return n?n[1]??`default`:t.replace(/\.json$/,``)}#n(e){try{if(d.existsSync(e)){let t=d.readFileSync(e,`utf-8`);return JSON.parse(t)}}catch{}return{...u}}#r(e){return/^settings[._-].+\.json$/.test(e)}#i(e){return e.sort((e,t)=>e.active&&!t.active?-1:!e.active&&t.active?1:e.variant.localeCompare(t.variant))}};export{p as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,t}from"./cli-Bd-KxHjq.js";import{t as n}from"./engine-
|
|
1
|
+
import{i as e,t}from"./cli-Bd-KxHjq.js";import{t as n}from"./engine-BcmRqbIP.js";import{t as r}from"./interactive-selector-Ca4qOz6C.js";import*as i from"node:readline";async function a(t,i,a,c){let l=i.getRegistry(),u=l.getAllModels(),d=t.topic,f=t.models?t.models.split(`,`).map(e=>e.trim()).filter(Boolean):[];d||=await e(`Enter topic: `),f.length===0&&(f=await r(u));let p=f.filter(e=>!l.isModelSupported(e));p.length>0&&c(`Unsupported model(s): ${p.join(`, `)}. Available: ${u.join(`, `)}`),f.length<2&&c(`At least 2 models are required for a discussion.`);let m=new n(i,{topic:d,strategy:t.strategy,timeoutMs:t.timeout*1e3});return f.forEach((e,t)=>{m.addParticipant({id:`model-${t}`,name:e,model:e,type:`ai`})}),m.addParticipant({id:`user`,name:`User`,type:`human`}),a(`\nStarting discussion on "${d}" with: ${f.join(`, `)}\n`),a(`Controls:`),a(` [Space] Pause/Resume`),a(` [m] Toggle Auto/Manual Mode`),a(` [n] Next Turn (Manual Mode)`),a(` [i] Interrupt / Speak`),a(` [s] Summarize & Stop`),a(` [q] Quit`),a(`
|
|
2
2
|
--------------------------------------------------
|
|
3
3
|
`),o(m,a),m.start(),s(m,a),new Promise(()=>{})}function o(e,t){e.on(`turn-start`,t=>{let n=e.participants.find(e=>e.id===t);process.stdout.write(`\n\n[${n?.name}]: `)}),e.on(`message-chunk`,({delta:e})=>{process.stdout.write(e)}),e.on(`error`,({participantId:t,error:n})=>{let r=e.participants.find(e=>e.id===t);console.error(`\n[Error] ${r?.name}: ${n.message}`)}),e.on(`participant-dropped`,t=>{let n=e.participants.find(e=>e.id===t);console.error(`\n[System] ${n?.name} has left the chat (too many errors).`)})}function s(e,n){i.emitKeypressEvents(process.stdin),process.stdin.isTTY&&(process.stdin.setRawMode(!0),process.stdin.resume()),process.on(`SIGINT`,()=>{e.stop(),process.exit()}),process.stdin.on(`keypress`,(r,i)=>{(async()=>{if(i.ctrl&&i.name===`c`&&process.exit(),i.name===`q`&&(e.stop(),process.exit()),i.name===`space`&&(e.status===`paused`?e.resume():e.pause(),n(`\n[System] Discussion ${e.status}`)),i.name===`m`){let t=e.mode===`auto`?`manual`:`auto`;e.setMode(t),n(`\n[System] Mode switched to ${t.toUpperCase()}`)}if(i.name===`n`)if(e.mode===`manual`){if(e.status===`discussing`||e.status===`paused`){let t=e.participants.filter(e=>e.type===`ai`),n=t[Math.floor(Math.random()*t.length)];e.setNextSpeaker(n.id)}}else n(`
|
|
4
4
|
[System] Switch to Manual mode [m] to use Next [n]`);if(i.name===`i`){e.pause(),process.stdin.setRawMode(!1),process.stdout.write(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./errors-Bjek6jHm.js";import{n as t,t as n}from"./editor-BfE8c36f.js";import{a as r,c as i,d as a,f as o,g as s,l as c,m as l,o as u,p as d,r as f,t as p}from"./fsStore-DVJLVT4G.js";import{t as m}from"./base-CEyMUsWC.js";import*as h from"node:path";const g=`~/.codex/auth-profiles`,_=`~/.codex/auth.json`;var v=class extends m{toolId=`codex`;async list(e){let t=this.validateAndResolvePath(e),n=this.readConfig(t),r=this.#c(n),i=this.listAuthProfiles(),a=u(_),o=typeof n.current_auth_profile==`string`?n.current_auth_profile:a||i.length>0?this.#d():null;return{type:`entries`,entries:{current_provider:typeof n.model_provider==`string`?n.model_provider:null,current_profile:typeof n.current_profile==`string`?n.current_profile:null,current_auth_profile:o,providers:r,auth_profiles:i},filePath:t}}async inspect(e,t){let n=this.validateAndResolvePath(e),r=l(n),a=u(n),o=a?this.#s(n):{},s=a?i(n):null,c=t?.trim();if(c){if(this.isAuthProfile(c)){let e=`${g}/${c}.json`,t=this.#u(e),n=i(e);return{path:l(e),exists:u(e),content:JSON.stringify({mode:`auth`,authProfile:c,authFile:l(e),configFile:r,authData:t},null,2),size:n?.size,lastModified:n?.lastModified}}let e=y(o.model_providers)?o.model_providers:{};if(e[c])return{path:r,exists:a,content:JSON.stringify({mode:`provider`,currentProvider:c,config:e[c]??{}},null,2),size:s?.size,lastModified:s?.lastModified};let t=y(o.profiles)?o.profiles:{};return t[c]?{path:r,exists:a,content:JSON.stringify({mode:`profile`,currentProfile:c,config:t[c]??{}},null,2),size:s?.size,lastModified:s?.lastModified}:{path:r,exists:a,content:JSON.stringify({mode:`not_found`,requested:c,availableProviders:Object.keys(e),availableProfiles:Object.keys(t),availableAuthProfiles:this.listAuthProfiles()},null,2),size:s?.size,lastModified:s?.lastModified}}if(!a)return this.#e(r);if(o.current_profile&&typeof o.current_profile==`string`)return this.#t(o,r,s);if(o.model_provider&&typeof o.model_provider==`string`)return this.#n(o,r,s);let d=typeof o.current_auth_profile==`string`?o.current_auth_profile:null;return d||u(_)?this.#r(d,r,s):this.#i(r,s)}#e(e){if(u(_)){let e=this.#l(),t=this.#d();return{path:l(_),exists:!0,content:JSON.stringify({mode:`auth`,currentAuthProfile:t,authFile:l(_),authData:e},null,2)}}return{path:e,exists:!1}}#t(e,t,n){let r=e.current_profile,i=(y(e.profiles)?e.profiles:{})[r];return{path:t,exists:!0,content:JSON.stringify({mode:`profile`,currentProfile:r,config:y(i)?i:{}},null,2),size:n?.size,lastModified:n?.lastModified}}#n(e,t,n){let r=e.model_provider,i=(y(e.model_providers)?e.model_providers:{})[r];return{path:t,exists:!0,content:JSON.stringify({mode:`provider`,currentProvider:r,config:y(i)?i:{}},null,2),size:n?.size,lastModified:n?.lastModified}}#r(e,t,n){let r=this.#l(),i=e||this.#d();return{path:l(_),exists:!0,content:JSON.stringify({mode:`auth`,currentAuthProfile:i,authFile:l(_),configFile:t,authData:r},null,2),size:n?.size,lastModified:n?.lastModified}}#i(e,t){return{path:e,exists:!0,content:JSON.stringify({mode:`none`,message:`No active provider or auth configured. Run 'codex login' or configure a model_provider.`,configFile:e},null,2),size:t?.size,lastModified:t?.lastModified}}resolvePath(e){switch(e){case`user`:return`~/.codex/config.toml`;default:throw Error(`Unsupported scope for Codex: ${e}`)}}validateScope(e){return e===`user`}async switchProfile(e,t,n){return this.validateAndResolvePath(e),this.isAuthProfile(t)?this.#a(t):this.#o(e,t)}async edit(e,i){let a=this.validateAndResolvePath(e);if(!i.provider){let e=l(a);r(h.dirname(e)),u(a)||this.writeConfig(a,{});let o=t(i.ide);return await n(o,e),{success:!0,message:`Opened Codex config in ${o}`,filePath:e}}let o=i.provider.id?.trim()||i.provider.name?.trim();if(!o)throw Error(`Provider name cannot be empty`);let s=i.provider.base_url?.trim();if(!s)throw Error(`Base URL is required for Codex providers`);let c=i.provider.name?.trim()||o,d=i.provider.experimental_bearer_token?.trim();if(!d)throw Error(`Experimental bearer token is required for Codex providers`);let f=this.#s(a),p=y(f.model_providers)?{...f.model_providers}:{};p[o]={name:c,base_url:s,wire_api:`responses`,experimental_bearer_token:d};let m={...f,model_providers:p};return this.writeConfig(a,m),{success:!0,message:`Added model_providers.${o}`,filePath:l(a),data:p[o]}}listAuthProfiles(){return c(g).filter(e=>e.endsWith(`.json`)).map(e=>e.replace(`.json`,``))}isAuthProfile(e){return u(`${g}/${e}.json`)}saveAuthProfile(e,t=!1){let n=`${g}/${e}.json`;return u(_)?!t&&u(n)?{success:!1,message:`Profile "${e}" already exists. Use --force to overwrite.`}:(r(g),p(_,n),f(_),{success:!0,message:`Saved current auth as profile: ${e}\nauth.json has been removed. You can now login with another account.`,filePath:l(n)}):{success:!1,message:`No auth.json found. Please run 'codex login' first.`}}deleteAuthProfile(e){let t=`${g}/${e}.json`;return u(t)?(f(t),{success:!0,message:`Deleted auth profile: ${e}`}):{success:!1,message:`Auth profile "${e}" not found.`}}getAllSwitchableProfiles(e){let t=this.resolvePath(e),n=[];try{let e=this.readConfig(t),r=e.model_providers;y(r)&&(n=Object.keys(r));let i=e.profiles;y(i)&&(n=[...new Set([...n,...Object.keys(i)])])}catch{}let r=this.listAuthProfiles();return{providers:n,authProfiles:r}}#a(e){let t=`${g}/${e}.json`,n=`~/.codex/config.toml`;if(!u(t))return{success:!1,message:`Auth profile "${e}" not found.`};p(t,_);try{let t=this.#s(n);delete t.model_provider,delete t.current_profile,t.current_auth_profile=e,this.writeConfig(n,t)}catch{this.writeConfig(n,{current_auth_profile:e})}return{success:!0,message:`Switched to auth profile: ${e}`,filePath:l(_)}}#o(e,t){let n=this.resolvePath(e);u(_)&&f(_);let r=this.#s(n);delete r.current_auth_profile;let i=r.profiles,a=(y(i)?i:void 0)?.[t];if(y(a)){let e={...r};for(let[t,n]of Object.entries(a))e[t]=n;return e.current_profile=t,delete e.model_provider,this.writeConfig(n,e),{success:!0,message:`Switched to profile: ${t}`,filePath:l(n)}}delete r.current_profile;let o={...r,model_provider:t};return this.writeConfig(n,o),{success:!0,message:`Switched to provider: ${t}`,filePath:l(n)}}readConfig(e){return d(e)}writeConfig(e,t){s(e,t,!1)}#s(t){try{return this.readConfig(t)}catch(t){if(t instanceof e)return{};throw t}}#c(e){let t=e.model_providers;return y(t)?t:{}}#l(){if(!u(_))return null;try{return o(_)}catch{return null}}#u(e){if(!u(e))return null;try{return o(e)}catch{return null}}#d(){if(!u(_))return`default`;let e;try{e=a(_)}catch{return`default`}let t=this.listAuthProfiles();for(let n of t){let t=`${g}/${n}.json`;try{let r=a(t);if(e===r)return n}catch{continue}}return`default`}};const y=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Date);export{y as n,v as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"../../cli-Bd-KxHjq.js";import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import"../../logger-Bqbeu_se.js";import{t}from"../../runner-BRn80E55.js";import"../../
|
|
1
|
+
import{i as e}from"../../cli-Bd-KxHjq.js";import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import"../../logger-Bqbeu_se.js";import{t}from"../../runner-BRn80E55.js";import"../../config-FuKh2Fd0.js";import"../../fsStore-DVJLVT4G.js";import"../../base-CEyMUsWC.js";import"../../template-DD8Cc4Zo.js";import"../../xling-BReZTlb3.js";import"../../providerRegistry-C_6DDXNa.js";import"../../client-CnYKnDo_.js";import"../../types-SSw7TyFZ.js";import"../../loadBalancer-DUCjd5HG.js";import"../../errorClassifier-CXL0O9lB.js";import{n}from"../../router-XRA1VbiH.js";import{t as r}from"../../server-BDFIbkqt.js";import"../../engine-BcmRqbIP.js";import{Command as i,Flags as a}from"@oclif/core";import*as o from"open";var s=class s extends i{static summary=`Ask multiple models the same question, have them judge peers, and pick the winner.`;static description=`Run a council: collect answers, cross-judge anonymously, and synthesize the best response.`;static examples=[{description:`CLI mode with explicit models`,command:`<%= config.bin %> <%= command.id %> --question "How to cache HTTP responses?" --models "gpt-4o,claude-3.5-sonnet"`},{description:`Provide separate judge set and final model`,command:`<%= config.bin %> <%= command.id %> --question "PostgreSQL tuning" --models "gpt-4o,claude-3.5-sonnet" --judges "gemini-2.0-pro-exp,claude-3.5-sonnet" --final-model "gpt-4o"`},{description:`Launch the Web UI`,command:`<%= config.bin %> <%= command.id %> --ui`}];static flags={ui:a.boolean({description:`Launch Web UI for council mode`,default:!1}),question:a.string({char:`q`,description:`Question to ask every model`}),models:a.string({char:`m`,description:`Comma-separated list of models to answer`}),judges:a.string({char:`j`,description:`Comma-separated list of judge models (defaults to models)`}),"final-model":a.string({description:`Model used to write the final synthesis (defaults to first judge)`}),json:a.boolean({description:`Print full JSON result`,default:!1})};async run(){let{flags:r}=await this.parse(s);if(r.ui){await this.#e();return}let i=r.question??await e(`Question: `),a=c(r.models);a.length<2&&this.error(`Provide at least two models via --models`);let o=c(r.judges),l=r[`final-model`],u=await t(await n(),{question:i,models:a,judgeModels:o.length>0?o:void 0,finalModel:l});if(r.json){this.log(JSON.stringify(u,null,2));return}this.#t(u)}async#e(){this.log(`Starting Web UI...`);let e=3e3,t=(await r(e)).address(),n=`http://localhost:${typeof t==`object`&&t?t.port:e}`;return this.log(`Server running at ${n}`),await o.default(n),this.log(`Press Ctrl+C to stop`),new Promise(()=>{})}#t(e){this.log(`\nQuestion: ${e.question}`),this.log(`
|
|
2
2
|
Stage 1: Candidate responses`),e.stage1.forEach(e=>{this.log(`- ${e.label} (${e.model})`),this.log(l(e.content))}),e.aggregates.length>0&&(this.log(`
|
|
3
3
|
Leaderboard:`),e.aggregates.forEach((e,t)=>{this.log(`${t+1}. ${e.label} (${e.model}) — avg ${e.average} from ${e.votes} votes`)})),e.final&&this.log(`\nFinal (${e.final.model}):\n${l(e.final.content)}`)}};function c(e){return e?e.split(`,`).map(e=>e.trim()).filter(Boolean):[]}function l(e){return e.split(`
|
|
4
4
|
`).map(e=>` ${e}`).join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../cli-Bd-KxHjq.js";import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import"../../logger-Bqbeu_se.js";import"../../runner-BRn80E55.js";import"../../
|
|
1
|
+
import"../../cli-Bd-KxHjq.js";import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import"../../logger-Bqbeu_se.js";import"../../runner-BRn80E55.js";import"../../config-FuKh2Fd0.js";import"../../fsStore-DVJLVT4G.js";import"../../base-CEyMUsWC.js";import"../../template-DD8Cc4Zo.js";import"../../xling-BReZTlb3.js";import"../../providerRegistry-C_6DDXNa.js";import"../../client-CnYKnDo_.js";import"../../types-SSw7TyFZ.js";import"../../loadBalancer-DUCjd5HG.js";import"../../errorClassifier-CXL0O9lB.js";import{n as e}from"../../router-XRA1VbiH.js";import"../../server-BDFIbkqt.js";import"../../engine-BcmRqbIP.js";import{t}from"../../ui-mode-xR6MIPNF.js";import"../../interactive-selector-Ca4qOz6C.js";import{t as n}from"../../cli-mode-Bf47_bgy.js";import{Command as r,Flags as i}from"@oclif/core";var a=class a extends r{static summary=`Run a roundtable between multiple AI models via CLI or Web UI`;static description=`Start a discussion between multiple AI models`;static examples=[{description:`CLI mode, pick topic/models interactively`,command:`<%= config.bin %> <%= command.id %>`},{description:`Provide topic and models up front (comma-separated)`,command:`<%= config.bin %> <%= command.id %> --topic "Rust vs Go" --models "gpt-4o,claude-3.5-sonnet"`},{description:`Round-robin turns with shorter per-turn timeout`,command:`<%= config.bin %> <%= command.id %> --strategy round-robin --timeout 10`},{description:`Launch the web UI`,command:`<%= config.bin %> <%= command.id %> --ui`}];static flags={ui:i.boolean({description:`Launch Web UI`,default:!1}),topic:i.string({char:`t`,description:`Topic to discuss`}),models:i.string({char:`m`,description:`Comma-separated list of models to participate`}),strategy:i.string({char:`s`,description:`Turn-taking strategy (random, round-robin)`,options:[`random`,`round-robin`],default:`random`}),timeout:i.integer({description:`Timeout per turn in seconds`,default:30})};async run(){let{flags:r}=await this.parse(a);if(r.ui){await t(e=>this.log(e));return}let i=await e();await n({topic:r.topic,models:r.models,strategy:r.strategy,timeout:r.timeout},i,e=>this.log(e),e=>this.error(e))}};export{a as default};
|
package/dist/commands/git/prc.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"../../git-Dp7K__5K.js";import"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../runner-CrS2GC-S.js";import"../../utils-
|
|
1
|
+
import{t as e}from"../../git-Dp7K__5K.js";import"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../runner-CrS2GC-S.js";import"../../utils-C_M78-mm.js";import"../../pr-BbiioEzE.js";import"../../view-7FWP6c6N.js";import"../../worktree-y8aBlgNK.js";import"../../create-DCRzCnyk.js";import{t}from"../../dispatcher-o1x1DtvC.js";import{Command as n,Flags as r}from"@oclif/core";var i=class i extends n{static summary=`Create a pull request (PR Create)`;static description=`
|
|
2
2
|
Create a pull request using GitHub CLI.
|
|
3
3
|
Supports automatic browser preview with customizable browser selection.
|
|
4
4
|
`;static examples=[{description:`Create PR interactively`,command:`<%= config.bin %> <%= command.id %>`},{description:`Create PR with title and body`,command:`<%= config.bin %> <%= command.id %> --title "Feature X" --body "Implements feature X"`},{description:`Create PR and open in browser`,command:`<%= config.bin %> <%= command.id %> --web`},{description:`Create PR and preview in Safari`,command:`<%= config.bin %> <%= command.id %> --web --browser safari`},{description:`Create draft PR`,command:`<%= config.bin %> <%= command.id %> --draft --title "WIP: Feature X"`},{description:`Create PR with reviewers and labels`,command:`<%= config.bin %> <%= command.id %> --reviewer user1 --reviewer user2 --label bug --label urgent`}];static flags={title:r.string({char:`t`,description:`PR title`}),body:r.string({char:`b`,description:`PR body/description`}),base:r.string({description:`Base branch (default: repository default branch)`}),head:r.string({description:`Head branch (default: current branch)`}),draft:r.boolean({char:`d`,description:`Create as draft PR`,default:!1}),web:r.boolean({char:`w`,description:`Open PR in browser after creation`,default:!1}),browser:r.string({description:`Browser to use when --web is enabled`,options:[...e],default:`chrome`}),assignee:r.string({char:`a`,description:`Assign user(s) (can be used multiple times)`,multiple:!0}),reviewer:r.string({char:`r`,description:`Request reviewer(s) (can be used multiple times)`,multiple:!0}),label:r.string({char:`l`,description:`Add label(s) (can be used multiple times)`,multiple:!0})};async run(){let{flags:e}=await this.parse(i),n=new t,r={title:e.title,body:e.body,base:e.base,head:e.head,draft:e.draft,web:e.web,browser:e.browser,assignee:e.assignee,reviewer:e.reviewer,label:e.label};try{let e=await n.execute({command:`prc`,cwd:process.cwd(),data:r});this.log(`✓ ${e.message}`),e.details?.draft&&this.log(` Type: Draft PR`),e.details?.base&&this.log(` Base: ${e.details.base}`),e.details?.head&&this.log(` Head: ${e.details.head}`)}catch(e){this.error(e.message,{exit:1})}}};export{i as default};
|
package/dist/commands/git/prr.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../runner-CrS2GC-S.js";import"../../utils-
|
|
1
|
+
import"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../runner-CrS2GC-S.js";import"../../utils-C_M78-mm.js";import"../../pr-BbiioEzE.js";import"../../view-7FWP6c6N.js";import"../../worktree-y8aBlgNK.js";import"../../create-DCRzCnyk.js";import{t as e}from"../../dispatcher-o1x1DtvC.js";import{Args as t,Command as n,Flags as r}from"@oclif/core";var i=class i extends n{static summary=`Checkout a PR branch (PR Read/Retrieve)`;static description=`
|
|
2
2
|
Checkout a pull request branch using GitHub CLI (gh) or git fallback.
|
|
3
3
|
Automatically detects gh availability and falls back to git fetch if needed.
|
|
4
4
|
`;static examples=[{description:`Checkout PR using gh or git fallback`,command:`<%= config.bin %> <%= command.id %> 123`},{description:`Checkout PR to specific branch`,command:`<%= config.bin %> <%= command.id %> 456 --branch my-pr-branch`},{description:`Force git fallback with custom remote`,command:`<%= config.bin %> <%= command.id %> 789 --no-gh --remote upstream`},{description:`Checkout a PR from another repo (owner:repo#id)`,command:`<%= config.bin %> <%= command.id %> octo/demo-repo#321 --branch demo-pr`}];static args={id:t.string({description:`PR number or owner:repo#123 format`,required:!0})};static flags={branch:r.string({char:`b`,description:`Branch name (default: pr/<id>)`}),remote:r.string({char:`r`,description:`Remote name`,default:`origin`}),"no-gh":r.boolean({description:`Skip GitHub CLI, use git directly`,default:!1})};async run(){let{args:t,flags:n}=await this.parse(i),r=new e,a={id:t.id,branch:n.branch,strategy:n[`no-gh`]?`git`:`gh`,remote:n.remote};try{let e=await r.execute({command:`prr`,cwd:process.cwd(),data:a});this.log(`✓ ${e.message}`),e.details&&(this.log(` Strategy: ${e.details.strategy}`),this.log(` Branch: ${e.details.branch}`))}catch(e){this.error(e.message,{exit:1})}}};export{i as default};
|
package/dist/commands/git/prv.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"../../git-Dp7K__5K.js";import"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../runner-CrS2GC-S.js";import"../../utils-
|
|
1
|
+
import{t as e}from"../../git-Dp7K__5K.js";import"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../runner-CrS2GC-S.js";import"../../utils-C_M78-mm.js";import"../../pr-BbiioEzE.js";import"../../view-7FWP6c6N.js";import"../../worktree-y8aBlgNK.js";import"../../create-DCRzCnyk.js";import{t}from"../../dispatcher-o1x1DtvC.js";import{Args as n,Command as r,Flags as i}from"@oclif/core";var a=class a extends r{static summary=`Open PR in web browser (PR View)`;static description=`
|
|
2
2
|
Open a pull request in your web browser using GitHub CLI.
|
|
3
3
|
Supports multiple browsers: Chrome (default), Safari, Firefox, Arc, Edge, Dia.
|
|
4
4
|
`;static examples=[{description:`Open PR in Chrome (default)`,command:`<%= config.bin %> <%= command.id %> 123`},{description:`Open PR in Safari`,command:`<%= config.bin %> <%= command.id %> 456 --browser safari`},{description:`Open PR in Firefox`,command:`<%= config.bin %> <%= command.id %> 789 --browser firefox`},{description:`Open PR in Arc`,command:`<%= config.bin %> <%= command.id %> 999 --browser arc`},{description:`Open a PR from another repo in Edge`,command:`<%= config.bin %> <%= command.id %> octo/demo-repo#42 --browser edge`}];static args={id:n.string({description:`PR number`,required:!0})};static flags={browser:i.string({char:`b`,description:`Browser to use`,options:[...e],default:`chrome`})};async run(){let{args:e,flags:n}=await this.parse(a),r=new t,i={id:e.id,browser:n.browser};try{let e=await r.execute({command:`prv`,cwd:process.cwd(),data:i});this.log(`✓ ${e.message}`)}catch(e){this.error(e.message,{exit:1})}}};export{a as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../runner-CrS2GC-S.js";import"../../utils-
|
|
1
|
+
import"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../runner-CrS2GC-S.js";import"../../utils-C_M78-mm.js";import"../../pr-BbiioEzE.js";import"../../view-7FWP6c6N.js";import"../../worktree-y8aBlgNK.js";import"../../create-DCRzCnyk.js";import{t as e}from"../../dispatcher-o1x1DtvC.js";import{Command as t,Flags as n}from"@oclif/core";var r=class r extends t{static summary=`Manage git worktrees`;static description=`
|
|
2
2
|
Manage git worktrees: list existing worktrees, add new ones, remove, or prune stale entries.
|
|
3
3
|
Git worktrees allow multiple working directories from a single repository.
|
|
4
4
|
`;static examples=[{description:`List all worktrees in friendly format`,command:`<%= config.bin %> <%= command.id %> --list`},{description:`Add new worktree with auto-generated path`,command:`<%= config.bin %> <%= command.id %> --add --branch feature/login`},{description:`Add worktree with custom path`,command:`<%= config.bin %> <%= command.id %> -a -p ../repo-feature -b feature/login`},{description:`Switch to main worktree (outputs path for cd)`,command:`cd $(<%= config.bin %> <%= command.id %> -s)`},{description:`Switch to specific worktree by branch name`,command:`cd $(<%= config.bin %> <%= command.id %> -s -b feature/login)`},{description:`Remove worktree by branch name`,command:`<%= config.bin %> <%= command.id %> -r -b main`},{description:`Remove worktree by directory name`,command:`<%= config.bin %> <%= command.id %> -r -b xling-feature`},{description:`Remove worktree by path`,command:`<%= config.bin %> <%= command.id %> -r -p ../repo-feature`},{description:`Prune stale worktrees`,command:`<%= config.bin %> <%= command.id %> --prune`}];static flags={list:n.boolean({char:`l`,description:`List worktrees (default)`,default:!1}),add:n.boolean({char:`a`,description:`Add new worktree (auto-generates path if not specified)`,default:!1}),switch:n.boolean({char:`s`,description:`Get worktree path (outputs path only, use with: cd $(xling git:worktree -s -b <branch>))`,default:!1}),remove:n.boolean({char:`r`,description:`Remove worktree`,default:!1}),prune:n.boolean({description:`Prune stale worktrees`,default:!1}),path:n.string({char:`p`,description:`Worktree path (e.g., '../repo-feature' or absolute path). Auto-generated if not specified with --add.`}),branch:n.string({char:`b`,description:`Branch or worktree name. Defaults to main for --add and --switch. For --remove, intelligently matches branch or directory name.`}),force:n.boolean({char:`f`,description:`Force operation`,default:!1}),detach:n.boolean({description:`Detach HEAD in new worktree`,default:!1})};async run(){let{flags:t}=await this.parse(r),n=`list`;t.add?n=`add`:t.switch?n=`switch`:t.remove?n=`remove`:t.prune&&(n=`prune`);let i=new e,a={action:n,path:t.path,branch:t.branch,force:t.force,detach:t.detach};try{let e=await i.execute({command:`worktree`,cwd:process.cwd(),data:a});if(n===`switch`){this.log(e.message);return}this.log(`✓ ${e.message}`),e.details?.output&&this.log(`
|
package/dist/commands/git/wta.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../runner-CrS2GC-S.js";import"../../utils-
|
|
1
|
+
import"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../runner-CrS2GC-S.js";import"../../utils-C_M78-mm.js";import"../../pr-BbiioEzE.js";import"../../view-7FWP6c6N.js";import"../../worktree-y8aBlgNK.js";import"../../create-DCRzCnyk.js";import{t as e}from"../../dispatcher-o1x1DtvC.js";import{Command as t,Flags as n}from"@oclif/core";var r=class r extends t{static summary=`Add a new git worktree`;static description=`
|
|
2
2
|
Create a new git worktree with automatic path generation.
|
|
3
3
|
Defaults to main branch if not specified.
|
|
4
4
|
Use --select to choose a branch from an interactive list.
|
package/dist/commands/git/wtl.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../runner-CrS2GC-S.js";import"../../utils-
|
|
1
|
+
import"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../runner-CrS2GC-S.js";import"../../utils-C_M78-mm.js";import"../../pr-BbiioEzE.js";import"../../view-7FWP6c6N.js";import"../../worktree-y8aBlgNK.js";import"../../create-DCRzCnyk.js";import{t as e}from"../../dispatcher-o1x1DtvC.js";import{Command as t}from"@oclif/core";var n=class extends t{static summary=`List git worktrees`;static description=`
|
|
2
2
|
List all git worktrees in a friendly format.
|
|
3
3
|
Shows the path and branch for each worktree.
|
|
4
4
|
`;static examples=[{description:`List all worktrees`,command:`<%= config.bin %> <%= command.id %>`},{description:`List worktrees and filter for feature branches`,command:`<%= config.bin %> <%= command.id %> | grep feature/`},{description:`List worktrees from another repo directory`,command:`cd ~/projects/my-repo && <%= config.bin %> <%= command.id %>`}];async run(){let t=new e,n={action:`list`};try{let e=await t.execute({command:`worktree`,cwd:process.cwd(),data:n});this.log(`✓ ${e.message}`),e.details?.output&&this.log(`
|
package/dist/commands/git/wtp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../runner-CrS2GC-S.js";import"../../utils-
|
|
1
|
+
import"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../runner-CrS2GC-S.js";import"../../utils-C_M78-mm.js";import"../../pr-BbiioEzE.js";import"../../view-7FWP6c6N.js";import"../../worktree-y8aBlgNK.js";import"../../create-DCRzCnyk.js";import{t as e}from"../../dispatcher-o1x1DtvC.js";import{Command as t}from"@oclif/core";var n=class extends t{static summary=`Prune stale git worktrees`;static description=`
|
|
2
2
|
Remove stale worktree administrative files.
|
|
3
3
|
This cleans up worktrees that have been manually deleted from the filesystem.
|
|
4
4
|
`;static examples=[{description:`Prune stale worktrees`,command:`<%= config.bin %> <%= command.id %>`},{description:`Clean up after manually deleting a worktree folder`,command:`cd ~/repo && <%= config.bin %> <%= command.id %>`},{description:`Prune then list worktrees to verify`,command:`<%= config.bin %> <%= command.id %> && <%= config.bin %> git:wtl`}];async run(){let t=new e,n={action:`prune`};try{let e=await t.execute({command:`worktree`,cwd:process.cwd(),data:n});this.log(`✓ ${e.message}`),e.details?.output&&this.log(`
|
package/dist/commands/git/wtr.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../runner-CrS2GC-S.js";import"../../utils-
|
|
1
|
+
import"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../runner-CrS2GC-S.js";import"../../utils-C_M78-mm.js";import"../../pr-BbiioEzE.js";import"../../view-7FWP6c6N.js";import"../../worktree-y8aBlgNK.js";import"../../create-DCRzCnyk.js";import{t as e}from"../../dispatcher-o1x1DtvC.js";import{Command as t,Flags as n}from"@oclif/core";var r=class r extends t{static summary=`Remove a git worktree`;static description=`
|
|
2
2
|
Remove a git worktree by branch name, directory name, or path.
|
|
3
3
|
Intelligently matches branch or directory names.
|
|
4
4
|
Use --select to pick which worktree to remove from an interactive list.
|
package/dist/commands/git/wts.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../runner-CrS2GC-S.js";import"../../utils-
|
|
1
|
+
import"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../runner-CrS2GC-S.js";import"../../utils-C_M78-mm.js";import"../../pr-BbiioEzE.js";import"../../view-7FWP6c6N.js";import"../../worktree-y8aBlgNK.js";import"../../create-DCRzCnyk.js";import{t as e}from"../../dispatcher-o1x1DtvC.js";import{Command as t,Flags as n}from"@oclif/core";import{spawn as r}from"node:child_process";var i=class i extends t{static summary=`Switch to a git worktree (opens subshell by default)`;static description=`
|
|
2
2
|
Find a matching worktree, then start a subshell rooted there.
|
|
3
3
|
Defaults to the main branch if no branch/directory is provided.
|
|
4
4
|
Use --path-only for scripting (outputs the path for cd $(...)).
|
package/dist/commands/p/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import"../../runner-CrS2GC-S.js";import"../../
|
|
1
|
+
import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import"../../runner-CrS2GC-S.js";import"../../config-FuKh2Fd0.js";import"../../fsStore-DVJLVT4G.js";import"../../base-CEyMUsWC.js";import"../../template-DD8Cc4Zo.js";import{t as e}from"../../xling-BReZTlb3.js";import"../../providerRegistry-C_6DDXNa.js";import"../../client-CnYKnDo_.js";import{n as t,t as n}from"../../types-SSw7TyFZ.js";import"../../loadBalancer-DUCjd5HG.js";import"../../errorClassifier-CXL0O9lB.js";import{n as r}from"../../router-XRA1VbiH.js";import{t as i}from"../../prompt-builder-dkjHNFY9.js";import{i as a,n as o,r as s}from"../../backend-router-Bn5Ji9HX.js";import{n as c,r as l,t as u}from"../../interactive-mode-Dw0oBqXz.js";import{Args as d,Command as f,Flags as p}from"@oclif/core";import*as m from"node:fs";var h=class h extends f{static description=`Execute a prompt via xling providers or hand off to codex exec / claude -p with yolo`;static examples=[{description:`Simple prompt`,command:`<%= config.bin %> <%= command.id %> "Explain quantum computing"`},{description:`Specify model`,command:`<%= config.bin %> <%= command.id %> --model gpt-4-turbo "Write a poem"`},{description:`Read from file`,command:`<%= config.bin %> <%= command.id %> -f README.md "Summarize this"`},{description:`Read from stdin`,command:`git diff | <%= config.bin %> <%= command.id %> --stdin "Review this diff"`},{description:`JSON output`,command:`<%= config.bin %> <%= command.id %> --json "What is 2+2?"`},{description:`Directly run codex exec (bypass xling providers)`,command:`<%= config.bin %> <%= command.id %> --tool codex "Summarize this repo"`},{description:`Use Claude Code CLI with yolo by default`,command:`<%= config.bin %> <%= command.id %> --tool claude "Review this diff"`},{description:`Shorthand for Codex backend (matches x command flag)`,command:`<%= config.bin %> <%= command.id %> -t codex "Hello"`},{description:`Use Gemini CLI headless prompt`,command:`<%= config.bin %> <%= command.id %> -t gemini "Summarize this diff"`}];static flags={tool:p.string({description:`Choose backend: xling router (default) or call codex/claude/gemini CLI directly`,options:[`xling`,`codex`,`claude`,`gemini`],required:!1,default:`xling`,char:`t`}),yolo:p.boolean({description:`Use yolo flags when calling codex/claude/gemini directly (skip permission prompts)`,required:!1,default:!0,allowNo:!0}),model:p.string({char:`m`,description:`Model to use (defaults to configured defaultModel)`,required:!1}),prompt:p.string({char:`p`,description:`Prompt text (alternative to positional arg)`,required:!1}),system:p.string({char:`s`,description:`System prompt`,required:!1}),file:p.string({char:`f`,description:`Read additional context from file`,required:!1,multiple:!0}),stdin:p.boolean({description:`Read prompt from stdin`,required:!1,default:!1}),temperature:p.string({char:`T`,description:`Temperature (0.0-2.0)`,required:!1}),"max-tokens":p.integer({description:`Maximum tokens to generate`,required:!1}),json:p.boolean({description:`Output as JSON`,required:!1,default:!1}),stream:p.boolean({description:`Stream output (default: true)`,required:!1,default:!0,allowNo:!0}),interactive:p.boolean({char:`i`,description:`Enter interactive chat mode after first response`,required:!1,default:!1})};static args={prompt:d.string({description:`The prompt text`,required:!1})};async run(){let{args:e,flags:r}=await this.parse(h),a=r.tool??`xling`,o=r.yolo!==!1;try{let t=await i({positionalArg:e.prompt,flagPrompt:r.prompt,files:r.file,stdin:r.stdin,warn:e=>this.warn(e)});if(t.trim()||this.error(`No prompt provided. Use argument, --prompt, --file, or --stdin`),a!==`xling`){await this.#e(a,t,o,r);return}await this.#t(t,r)}catch(e){e instanceof t?this.error(e.message):e instanceof n?this.error(`All providers failed:\n${e.errors.map(e=>` ${e.provider}: ${e.error.message}`).join(`
|
|
2
2
|
`)}`):this.error(e.message)}}async#e(e,t,n,r){this.#r(e,r),await o(e)||this.error(`Tool "${a(e)}" is not installed or not found in PATH. Please install it before using --tool ${e}.`),this.log(`[backend: ${e}] ${n?`yolo on`:`yolo off`} — handing output to ${a(e)}`),await s(e,t,{yolo:n,model:r.model})}async#t(e,t){this.#n();let n={prompt:e,model:t.model,system:t.system,temperature:t.temperature?parseFloat(t.temperature):void 0,maxTokens:t[`max-tokens`],stream:t.stream},i=await r(),a,o,s;if(t.stream&&!t.json){let e=await i.executeStream(n);a=await c(e);let r=await e.usage;o=r?{promptTokens:r.inputTokens??0,completionTokens:r.outputTokens??0,totalTokens:r.totalTokens??0}:void 0,s={provider:`streaming`,model:t.model||`default`}}else{let e=await i.execute(n);a=e.content,o=e.usage,s={provider:e.provider,model:e.model},t.json?this.log(JSON.stringify(e,null,2)):this.log(e.content)}!t.json&&o&&s&&this.log(`\n[${s.provider}/${s.model}] ${o.totalTokens} tokens (${o.promptTokens} prompt + ${o.completionTokens} completion)`);let d=t.interactive||!1,f=d;!d&&!t.json&&process.stdout.isTTY&&(f=await u(e=>this.log(e))),f&&await l({initialPrompt:e,initialResponse:a,system:t.system,model:t.model,temperature:t.temperature?parseFloat(t.temperature):void 0,maxTokens:t[`max-tokens`]},i,e=>this.log(e),e=>this.error(e))}#n(){let t=new e().resolvePath(`user`);m.existsSync(t.replace(`~`,process.env.HOME||``))||this.error(`Configuration not found at ${t}\n\nPlease create a configuration file with at least one provider.\nExample:\n{\n "prompt": {\n "providers": [\n {\n "name": "openai",\n "baseUrl": "https://api.openai.com/v1",\n "apiKey": "sk-...",\n "models": ["gpt-4", "gpt-4-turbo"]\n }\n ],\n "defaultModel": "gpt-4"\n }\n}`)}#r(e,t){t.interactive&&this.error(`Interactive mode is not supported when using --tool codex/claude/gemini. Remove --interactive or use the default xling router.`);let n=[];t.json&&n.push(`--json`),t.model&&e!==`gemini`&&n.push(`--model`),t.system&&n.push(`--system`),t.temperature!==void 0&&n.push(`--temperature`),t[`max-tokens`]!==void 0&&n.push(`--max-tokens`),t.stream===!1&&n.push(`--no-stream`),n.length>0&&this.warn(`Ignoring ${n.join(`, `)} when using direct CLI backend; codex/claude will apply their own defaults.`)}};export{h as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e,u as t}from"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import"../../
|
|
1
|
+
import{c as e,u as t}from"../../validators-C8tI-QBw.js";import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import"../../config-FuKh2Fd0.js";import"../../fsStore-DVJLVT4G.js";import"../../base-CEyMUsWC.js";import"../../template-DD8Cc4Zo.js";import"../../xling-BReZTlb3.js";import"../../loadBalancer-DUCjd5HG.js";import"../../errorClassifier-CXL0O9lB.js";import"../../transformer-CKTY0r0_.js";import{a as n,t as r}from"../../server-Bt2qmyZ_.js";import{Command as i,Flags as a}from"@oclif/core";var o=class o extends i{static summary=`Start an OpenAI-compatible proxy server with load balancing and key rotation`;static description=`Boot a local proxy server that forwards requests to configured upstream AI providers.
|
|
2
2
|
|
|
3
3
|
Features:
|
|
4
4
|
- OpenAI-compatible API endpoints (/v1/chat/completions, /v1/messages, etc.)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import{r as e}from"../../format-Banh09CC.js";import"../../fsStore-
|
|
1
|
+
import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import{r as e}from"../../format-Banh09CC.js";import"../../fsStore-DVJLVT4G.js";import"../../base-CEyMUsWC.js";import{t}from"../../codex-D6DXh3qW.js";import{Command as n,Flags as r}from"@oclif/core";var i=class i extends n{static summary=`Manage auth profiles for Codex`;static description=`
|
|
2
2
|
Save, list, and delete auth profiles for Codex.
|
|
3
3
|
Use settings:switch to switch between auth profiles and providers.
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import{r as e}from"../../format-Banh09CC.js";import{m as t,s as n}from"../../fsStore-
|
|
1
|
+
import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import{r as e}from"../../format-Banh09CC.js";import"../../config-FuKh2Fd0.js";import{m as t,s as n}from"../../fsStore-DVJLVT4G.js";import"../../base-CEyMUsWC.js";import"../../template-DD8Cc4Zo.js";import"../../xling-BReZTlb3.js";import"../../codex-D6DXh3qW.js";import"../../claudeDefault-DlA26Mhl.js";import{t as r}from"../../claude-D9MrNBhj.js";import"../../gemini-4dzAg7tf.js";import{t as i}from"../../dispatcher-Dpcz8jAO.js";import{Args as a,Command as o,Flags as s}from"@oclif/core";import c from"node:fs";import l from"node:path";var u=class u extends o{static summary=`View the full configuration file`;static description=`
|
|
2
2
|
Print the entire configuration file for the selected tool/scope.
|
|
3
3
|
Use --json for structured output or --no-json for plain text.
|
|
4
4
|
`;static examples=[{description:`Print Claude user settings (raw file)`,command:`<%= config.bin %> <%= command.id %> --tool claude --scope user`},{description:`Inspect a Claude variant by name`,command:`<%= config.bin %> <%= command.id %> hxi --tool claude --scope user`},{description:`Dump Codex config as JSON for scripting`,command:`<%= config.bin %> <%= command.id %> --tool codex --json`},{description:`View xling prompt router config (if present)`,command:`<%= config.bin %> <%= command.id %> --tool xling --scope user`}];static args={name:a.string({description:`Claude variant name (optional). Example: settings:get hxi`,required:!1})};static flags={tool:s.string({char:`t`,description:`AI CLI tool to manage`,options:[`claude`,`codex`,`gemini`,`xling`],default:`claude`}),scope:s.string({char:`s`,description:`Configuration scope`,options:[`user`,`project`,`local`,`system`],default:`user`})};async run(){let{args:t,flags:n}=await this.parse(u);try{let r=n.tool,i=n.scope,a=r===`claude`&&t.name?await this.#t(i,t.name):await this.#e(r,i,t.name);if(n.json){this.log(e({success:!0,data:a}));return}if(!a.exists){this.warn(`Config file not found: ${a.path}`);return}a.content?this.log(a.content):this.log(`File is empty.`)}catch(e){this.error(e.message,{exit:1})}}async#e(e,t,n){return(await new i().execute({tool:e,scope:t,action:`inspect`,name:n})).data}async#t(e,i){let a=new r;if(!a.validateScope(e))throw Error(`Invalid scope for Claude: ${e}`);let o=i.trim();if(!o||o===`default`)return this.#e(`claude`,e);let s=t(a.resolvePath(e)),u=l.dirname(s),d=n(u,o)??l.join(u,`settings.${o}.json`);if(!c.existsSync(d))return{path:d,exists:!1};let f=c.statSync(d);return{path:d,exists:!0,content:c.readFileSync(d,`utf-8`),size:f.size,lastModified:f.mtime}}};export{u as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import{r as e}from"../../format-Banh09CC.js";import"../../
|
|
1
|
+
import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import{r as e}from"../../format-Banh09CC.js";import"../../config-FuKh2Fd0.js";import"../../fsStore-DVJLVT4G.js";import"../../base-CEyMUsWC.js";import"../../template-DD8Cc4Zo.js";import"../../xling-BReZTlb3.js";import"../../codex-D6DXh3qW.js";import"../../claudeDefault-DlA26Mhl.js";import"../../claude-D9MrNBhj.js";import"../../gemini-4dzAg7tf.js";import{t}from"../../dispatcher-Dpcz8jAO.js";import{Command as n,Flags as r}from"@oclif/core";var i=class i extends n{static summary=`Inspect configuration file status`;static description=`
|
|
2
2
|
Display information about the configuration file, including:
|
|
3
3
|
- File path
|
|
4
4
|
- Existence status
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import{i as e,n as t,r as n}from"../../format-Banh09CC.js";import"../../
|
|
1
|
+
import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import{i as e,n as t,r as n}from"../../format-Banh09CC.js";import"../../config-FuKh2Fd0.js";import"../../fsStore-DVJLVT4G.js";import"../../base-CEyMUsWC.js";import"../../template-DD8Cc4Zo.js";import"../../xling-BReZTlb3.js";import"../../codex-D6DXh3qW.js";import"../../claudeDefault-DlA26Mhl.js";import"../../claude-D9MrNBhj.js";import"../../gemini-4dzAg7tf.js";import{t as r}from"../../dispatcher-Dpcz8jAO.js";import{Command as i,Flags as a}from"@oclif/core";var o=class o extends i{static summary=`List all settings for a tool`;static description=`
|
|
2
2
|
Display all configuration settings for the specified AI CLI tool.
|
|
3
3
|
Supports multiple scopes (user, project, local, system).
|
|
4
|
-
|
|
4
|
+
For Codex, output includes model providers and saved auth profiles.
|
|
5
|
+
`;static examples=[{description:`List Claude user settings (YAML-style summary)`,command:`<%= config.bin %> <%= command.id %> --tool claude --scope user`},{description:`Show Codex providers and auth profiles in a table`,command:`<%= config.bin %> <%= command.id %> --tool codex --scope user --table`},{description:`Inspect Gemini project settings as JSON`,command:`<%= config.bin %> <%= command.id %> -t gemini -s project --json`},{description:`Check xling shortcut config location`,command:`<%= config.bin %> <%= command.id %> --tool xling --scope user`}];static flags={tool:a.string({char:`t`,description:`AI CLI tool to manage`,options:[`claude`,`codex`,`gemini`,`xling`],default:`claude`}),scope:a.string({char:`s`,description:`Configuration scope`,options:[`user`,`project`,`local`,`system`],default:`user`}),json:a.boolean({description:`Output JSON instead of text summary`,default:!1}),table:a.boolean({description:`Render table output instead of JSON`,default:!1})};async run(){let{flags:e}=await this.parse(o);try{let t=await new r().execute({tool:e.tool,scope:e.scope,action:`list`});if(e.table){this.#t(t.data);return}if(e.json){this.log(n(t));return}this.#e(t.data)}catch(e){this.error(e.message,{exit:1})}}#e(e){if(!e){this.log(`No settings found.`);return}if(e.type===`files`){if(e.files.length===0){this.log(`No settings files found.`);return}this.log(this.#n(e.files));return}if(Object.keys(e.entries).length===0){this.log(`No settings found.`);return}this.log(this.#r(e.entries,e.filePath))}#t(n){if(!n){this.log(`No settings found.`);return}if(n.type===`files`){if(n.files.length===0){this.log(`No settings files found.`);return}this.log(t(n.files));return}if(Object.keys(n.entries).length===0){this.log(`No settings found.`);return}this.log(e(n.entries)),this.log(`File: ${n.filePath}`)}#n(e){let t=e.map(e=>`${e.active?`* `:`- `}${e.variant} -> ${e.path}`+(e.exists?``:` (missing)`));return[`files:`].concat(t).join(`
|
|
5
6
|
`)}#r(e,t){let n=[`entries:`];for(let[t,r]of Object.entries(e)){let e=this.#i(r);if(e.includes(`
|
|
6
7
|
`)){n.push(`- ${t}:`);for(let t of e.split(`
|
|
7
8
|
`))n.push(` ${t}`)}else n.push(`- ${t}: ${e}`)}return n.push(`file: ${t}`),n.join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import{r as e}from"../../format-Banh09CC.js";import"../../
|
|
1
|
+
import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import{r as e}from"../../format-Banh09CC.js";import"../../config-FuKh2Fd0.js";import"../../fsStore-DVJLVT4G.js";import"../../base-CEyMUsWC.js";import"../../template-DD8Cc4Zo.js";import"../../xling-BReZTlb3.js";import"../../codex-D6DXh3qW.js";import"../../claudeDefault-DlA26Mhl.js";import"../../claude-D9MrNBhj.js";import"../../gemini-4dzAg7tf.js";import{t}from"../../dispatcher-Dpcz8jAO.js";import{Command as n,Flags as r}from"@oclif/core";import i from"node:readline/promises";import{stdin as a,stdout as o}from"node:process";var s=class s extends n{static summary=`Open settings files or add Codex providers`;static description=`
|
|
2
2
|
Create or open settings files for AI CLI tools in your preferred editor,
|
|
3
3
|
or interactively add Codex model providers.
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import{r as e}from"../../format-Banh09CC.js";import"../../
|
|
1
|
+
import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import{r as e}from"../../format-Banh09CC.js";import"../../config-FuKh2Fd0.js";import"../../fsStore-DVJLVT4G.js";import"../../base-CEyMUsWC.js";import"../../template-DD8Cc4Zo.js";import"../../xling-BReZTlb3.js";import{t}from"../../codex-D6DXh3qW.js";import"../../claudeDefault-DlA26Mhl.js";import"../../claude-D9MrNBhj.js";import"../../gemini-4dzAg7tf.js";import{t as n}from"../../dispatcher-Dpcz8jAO.js";import{Args as r,Command as i,Flags as a}from"@oclif/core";import o from"node:readline/promises";import{stdin as s,stdout as c}from"node:process";var l=class l extends i{static summary=`Switch Codex profiles or Claude settings variants`;static description=`
|
|
2
2
|
Switch to a different profile configuration for Codex
|
|
3
3
|
or activate a specific settings.<variant>.json for Claude.
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../../errors-Bjek6jHm.js";import{r as e}from"../../format-Banh09CC.js";import"../../fsStore-
|
|
1
|
+
import"../../errors-Bjek6jHm.js";import{r as e}from"../../format-Banh09CC.js";import"../../fsStore-DVJLVT4G.js";import{i as t,n,r,t as i}from"../../sync-BVGUwK0U.js";import{Command as a,Flags as o}from"@oclif/core";import s from"node:readline/promises";import{stdin as c,stdout as l}from"node:process";var u=class u extends a{static summary=`Sync config.toml between Claude Code and Codex`;static description=`
|
|
2
2
|
Copy Claude Code config.toml into Codex (default) or reverse the direction
|
|
3
3
|
with --reverse. Shows a diff first, then lets you choose overwrite,
|
|
4
4
|
backup+overwrite, or cancel (similar to settings:switch).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"../../cli-Bd-KxHjq.js";import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import"../../
|
|
1
|
+
import{n as e}from"../../cli-Bd-KxHjq.js";import"../../errors-Bjek6jHm.js";import"../../editor-BfE8c36f.js";import"../../config-FuKh2Fd0.js";import"../../fsStore-DVJLVT4G.js";import"../../base-CEyMUsWC.js";import"../../template-DD8Cc4Zo.js";import"../../xling-BReZTlb3.js";import{n as t,t as n}from"../../types-BeDX5iUe.js";import{t as r}from"../../runner-DKqtR8qk.js";import{Args as i,Command as a,Flags as o}from"@oclif/core";import s from"cli-table3";var c=class c extends a{static summary=`Shortcut eXecute - run predefined command shortcuts`;static description=`
|
|
2
2
|
Execute predefined command shortcuts configured in ~/.claude/xling.json.
|
|
3
3
|
|
|
4
4
|
Shortcuts allow you to create custom aliases for frequently used xling commands
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Command as e}from"@oclif/core";var t=`0.9.
|
|
1
|
+
import{Command as e}from"@oclif/core";var t=`0.9.5`,n=class extends e{static summary=`Show the current xling version`;static description=`Displays the version from package.json.`;static examples=[{description:`Print the installed CLI version`,command:`<%= config.bin %> <%= command.id %>`},{description:`Shortcut using the built-in flag`,command:`<%= config.bin %> --version`}];async run(){this.log(t??`unknown`)}};export{n as default};
|
|
@@ -15,6 +15,7 @@ interface ProviderConfig {
|
|
|
15
15
|
timeout?: number;
|
|
16
16
|
headers?: Record<string, string>;
|
|
17
17
|
weight?: number;
|
|
18
|
+
enabled?: boolean;
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Unified provider configuration schema
|
|
@@ -101,6 +102,9 @@ declare const ShortcutConfigSchema: z.ZodType<ShortcutConfig>;
|
|
|
101
102
|
interface XlingConfig {
|
|
102
103
|
providers: ProviderConfig[];
|
|
103
104
|
defaultModel?: string;
|
|
105
|
+
loadBalance?: LoadBalanceStrategy;
|
|
106
|
+
noRetryErrors?: string[];
|
|
107
|
+
cooldownMs?: number;
|
|
104
108
|
proxy?: ProxyConfig;
|
|
105
109
|
retryPolicy?: RetryPolicy;
|
|
106
110
|
shortcuts?: Record<string, ShortcutConfig>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as e}from"zod";const t=e.object({name:e.string().min(1,`Provider name cannot be empty`).describe(`Provider name (unique identifier)`),baseUrl:e.string().url(`Base URL must be a valid URL`).describe(`API base URL`),apiKey:e.string().optional().describe(`Single API key (use apiKey or apiKeys, not both)`),apiKeys:e.array(e.string().min(1)).optional().describe(`Multiple API keys for rotation`),models:e.array(e.string().min(1)).min(1,`Provider must support at least one model`).describe(`List of supported models`),priority:e.number().int().positive().optional().describe(`Provider priority (lower = higher priority)`),timeout:e.number().int().positive().optional().describe(`Request timeout in milliseconds`),headers:e.record(e.string(),e.string()).optional().describe(`Custom headers to include in requests`),weight:e.number().int().positive().optional().describe(`Weight for weighted load balancing`),enabled:e.boolean().default(!0).describe(`Enable or disable the provider without removing it`)}).refine(e=>{if(e.baseUrl.startsWith(`cli:`))return!0;let t=typeof e.apiKey==`string`&&e.apiKey.length>0,n=Array.isArray(e.apiKeys)&&e.apiKeys.length>0;return t||n},{message:`Either apiKey or apiKeys must be provided (except for cli:* providers)`});function n(e){return e.apiKeys&&e.apiKeys.length>0?e.apiKeys:e.apiKey?[e.apiKey]:[]}const r=e.enum([`round-robin`,`random`,`weighted`,`failover`]),i=e.object({enabled:e.boolean().default(!0).describe(`Enable proxy server`),port:e.number().int().positive().optional().describe(`Proxy server port (default: 4320)`),host:e.string().optional().describe(`Proxy server host (default: 127.0.0.1)`),accessKey:e.string().optional().describe(`Access key for proxy authentication (optional)`),loadBalance:r.optional().default(`failover`).describe(`Load balancing strategy`),modelMapping:e.record(e.string(),e.string()).optional().describe(`Map client model names to actual models (proxy only)`),passthroughResponsesAPI:e.array(e.string()).optional().describe(`Models that natively support Responses API - skip conversion (e.g., gpt-5.1-codex-max)`),keyRotation:e.object({enabled:e.boolean().default(!0),onError:e.boolean().default(!0),cooldownMs:e.number().int().positive().optional()}).optional().describe(`API key rotation settings`)}),a=e.object({maxRetries:e.number().int().min(0).max(10).default(2).describe(`Maximum number of retries`),backoffMs:e.number().int().positive().default(1e3).describe(`Initial backoff delay in milliseconds`)}),o=e.object({win32:e.string().min(1).optional(),darwin:e.string().min(1).optional(),linux:e.string().min(1).optional(),default:e.string().min(1)}),s=e.object({win32:e.array(e.string()).optional(),darwin:e.array(e.string()).optional(),linux:e.array(e.string()).optional(),default:e.array(e.string())}),c=e.object({command:e.union([e.string().min(1),o]),args:e.union([e.array(e.string()),s]).optional()}),l=e.object({win32:e.string().min(1).optional(),darwin:e.string().min(1).optional(),linux:e.string().min(1).optional(),default:e.string().min(1)}),u=e.object({win32:e.array(c).min(1).optional(),darwin:e.array(c).min(1).optional(),linux:e.array(c).min(1).optional(),default:e.array(c).min(1)}),d=e.object({command:e.string().min(1).optional(),args:e.array(e.string()).optional(),shell:e.union([e.string().min(1),l]).optional(),pipeline:e.union([e.array(c).min(1),u]).optional(),description:e.string().optional()}).refine(e=>[e.command,e.shell,e.pipeline].filter(Boolean).length===1,{message:`Exactly one of 'command', 'shell', or 'pipeline' must be specified`}).refine(e=>!(e.args&&(e.shell||e.pipeline)),{message:`'args' can only be used with 'command'`}),f=e.object({providers:e.array(t).min(1,`At least one provider must be configured`).refine(e=>{let t=e.map(e=>e.name);return t.length===new Set(t).size},{message:`Provider names must be unique`}),defaultModel:e.string().optional(),loadBalance:r.optional().default(`failover`).describe(`Global load balancing strategy (overridden by proxy.loadBalance when set)`),noRetryErrors:e.array(e.string()).optional().default([`401`,`403`,`invalid_api_key`]).describe(`Error patterns or status codes that should not trigger retry/fallback`),cooldownMs:e.number().int().positive().optional().default(6e4).describe(`Global cooldown for failed providers in milliseconds (proxy.keyRotation.cooldownMs overrides)`),proxy:i.optional(),retryPolicy:a.optional(),shortcuts:e.record(e.string(),d).optional()});function p(e){if(typeof e!=`object`||!e)return f.parse(e);let t=e;if(`prompt`in t&&typeof t.prompt==`object`&&t.prompt!==null){let e=t.prompt,n=t.proxy,r=e.providers||[],i=n?.providers||[],a={providers:(i.length>0?i:r).map(e=>e.apiKeys&&e.apiKeys.length>0?e:e.apiKey?{...e,apiKeys:[e.apiKey]}:e),defaultModel:e.defaultModel||n?.defaultModel,loadBalance:t.loadBalance??n?.loadBalance,noRetryErrors:t.noRetryErrors??void 0,cooldownMs:t.cooldownMs??n?.keyRotation?.cooldownMs,proxy:n?{enabled:n.enabled??!0,port:n.port,host:n.host,accessKey:n.accessKey,loadBalance:n.loadBalance,modelMapping:n.modelMapping,keyRotation:n.keyRotation}:void 0,retryPolicy:e.retryPolicy,shortcuts:t.shortcuts};return f.parse(a)}return f.parse(e)}function m(e){return e??2**53-1}export{u as a,i as c,f as d,m as f,o as i,a as l,p as m,c as n,l as o,n as p,s as r,t as s,r as t,d as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./errors-Bjek6jHm.js";import{r as t}from"./runner-CrS2GC-S.js";import{t as n}from"./utils-
|
|
1
|
+
import{a as e}from"./errors-Bjek6jHm.js";import{r as t}from"./runner-CrS2GC-S.js";import{t as n}from"./utils-C_M78-mm.js";const r={chrome:{darwin:`Google Chrome`,linux:`google-chrome`,win32:`chrome`},safari:{darwin:`Safari`},firefox:{darwin:`Firefox`,linux:`firefox`,win32:`firefox`},arc:{darwin:`Arc`,win32:`Arc`},edge:{darwin:`Microsoft Edge`,linux:`microsoft-edge`,win32:`msedge`},dia:{darwin:`Dia`,linux:`dia`,win32:`dia`}};function i(e){let t=process.platform,n=r[e]?.[t];return n?t===`darwin`?`open -a "${n}"`:n:null}async function a(r,a){let{title:o,body:s,base:c,head:l,draft:u=!1,web:d=!1,browser:f=`chrome`,assignee:p=[],reviewer:m=[],label:h=[]}=r;if(!await n())throw new e(`gh`,`Install GitHub CLI: https://cli.github.com/`);let g=[`pr`,`create`];o&&g.push(`--title`,o),s&&g.push(`--body`,s),c&&g.push(`--base`,c),l&&g.push(`--head`,l),u&&g.push(`--draft`);for(let e of p)g.push(`--assignee`,e);for(let e of m)g.push(`--reviewer`,e);for(let e of h)g.push(`--label`,e);let _;if(d){g.push(`--web`);let e=i(f);if(!e)throw Error(`Browser "${f}" is not available on ${process.platform}. Supported browsers: chrome, safari (macOS only), firefox, arc, edge, dia`);_={GH_BROWSER:e}}let v=await t(`gh`,g,{cwd:a,env:_,throwOnError:!1});if(!v.success)throw Error(`Failed to create PR: ${v.stderr}`);return{success:!0,message:d?`Created PR and opened in ${f}`:`Created PR successfully`,details:{title:o,base:c,head:l,draft:u,web:d,browser:d?f:void 0,platform:process.platform}}}export{a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e,l as t,m as n}from"./errors-Bjek6jHm.js";import{t as r}from"./xling-
|
|
1
|
+
import{h as e,l as t,m as n}from"./errors-Bjek6jHm.js";import{t as r}from"./xling-BReZTlb3.js";import{t as i}from"./codex-D6DXh3qW.js";import{t as a}from"./claude-D9MrNBhj.js";import{t as o}from"./gemini-4dzAg7tf.js";var s=class{#e;constructor(){this.#e=new Map,this.#e.set(`claude`,new a),this.#e.set(`codex`,new i),this.#e.set(`gemini`,new o),this.#e.set(`xling`,new r)}async execute(e){let r=this.#t(e.tool);switch(e.action){case`list`:return{success:!0,data:await r.list(e.scope)};case`switch-profile`:if(!e.profile)throw new t(`Profile is required for switch-profile action`);if(!r.switchProfile)throw new n(`switch-profile`,e.tool);return await r.switchProfile(e.scope,e.profile,e.switchOptions);case`edit`:if(!r.edit)throw new n(`edit`,e.tool);return await r.edit(e.scope,{name:e.name,ide:e.ide,provider:e.provider});case`inspect`:if(!r.inspect)throw new n(`inspect`,e.tool);return{success:!0,data:await r.inspect(e.scope,e.name)};default:throw new n(e.action)}}#t(t){let n=this.#e.get(t);if(!n)throw new e(t);return n}registerAdapter(e){this.#e.set(e.toolId,e)}getSupportedTools(){return Array.from(this.#e.keys())}};export{s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./utils-
|
|
1
|
+
import{n as e}from"./utils-C_M78-mm.js";import{t}from"./pr-BbiioEzE.js";import{t as n}from"./view-7FWP6c6N.js";import{t as r}from"./worktree-y8aBlgNK.js";import{t as i}from"./create-DCRzCnyk.js";var a=class{async execute(a){if(a.command!==`prv`&&await e(a.cwd),a.command===`worktree`)return r(a.data,a.cwd);if(a.command===`prr`)return t(a.data,a.cwd);if(a.command===`prv`)return n(a.data,a.cwd);if(a.command===`prc`)return i(a.data,a.cwd);throw Error(`Unknown git command: ${a.command}`)}};export{a as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as XlingConfig, D as validateXlingConfig, E as getProviderApiKeys, S as ShortcutConfigSchema, T as getNormalizedPriority, _ as ProxyConfigSchema, a as PlatformArgs, b as RetryPolicySchema, c as PlatformCommandSchema, d as PlatformShell, f as PlatformShellSchema, g as ProxyConfig, h as ProviderConfigSchema, i as PipelineStepSchema, l as PlatformPipeline, m as ProviderConfig, n as LoadBalanceStrategySchema, o as PlatformArgsSchema, p as PromptConfig, r as PipelineStep, s as PlatformCommand, t as LoadBalanceStrategy, u as PlatformPipelineSchema, v as ProxyProviderConfig, w as XlingConfigSchema, x as ShortcutConfig, y as RetryPolicy } from "../../config-
|
|
1
|
+
import { C as XlingConfig, D as validateXlingConfig, E as getProviderApiKeys, S as ShortcutConfigSchema, T as getNormalizedPriority, _ as ProxyConfigSchema, a as PlatformArgs, b as RetryPolicySchema, c as PlatformCommandSchema, d as PlatformShell, f as PlatformShellSchema, g as ProxyConfig, h as ProviderConfigSchema, i as PipelineStepSchema, l as PlatformPipeline, m as ProviderConfig, n as LoadBalanceStrategySchema, o as PlatformArgsSchema, p as PromptConfig, r as PipelineStep, s as PlatformCommand, t as LoadBalanceStrategy, u as PlatformPipelineSchema, v as ProxyProviderConfig, w as XlingConfigSchema, x as ShortcutConfig, y as RetryPolicy } from "../../config-CZ03ghwF.js";
|
|
2
2
|
export { LoadBalanceStrategy, LoadBalanceStrategySchema, PipelineStep, PipelineStepSchema, PlatformArgs, PlatformArgsSchema, PlatformCommand, PlatformCommandSchema, PlatformPipeline, PlatformPipelineSchema, PlatformShell, PlatformShellSchema, PromptConfig, ProviderConfig, ProviderConfigSchema, ProxyConfig, ProxyConfigSchema, ProxyProviderConfig, RetryPolicy, RetryPolicySchema, ShortcutConfig, ShortcutConfigSchema, XlingConfig, XlingConfigSchema, getNormalizedPriority, getProviderApiKeys, validateXlingConfig };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,d as n,f as r,i,l as a,m as o,n as s,o as c,p as l,r as u,s as d,t as f,u as p}from"../../config-
|
|
1
|
+
import{a as e,c as t,d as n,f as r,i,l as a,m as o,n as s,o as c,p as l,r as u,s as d,t as f,u as p}from"../../config-FuKh2Fd0.js";export{f as LoadBalanceStrategySchema,s as PipelineStepSchema,u as PlatformArgsSchema,i as PlatformCommandSchema,e as PlatformPipelineSchema,c as PlatformShellSchema,d as ProviderConfigSchema,t as ProxyConfigSchema,a as RetryPolicySchema,p as ShortcutConfigSchema,n as XlingConfigSchema,r as getNormalizedPriority,l as getProviderApiKeys,o as validateXlingConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./base-
|
|
1
|
+
import{t as e}from"./base-CEyMUsWC.js";import*as t from"node:path";import*as n from"node:os";var r=class extends e{toolId=`gemini`;resolvePath(e){switch(e){case`user`:return`~/.gemini/settings.json`;case`project`:return`.gemini/settings.json`;case`system`:return this.#e();default:throw Error(`Unsupported scope for Gemini: ${e}`)}}validateScope(e){return[`user`,`project`,`system`].includes(e)}#e(){switch(n.platform()){case`darwin`:return`/Library/Application Support/Gemini/settings.json`;case`win32`:return t.join(process.env.PROGRAMDATA||`C:\\ProgramData`,`Gemini`,`settings.json`);case`linux`:return`/etc/gemini/settings.json`;default:return`/etc/gemini/settings.json`}}};export{r as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as ProviderConfig, t as LoadBalanceStrategy } from "./config-
|
|
2
|
-
import { i as ProxyError, n as LoadBalancer, r as ProviderState } from "./types-
|
|
1
|
+
import { m as ProviderConfig, t as LoadBalanceStrategy } from "./config-CZ03ghwF.js";
|
|
2
|
+
import { i as ProxyError, n as LoadBalancer, r as ProviderState } from "./types-BUZTxIIw.js";
|
|
3
3
|
|
|
4
4
|
//#region src/services/proxy/loadBalancer.d.ts
|
|
5
5
|
interface NormalizedProvider extends ProviderConfig {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as e}from"./validators-C8tI-QBw.js";import{s as t}from"./errors-Bjek6jHm.js";import{r as n}from"./runner-CrS2GC-S.js";import{t as r}from"./utils-
|
|
1
|
+
import{d as e}from"./validators-C8tI-QBw.js";import{s as t}from"./errors-Bjek6jHm.js";import{r as n}from"./runner-CrS2GC-S.js";import{t as r}from"./utils-C_M78-mm.js";async function i(i,o){e(i.id);let s=i.id,c=a(s),l=i.branch??`pr/${c}`,{strategy:u,remote:d=`origin`}=i;if(u!==`git`&&await r())try{if((await n(`gh`,[`pr`,`checkout`,s],{cwd:o,throwOnError:!1})).success)return{success:!0,message:`Checked out PR #${s} using GitHub CLI`,details:{strategy:`gh`,branch:l}}}catch{}let f=`pull/${c}/head:${l}`,p=await n(`git`,[`fetch`,d,f],{cwd:o,throwOnError:!1});if(!p.success)throw new t(`git fetch ${d} ${f}`,p.stderr);let m=await n(`git`,[`switch`,l],{cwd:o,throwOnError:!1});if(!m.success)throw new t(`git switch ${l}`,m.stderr);return{success:!0,message:`Checked out PR #${s} to branch '${l}' using git`,details:{strategy:`git`,branch:l,remote:d}}}function a(e){let t=e.match(/(\d+)$/);return t?t[1]:e}export{i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e}from"./config-
|
|
1
|
+
import{f as e}from"./config-FuKh2Fd0.js";import{t}from"./xling-BReZTlb3.js";const n=[{name:`tool-claude-code`,baseUrl:`cli:claude`,apiKey:``,models:[`claude-code`],priority:999,timeout:6e4},{name:`tool-codex`,baseUrl:`cli:codex`,apiKey:``,models:[`codex`],priority:999,timeout:6e4},{name:`tool-gemini-cli`,baseUrl:`cli:gemini`,apiKey:``,models:[`gemini-cli`],priority:999,timeout:6e4}];var r=class n{#e;#t;#n;constructor(e){this.#e=this.#r(s(e.providers)),this.#n=e.defaultModel,this.#t=this.#i()}#r(t){return[...t].sort((t,n)=>e(t.priority)-e(n.priority))}#i(){let e=new Map;for(let t of this.#e)for(let n of t.models)e.has(n)||e.set(n,[]),e.get(n).push(t);return e}getProvidersForModel(e){return this.#t.get(e)||[]}getAllModels(){return Array.from(this.#t.keys()).sort()}getAllProviders(){return[...this.#e]}getProviderByName(e){return this.#e.find(t=>t.name===e)}getDefaultModel(){return this.#n}isModelSupported(e){return this.#t.has(e)}getStats(){return{providerCount:this.#e.length,modelCount:this.#t.size,defaultModel:this.#n}}async reload(){let e=new t,n=e.readConfig(e.resolvePath(`user`));this.#e=this.#r(s(n.providers)),this.#n=n.defaultModel,this.#t=this.#i()}static async fromConfig(){let e=new t;return new n(e.readConfig(e.resolvePath(`user`)))}getProvidersWithFallback(e){if(e){let t=this.getProvidersForModel(e);if(t.length>0)return{model:e,providers:t}}if(this.#n){let e=this.getProvidersForModel(this.#n);if(e.length>0)return{model:this.#n,providers:e}}return null}};let i=null;async function a(){return i||=await r.fromConfig(),i}function o(){i=null}function s(e){let t=new Set(e.map(e=>e.name)),r=n.filter(e=>!t.has(e.name));return[...e,...r]}export{a as n,o as r,r as t};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as XlingConfig } from "./config-
|
|
2
|
-
import { t as ProviderRegistry } from "./providerRegistry-
|
|
1
|
+
import { C as XlingConfig } from "./config-CZ03ghwF.js";
|
|
2
|
+
import { t as ProviderRegistry } from "./providerRegistry-DG8Nc-Jc.js";
|
|
3
3
|
import { a as PromptResponse, i as PromptRequest } from "./types-DBjEVl4B.js";
|
|
4
4
|
import { StreamTextResult } from "ai";
|
|
5
5
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{p as e}from"./config-FuKh2Fd0.js";import{t}from"./providerRegistry-C_6DDXNa.js";import{t as n}from"./client-CnYKnDo_.js";import{n as r,t as i}from"./types-SSw7TyFZ.js";import{t as a}from"./loadBalancer-DUCjd5HG.js";import{t as o}from"./errorClassifier-CXL0O9lB.js";import{spawn as s}from"node:child_process";import*as c from"node:path";const l={debug:(e,...t)=>console.debug(`[Router] ${e}`,...t),info:(e,...t)=>console.info(`[Router] ${e}`,...t),warn:(e,...t)=>console.warn(`[Router] ${e}`,...t),error:(e,...t)=>console.error(`[Router] ${e}`,...t)};var u=class{#e;#t;#n;#r;#i;#a;constructor(e,n){this.#e=new t(e),this.#t=new Map,this.#n={maxRetries:e.retryPolicy?.maxRetries??2,backoffMs:e.retryPolicy?.backoffMs??1e3},this.#r=n||l,this.#a=e.noRetryErrors??[`401`,`403`,`invalid_api_key`],this.#i=new a(e.proxy?.loadBalance??e.loadBalance??`failover`,e.proxy?.keyRotation?.cooldownMs??e.cooldownMs??6e4)}#o(e){let t=e.baseUrl.startsWith(`cli:`)?`cli:${e.name}`:`${e.name}:${e.apiKey??``}`;if(!this.#t.has(t))if(e.baseUrl.startsWith(`cli:`)){let n=e.baseUrl.replace(`cli:`,``);this.#t.set(t,new f(n))}else this.#t.set(t,new n(e));return this.#t.get(t)}async execute(e){let t=e.model||this.#e.getDefaultModel();if(!t)throw Error(`No model specified and no default model configured. Please specify a model with --model or configure a default model.`);let n=this.#e.getProvidersForModel(t);if(n.length===0)throw new r(t,this.#e.getAllModels());return this.#r.info(`Using model: ${t} (${n.length} provider(s) available)`),await this.#s(t,e,n)}async#s(t,n,r){let a=[],s=r.filter(e=>e.enabled!==!1).map(t=>{let n=e(t),r=t.baseUrl.startsWith(`cli:`)&&n.length===0?[`cli`]:n;return{...t,apiKeys:r}});if(s.length===0)throw Error(`No enabled providers available for model: ${t}`);let c=new Map,l=[...s];for(;l.length>0;){let e=this.#i.selectProvider(l)??l[0];if(!e)break;let r=this.#i.getProviderState(e.name),{apiKey:s,keyIndex:u}=this.#c(e,r);if(!s&&!e.baseUrl.startsWith(`cli:`)){let t=l.findIndex(t=>t.name===e.name);t!==-1&&l.splice(t,1);continue}try{this.#r.debug(`Trying provider: ${e.name} (priority: ${e.priority||`default`})`);let r=e.baseUrl.startsWith(`cli:`)?e:{...e,apiKey:s??e.apiKey},i=this.#o(r),a={...n,model:t},o=await this.#f(()=>i.generate(a),e.timeout||6e4);return this.#i.reportSuccess(e.name,u),this.#r.info(`✓ Successfully used provider: ${e.name}`),o}catch(n){let r=n,s=r.status??r.statusCode;this.#r.warn(`✗ Provider ${e.name} failed${typeof s==`number`?` (status ${s})`:``}: ${r.message}`);let d=o(typeof s==`number`?s:0,void 0,typeof s==`number`?void 0:r);this.#i.reportError(e.name,u,d),a.push({provider:e.name,error:r});let f=(c.get(e.name)??0)+1;c.set(e.name,f);let p=l.findIndex(t=>t.name===e.name);p!==-1&&l.splice(p,1);let m=this.#l(d,f,r);if(m&&l.push(e),!m&&l.length===0)throw a.length>1?new i(t,a):r;l.length>0&&await this.#d(a.length-1)}}throw a.length>1?new i(t,a):a.length===1?a[0].error:Error(`No providers available for model: ${t}`)}#c(e,t){if(!t)return{apiKey:e.apiKeys[0]??null,keyIndex:0};let n=this.#i.selectKey(e,t);if(!n)return{apiKey:null,keyIndex:t.currentKeyIndex??0};let r=e.apiKeys.indexOf(n);return{apiKey:n,keyIndex:r>=0?r:0}}#l(e,t,n){if(!e.retryable||!this.#u(n))return!1;let r=n.message.toLowerCase();return this.#a.some(t=>{let n=t.toLowerCase();return e.statusCode&&n===String(e.statusCode)?!0:r.includes(n)})?!1:t<this.#n.maxRetries+1}#u(e){let t=e.message.toLowerCase();if(t.includes(`econnrefused`)||t.includes(`etimedout`)||t.includes(`enotfound`)||t.includes(`network`)||t.includes(`fetch failed`))return!0;let n=e;if(typeof n.status==`number`){let e=n.status;if(e>=500&&e<600||e===429)return!0;if(e>=400&&e<500)return!1}return!!t.match(/\b(5\d{2}|429)\b/)}async#d(e){let t=Math.min(this.#n.backoffMs*2**e,3e4);this.#r.debug(`Backing off for ${t}ms before next attempt`),await new Promise(e=>setTimeout(e,t))}async#f(e,t){return new Promise((n,r)=>{let i=setTimeout(()=>{r(Error(`Request timed out after ${t}ms`))},t);e().then(e=>{clearTimeout(i),n(e)}).catch(e=>{clearTimeout(i),r(e)})})}async executeStream(e){let t=e.model||this.#e.getDefaultModel();if(!t)throw Error(`No model specified and no default model configured. Please specify a model with --model or configure a default model.`);let n=this.#e.getProvidersForModel(t);if(n.length===0)throw new r(t,this.#e.getAllModels());let i=n[0],a=this.#o(i);this.#r.debug(`Streaming with model: ${t} via provider: ${i.name}`);let o={...e,model:t};return await a.stream(o)}getRegistry(){return this.#e}clearClients(){this.#t.clear()}async reloadConfig(){await this.#e.reload(),this.clearClients()}};async function d(e){let{XlingAdapter:t}=await import(`./services/settings/adapters/xling.js`),n=new t;return new u(n.readConfig(n.resolvePath(`user`)),e)}var f=class{#e;constructor(e){this.#e=e}async generate(e){let t=p(e);return{content:await m(this.#e,t,e.abortSignal),model:e.model||this.#e,provider:`cli:${this.#e}`}}async stream(e){let t=p(e);return{textStream:h(this.#e,t,e.abortSignal)}}};function p(e){return e.messages&&e.messages.length>0?e.messages.map(e=>`${e.role.toUpperCase()}: ${e.content}`).join(`
|
|
2
|
+
|
|
3
|
+
`):[e.system,e.prompt].filter(Boolean).join(`
|
|
4
|
+
|
|
5
|
+
`)}function m(e,t,n){return new Promise((r,i)=>{let a=``,o=``,s=g(e,n);s.stdout.on(`data`,e=>{a+=e.toString()}),s.stderr.on(`data`,e=>{o+=e.toString()}),s.on(`error`,e=>i(e)),s.on(`close`,t=>{t===0?r(_(a)):i(Error(o||`cli:${e} exited with code ${t}`))}),s.stdin.write(t),s.stdin.end()})}async function*h(e,t,n){let r=g(e,n),i=``;r.stdout.on(`data`,e=>{i+=e.toString()});let a=new Promise((e,t)=>{r.on(`error`,t),r.on(`close`,()=>e())});r.stdin.write(t),r.stdin.end(),await a;let o=_(i);o.length>0&&(yield o)}function g(e,t){let n=s(c.resolve(process.cwd(),`dist/run.js`),[`p`,`--tool`,e],{stdio:[`pipe`,`pipe`,`pipe`],env:process.env});return t&&(t.aborted?n.kill():t.addEventListener(`abort`,()=>n.kill(`SIGTERM`),{once:!0})),n}function _(e){return e.split(/\r?\n/).filter(e=>e.trim().length>0&&!e.startsWith(`[backend:`)&&!e.startsWith(`yolo on`)).join(`
|
|
6
|
+
`).trim()}export{d as n,u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./xling-
|
|
1
|
+
import{t as e}from"./xling-BReZTlb3.js";import{n as t,t as n}from"./types-BeDX5iUe.js";import{spawn as r}from"node:child_process";var i=class{#e;#t;constructor(t){this.#t=t,this.#e=new e}async load(){return this.#e.getShortcuts(`user`)}async list(){let e=await this.load();return Object.entries(e).map(([e,t])=>{let n,r;if(t.command)n=`command`,r=t.command;else if(t.shell){n=`shell`;let e=this.#i(t.shell);r=e.length>50?e.substring(0,47)+`...`:e}else t.pipeline?(n=`pipeline`,r=this.#s(t.pipeline).map(e=>e.command).join(` | `)):(n=`command`,r=`unknown`);return{name:e,type:n,command:r,args:t.args||[],description:t.description}})}async run(e,n){let r=await this.load(),i=r[e];if(!i)throw new t(e,Object.keys(r));this.#d(e,i),i.command?await this.#n(i,n):i.shell?await this.#r(i.shell):i.pipeline&&await this.#o(i.pipeline)}async#n(e,t){let n=[...e.args||[],...t];await this.#t.runCommand(e.command,n)}async#r(e){return new Promise((t,n)=>{let i=this.#a(),a=r(this.#i(e),{shell:i,stdio:`inherit`});a.on(`error`,e=>{n(Error(`Failed to execute shell command: ${e.message}`))}),a.on(`exit`,e=>{e===0?t():n(Error(`Shell command exited with code ${e}`))})})}#i(e){return typeof e==`string`?e:this.#l(e)}#a(){return process.platform===`win32`?`pwsh`:!0}async#o(e){return new Promise((t,n)=>{let i=this.#s(e),a=[];for(let e=0;e<i.length;e++){let t=i[e],o=e===0,s=e===i.length-1,c=t.command,l=t.args||[],u=c===`pwsh`||c===`powershell`||c===`cmd`||c.includes(`\\`)||c.includes(`/`),d=process.platform===`win32`&&!u,f=r(c,l,{stdio:[o?`inherit`:`pipe`,s?`inherit`:`pipe`,`inherit`],shell:d,cwd:process.cwd(),env:process.env});!o&&a[e-1]&&a[e-1].stdout?.pipe(f.stdin),a.push(f),f.on(`error`,e=>{n(Error(`Failed to execute pipeline step "${t.command}": ${e.message}`))})}a[a.length-1].on(`exit`,e=>{e===0?t():n(Error(`Pipeline exited with code ${e}`))})})}#s(e){return(Array.isArray(e)?e:this.#c(e)).map(e=>({command:this.#l(e.command),args:e.args?this.#l(e.args):void 0}))}#c(e){let t=process.platform;return t===`win32`&&e.win32?e.win32:t===`darwin`&&e.darwin?e.darwin:t===`linux`&&e.linux?e.linux:e.default}#l(e){if(!this.#u(e))return e;let t=process.platform;return t===`win32`&&e.win32!==void 0?e.win32:t===`darwin`&&e.darwin!==void 0?e.darwin:t===`linux`&&e.linux!==void 0?e.linux:e.default}#u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&`default`in e}#d(e,t){if(t.command===`sx`)throw new n(e);if(t.pipeline){let r=this.#s(t.pipeline);for(let t of r)if(t.command===`xling`&&t.args?.includes(`sx`))throw new n(e)}if(t.shell&&this.#i(t.shell).includes(`xling sx`))throw new n(e)}};export{i as t};
|