@hyperez/regna-code 0.2.1 → 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 +63 -0
- package/package.json +3 -3
|
@@ -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.
|
|
@@ -117,3 +120,63 @@ patchEngineFile(
|
|
|
117
120
|
/addLoadedSection\("Themes", themeCompactList, themeList\);/,
|
|
118
121
|
"void 0;",
|
|
119
122
|
);
|
|
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
|
+
|
|
139
|
+
// The engine version these patches are written against. The package pins this exact version,
|
|
140
|
+
// so a mismatch means something forced a different engine in. We verify and warn rather than
|
|
141
|
+
// fail silently: if the engine's compiled shape changed, the patches above become no-ops.
|
|
142
|
+
const KNOWN_ENGINE = "0.80.2";
|
|
143
|
+
const IM = join("dist", "modes", "interactive", "interactive-mode.js");
|
|
144
|
+
try {
|
|
145
|
+
const checks = [
|
|
146
|
+
{ file: join("dist", "config.js"), label: "terminal title", want: /APP_NAME\s*:\s*"Regna"/ },
|
|
147
|
+
{ file: IM, label: "/quit removed", absent: /if \(text === "\/quit"\)/ },
|
|
148
|
+
{ file: join("dist", "core", "slash-commands.js"), label: "/quit menu removed", absent: /name:\s*"quit"/ },
|
|
149
|
+
{ file: IM, label: "resume command name", want: /const args = \["regna"\];/ },
|
|
150
|
+
{ file: IM, label: "update banner/telemetry off", absent: /if \(process\.env\.PI_OFFLINE\) \{/ },
|
|
151
|
+
{ file: IM, label: "Extensions section hidden", absent: /addLoadedSection\("Extensions"/ },
|
|
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/ },
|
|
155
|
+
];
|
|
156
|
+
const failed = [];
|
|
157
|
+
for (const c of checks) {
|
|
158
|
+
const p = findEngineFile(c.file);
|
|
159
|
+
if (!p) {
|
|
160
|
+
failed.push(c.label);
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
const src = readFileSync(p, "utf8");
|
|
164
|
+
if (c.want && !c.want.test(src)) failed.push(c.label);
|
|
165
|
+
if (c.absent && c.absent.test(src)) failed.push(c.label);
|
|
166
|
+
}
|
|
167
|
+
if (failed.length > 0) {
|
|
168
|
+
let ver = "unknown";
|
|
169
|
+
try {
|
|
170
|
+
const pj = findEngineFile("package.json");
|
|
171
|
+
if (pj) ver = JSON.parse(readFileSync(pj, "utf8")).version || ver;
|
|
172
|
+
} catch {
|
|
173
|
+
/* ignore */
|
|
174
|
+
}
|
|
175
|
+
process.stderr.write(
|
|
176
|
+
`[regna] Note: some UI customizations did not apply (engine ${ver}, expected ${KNOWN_ENGINE}): ` +
|
|
177
|
+
`${failed.join(", ")}. Try reinstalling: npm i -g @hyperez/regna-code\n`,
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
} catch {
|
|
181
|
+
/* verification is advisory only; never fail the install */
|
|
182
|
+
}
|
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,
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"LICENSE"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@earendil-works/pi-coding-agent": "
|
|
36
|
-
"@earendil-works/pi-tui": "
|
|
35
|
+
"@earendil-works/pi-coding-agent": "0.80.2",
|
|
36
|
+
"@earendil-works/pi-tui": "0.80.2",
|
|
37
37
|
"typebox": "^1.3.1"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|