@hyperez/regna-code 0.2.2 → 0.2.3
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/dist/extensions/provider.js +1 -1
- package/dist/postinstall.mjs +20 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var g="regna",
|
|
1
|
+
var g="regna",E="https://regnax.ai/v1";var f=["regna-basic","regna-pro","regna-max"],p={"regna-basic":"Regna Basic","regna-pro":"Regna Pro","regna-max":"Regna Max"},A=512*1024,R=24,_=200;function m(){let o=(process.env.REGNA_BASE_URL??"").trim(),e=o===""?E:o,r;try{r=new URL(e)}catch{return E}if(r.protocol!=="http:"&&r.protocol!=="https:")return E;let a=`${r.origin}${r.pathname}`.replace(/\/+$/,"");return/\/v\d+$/.test(a)?a:`${a}/v1`}function h(o){try{return/(^|\.)regnax\.ai$/i.test(new URL(o).hostname)}catch{return!1}}function v(o){let e=o.toLowerCase(),r=e==="default"||e==="current"||e==="auto",a=/qwq|qwen3|think|reason|max/.test(e),t=f.includes(e),i=parseInt((process.env.REGNA_CONTEXT_WINDOW??"").trim(),10),c=Number.isFinite(i)&&i>0?i:t?2e5:32768,l=t?32e3:8192;return{id:o,name:p[e]??(r?"Regna (active model)":`Regna \xB7 ${o}`),reasoning:a,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:c,maxTokens:l}}async function I(o,e){let r=new AbortController,a=setTimeout(()=>r.abort(),4e3);try{let t=await fetch(`${o}/models`,{headers:{Authorization:`Bearer ${e}`},signal:r.signal});if(!t.ok)return[];let i=await t.text();if(i.length>A)return[];let c;try{c=JSON.parse(i)}catch{return[]}let d=(Array.isArray(c.data)?c.data:[]).map(n=>n&&typeof n.id=="string"?n.id:"").filter(n=>n.length>0&&n.length<=_);return Array.from(new Set(d)).slice(0,R)}catch{return[]}finally{clearTimeout(a)}}async function y(o){let e=m(),r=(process.env.REGNA_API_KEY??"").trim(),a=(process.env.REGNA_EXPOSE_ALIASES??"").trim()==="1",t=r?await I(e,r):[],i=new Set,c=s=>{let u=(s??"").trim();u&&i.add(u.startsWith(`${g}/`)?u.slice(g.length+1):u)};c(process.env.REGNA_MODEL),c(process.env.REGNA_CODER_MODEL),c(process.env.REGNA_GENERAL_MODEL),a||(t=t.filter(s=>s==="default"||!s.includes("/")||i.has(s)));let l=h(e),d=f.filter(s=>t.includes(s)),n;if(l||d.length>0){n=l?[...f]:d.slice();for(let s of i)t.includes(s)&&!n.includes(s)&&n.push(s);!l&&n.length===0&&(n=["default"])}else t.includes("default")||t.unshift("default"),n=t;!t.some(s=>s!=="default")&&!l&&console.warn(`[regna] Model discovery failed or REGNA_API_KEY is unset. Set REGNA_API_KEY and run /reload. (base=${e})`),o.registerProvider(g,{name:"Regna",baseUrl:e,apiKey:"$REGNA_API_KEY",api:"openai-completions",models:n.map(v)})}export{y as default};
|
package/dist/postinstall.mjs
CHANGED
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
* 5) Hide the "Extensions" and "Themes" sections of the startup resource panel (internal
|
|
30
30
|
* implementation detail). Context and Skills still show.
|
|
31
31
|
*
|
|
32
|
+
* 6) De-brand the base system prompt so the model identifies as Regna Code, not the engine:
|
|
33
|
+
* rewrite the "operating inside <engine>" identity line and remove the engine-docs block.
|
|
34
|
+
*
|
|
32
35
|
* Best effort: every patch is wrapped so a failure (e.g. the engine changed its layout) just
|
|
33
36
|
* leaves that aspect at the engine default and never fails the install. All patches are
|
|
34
37
|
* idempotent and safe to run on every install.
|
|
@@ -118,6 +121,21 @@ patchEngineFile(
|
|
|
118
121
|
"void 0;",
|
|
119
122
|
);
|
|
120
123
|
|
|
124
|
+
// 6) De-brand the base system prompt. The engine tells the model it is "operating inside pi,
|
|
125
|
+
// a coding agent harness" and appends a whole "Pi documentation" section, which makes the
|
|
126
|
+
// model identify as pi. Rewrite the identity line and drop the pi-docs block (Regna hides
|
|
127
|
+
// the engine, so that block is pure leakage with no user value).
|
|
128
|
+
patchEngineFile(
|
|
129
|
+
join("dist", "core", "system-prompt.js"),
|
|
130
|
+
/operating inside pi, a coding agent harness/,
|
|
131
|
+
"operating inside Regna Code, a terminal coding agent",
|
|
132
|
+
);
|
|
133
|
+
patchEngineFile(
|
|
134
|
+
join("dist", "core", "system-prompt.js"),
|
|
135
|
+
/\n\nPi documentation \(read only when the user asks about pi[\s\S]*?tui\.md for TUI API details\)/,
|
|
136
|
+
"",
|
|
137
|
+
);
|
|
138
|
+
|
|
121
139
|
// The engine version these patches are written against. The package pins this exact version,
|
|
122
140
|
// so a mismatch means something forced a different engine in. We verify and warn rather than
|
|
123
141
|
// fail silently: if the engine's compiled shape changed, the patches above become no-ops.
|
|
@@ -132,6 +150,8 @@ try {
|
|
|
132
150
|
{ file: IM, label: "update banner/telemetry off", absent: /if \(process\.env\.PI_OFFLINE\) \{/ },
|
|
133
151
|
{ file: IM, label: "Extensions section hidden", absent: /addLoadedSection\("Extensions"/ },
|
|
134
152
|
{ file: IM, label: "Themes section hidden", absent: /addLoadedSection\("Themes"/ },
|
|
153
|
+
{ file: join("dist", "core", "system-prompt.js"), label: "system-prompt de-branded", absent: /operating inside pi,/ },
|
|
154
|
+
{ file: join("dist", "core", "system-prompt.js"), label: "pi docs block removed", absent: /Pi documentation \(read only/ },
|
|
135
155
|
];
|
|
136
156
|
const failed = [];
|
|
137
157
|
for (const c of checks) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperez/regna-code",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
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,
|