@hyperez/regna-code 0.2.6 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/extensions/provider.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,6 +50,7 @@ For CI or scripted use, set `REGNA_API_KEY` directly; it takes priority over the
|
|
|
50
50
|
| `REGNA_API_KEY` | (none) | Regna API key. Optional once you have run `regna login`. When set, it overrides the stored credential (use for CI). |
|
|
51
51
|
| `REGNA_BASE_URL` | `https://regnax.ai/v1` | Regna API base URL (OpenAI-compatible). Point this at a self-hosted endpoint for on-premise use. |
|
|
52
52
|
| `REGNA_MODEL` | (auto) | Starting model. By default the current single cloud model is detected from the gateway automatically; set this to pin a specific id. |
|
|
53
|
+
| `REGNA_WEB_SEARCH` | (auto) | Gateway-executed web search. `1` on, `0` off. Default: on for the Regna cloud, off for self-hosted endpoints. When on, the model can search the web; the search runs on the gateway (this machine makes no extra network calls), and each successful search is billed as a small credit surcharge. |
|
|
53
54
|
| `REGNA_EXPOSE_ALIASES` | (unset) | `1` also exposes path-style (slash) model ids. Hidden by default. The id pinned via `REGNA_MODEL` is always shown. |
|
|
54
55
|
| `REGNA_POLICY` | `off` | Network egress guard: `off` / `warn` (notify, allow) / `enforce` (block external network tools). Set `enforce` for locked-down or air-gapped use. |
|
|
55
56
|
| `REGNA_OFFLINE` | (unset) | `1` runs fully offline: the runtime skips all self-network, including the one-time download of search helpers (`fd`/`ripgrep`). They fall back to the built-in search. Use for air-gapped installs. |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var E="regna",
|
|
1
|
+
var E="regna",w="https://regnax.ai/v1";var p=/^regna-\d+$/,A=["regna-1"],R={"regna-1":"Regna 1"},h={"regna-1":1e6},m={"regna-1":32768},v=1e6,S=32768;function x(o){let n=/^regna-(\d+)$/.exec(o.toLowerCase());return n?`Regna ${n[1]}`:`Regna \xB7 ${o}`}var M=512*1024,T=24,I=200;function L(){let o=(process.env.REGNA_BASE_URL??"").trim(),n=o===""?w:o,t;try{t=new URL(n)}catch{return w}if(t.protocol!=="http:"&&t.protocol!=="https:")return w;let c=`${t.origin}${t.pathname}`.replace(/\/+$/,"");return/\/v\d+$/.test(c)?c:`${c}/v1`}function N(o){try{return/(^|\.)regnax\.ai$/i.test(new URL(o).hostname)}catch{return!1}}function P(o){let n=(process.env.REGNA_WEB_SEARCH??"").trim().toLowerCase();return n==="0"||n==="false"||n==="off"?!1:n==="1"||n==="true"||n==="on"?!0:o}function b(o){let n=o.id,t=n.toLowerCase(),c=t==="default"||t==="current"||t==="auto",a=p.test(t),u=/qwq|qwen3|think|reason/.test(t),r=parseInt((process.env.REGNA_CONTEXT_WINDOW??"").trim(),10),l=typeof o.contextWindow=="number"&&o.contextWindow>0?o.contextWindow:void 0,f=Number.isFinite(r)&&r>0?r:l??h[t]??(a?v:32768),d=m[t]??(a?S:8192);return{id:n,name:R[t]??(a?x(n):c?"Regna (active model)":`Regna \xB7 ${n}`),reasoning:u,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:f,maxTokens:d}}async function y(o,n){let t=new AbortController,c=setTimeout(()=>t.abort(),4e3);try{let a=await fetch(`${o}/models`,{headers:{Authorization:`Bearer ${n}`},signal:t.signal});if(!a.ok)return[];let u=await a.text();if(u.length>M)return[];let r;try{r=JSON.parse(u)}catch{return[]}let l=Array.isArray(r.data)?r.data:[],f=new Set,d=[];for(let i of l){let s=i&&typeof i.id=="string"?i.id:"";if(s.length===0||s.length>I||f.has(s))continue;f.add(s);let _=i&&typeof i.context_window=="number"&&i.context_window>0?i.context_window:void 0;if(d.push({id:s,contextWindow:_}),d.length>=T)break}return d}catch{return[]}finally{clearTimeout(c)}}async function C(o){let n=L(),t=(process.env.REGNA_API_KEY??"").trim(),c=(process.env.REGNA_EXPOSE_ALIASES??"").trim()==="1",a=t?await y(n,t):[],u=new Map(a.map(e=>[e.id,e.contextWindow])),r=a.map(e=>e.id),l=new Set;(e=>{let g=(e??"").trim();g&&l.add(g.startsWith(`${E}/`)?g.slice(E.length+1):g)})(process.env.REGNA_MODEL),c||(r=r.filter(e=>e==="default"||!e.includes("/")||l.has(e)));let d=N(n),i=r.filter(e=>p.test(e)).sort(),s;if(d){s=i.length>0?i.slice():[...A];for(let e of l)r.includes(e)&&!s.includes(e)&&s.push(e)}else if(i.length>0){s=i.slice();for(let e of l)r.includes(e)&&!s.includes(e)&&s.push(e)}else r.includes("default")||r.unshift("default"),s=r;!r.some(e=>e!=="default")&&!d&&console.warn(`[regna] Model discovery failed or REGNA_API_KEY is unset. Set REGNA_API_KEY and run /reload. (base=${n})`),o.registerProvider(E,{name:"Regna",baseUrl:n,apiKey:"$REGNA_API_KEY",api:"openai-completions",...P(d)?{headers:{"X-Regna-Web-Search":"on"}}:{},models:s.map(e=>b({id:e,contextWindow:u.get(e)}))})}export{C as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperez/regna-code",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Regna Code. A terminal coding agent on Regna. Install with `npm i -g @hyperez/regna-code` and run `regna`. Works with the Regna cloud API and on-premise deployments.",
|
|
5
5
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
6
6
|
"private": false,
|