aegisone 1.0.67 → 1.0.69
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 +6 -3
- package/bin/aegis.js +1 -1
- package/package.json +2 -2
- package/scripts/postinstall.mjs +1 -1
- package/src/electron-repair.js +3 -0
- package/src/probes.js +1 -1
- package/vendor/cli/package.json +1 -1
- package/vendor/cli/src/app.js +1 -1
- package/vendor/cli/src/chatflow.js +1 -1
- package/vendor/cli/src/overlays.js +1 -1
- package/vendor/cli/src/theme.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/integrity.js +1 -1
- package/vendor/cli/vendor/desktop/main.js +48 -5
- package/vendor/desktop/lib/gpu-usable.js +3 -0
- package/vendor/desktop/lib/local/integrity.js +1 -1
- package/vendor/desktop/main.js +48 -5
- package/vendor/desktop/package.json +3 -3
- package/vendor/desktop/preload.js +2 -2
- package/vendor/desktop/renderer/pty-frame.html +3 -0
- package/vendor/desktop/renderer/pty-panel.js +1 -1
- package/vendor/desktop/renderer/pty-renderer.js +3 -0
- package/vendor/desktop/renderer/pty-window.html +3 -0
- package/vendor/desktop/renderer/pty-window.js +1 -1
- package/vendor/desktop/renderer/style.css +66 -14
- package/vendor/desktop/renderer/vendor/LICENSE-addon-canvas +19 -0
- package/vendor/desktop/renderer/vendor/LICENSE-addon-webgl +19 -0
- package/vendor/desktop/renderer/vendor/NOTICE.md +19 -1
- package/vendor/desktop/renderer/vendor/addon-canvas.js +1 -0
- package/vendor/desktop/renderer/vendor/addon-webgl.js +1 -0
- package/vendor/desktop/vendor/faces/cli/package.json +1 -1
- package/vendor/desktop/vendor/faces/cli/src/app.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/chatflow.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/overlays.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/theme.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/integrity.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/main.js +2 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";const{span:span,padLine:padLine,w:w}=require("./screen.js"),{C:C,BOLD:BOLD,BOLD_OFF:BOLD_OFF,GLYPH:GLYPH}=require("./theme.js");let fuzzy=null;try{fuzzy=require("./fuzzy.js")}catch{fuzzy=null}function rankCommands(e,n){if(fuzzy&&"function"==typeof fuzzy.fuzzyRankWithAliases)return fuzzy.fuzzyRankWithAliases(e,n,e=>e.name,e=>e.aliases||[]);const a=String(e||"").toLowerCase();return a?n.filter(e=>`${e.name} ${(e.aliases||[]).join(" ")}`.toLowerCase().includes(a)):n}const descOf=e=>null!=e.help?e.help:null!=e.desc?e.desc:"",hintOf=e=>null!=e.hint?e.hint:null!=e.args?e.args:"";function fit(e,n){return e.map(e=>padLine(e,n))}const blank=e=>[span(""," ".repeat(Math.max(0,e)))];function boldMatched(e,n,a){const s=fuzzy&&"function"==typeof fuzzy.fuzzyMatchPositions?fuzzy.fuzzyMatchPositions(e,n):[];if(!s||!s.length)return[span(a,n)];const t=[];let r=0;for(const e of s)e>r&&t.push(span(a,n.slice(r,e))),t.push(span(a+BOLD,n[e])),r=e+1;return r<n.length&&t.push(span(a,n.slice(r))),t}function renderPalette(e,n={},a=80,s=24){!Array.isArray(e)&&e&&"object"==typeof e&&(n=e,e=Array.isArray(e.commands)?e.commands:[]);const t=rankCommands(n.query||"",e||[]),r=Number.isInteger(n.sel)?n.sel:0,p=t.length,l=Math.max(1,Math.min(12,s-8)),o=Math.max(0,Math.min(r-Math.floor(l/2),Math.max(0,p-l))),
|
|
3
|
+
"use strict";const{span:span,padLine:padLine,w:w}=require("./screen.js"),{C:C,BOLD:BOLD,BOLD_OFF:BOLD_OFF,GLYPH:GLYPH}=require("./theme.js");let fuzzy=null;try{fuzzy=require("./fuzzy.js")}catch{fuzzy=null}function rankCommands(e,n){if(fuzzy&&"function"==typeof fuzzy.fuzzyRankWithAliases)return fuzzy.fuzzyRankWithAliases(e,n,e=>e.name,e=>e.aliases||[]);const a=String(e||"").toLowerCase();return a?n.filter(e=>`${e.name} ${(e.aliases||[]).join(" ")}`.toLowerCase().includes(a)):n}const descOf=e=>null!=e.help?e.help:null!=e.desc?e.desc:"",hintOf=e=>null!=e.hint?e.hint:null!=e.args?e.args:"";function fit(e,n){return e.map(e=>padLine(e,n))}const blank=e=>[span(""," ".repeat(Math.max(0,e)))];function boldMatched(e,n,a){const s=fuzzy&&"function"==typeof fuzzy.fuzzyMatchPositions?fuzzy.fuzzyMatchPositions(e,n):[];if(!s||!s.length)return[span(a,n)];const t=[];let r=0;for(const e of s)e>r&&t.push(span(a,n.slice(r,e))),t.push(span(a+BOLD,n[e])),r=e+1;return r<n.length&&t.push(span(a,n.slice(r))),t}function renderPalette(e,n={},a=80,s=24){!Array.isArray(e)&&e&&"object"==typeof e&&(n=e,e=Array.isArray(e.commands)?e.commands:[]);const t=rankCommands(n.query||"",e||[]),r=Number.isInteger(n.sel)?n.sel:0,p=t.length,l=Math.max(1,Math.min(12,s-8)),o=Math.max(0,Math.min(r-Math.floor(l/2),Math.max(0,p-l))),h=t.slice(o,o+l),u=[];u.push(blank(a)),u.push([span(C.gray," "+"─".repeat(Math.max(10,a-4)))]);const i=String(null!=n.typed?n.typed:n.query||""),c=Math.max(4,a-6),d=i.length>c?GLYPH.ellipse+i.slice(i.length-(c-1)):i;u.push([span(""," "),span(C.gray,"/"),span(i?C.white:C.dim,d||"type a command"),span(C.lavender,GLYPH.caret)]);for(let e=0;e<h.length;e++){const a=h[e],s=o+e===r,t=s?span(C.lavender,GLYPH.cursor):span(""," "),p=s?C.blue:C.white,l=[span(p,"/"),...boldMatched(n.query||"",a.name,p)],i=" ".repeat(Math.max(1,22-[...a.name].length));u.push([span(""," "),t,span(""," "),...l,span(a.unavailable?C.dim:C.gray,i+descOf(a))]),s&&hintOf(a)&&u.push([span(""," "),span(C.gray,`${GLYPH.hook} Usage: /${a.name} ${hintOf(a)}`)])}for(p||u.push([span(""," "),span(C.gray,i?`no command matches “${i}”`:"no commands available")]);u.length<4+2*l;)u.push(blank(a));return u.push([span(C.gray," "+"─".repeat(Math.max(10,a-4)))]),u.push([span(C.gray,` type to filter ${GLYPH.bullet} shift+enter runs the top row ${GLYPH.bullet} enter runs ${GLYPH.bullet} esc closes`)]),fit(u,a)}const PICKER_HINT=`↑↓ or tab move ${GLYPH.bullet} enter pins ${GLYPH.bullet} shift+↑↓ pins at once ${GLYPH.bullet} esc cancels`;function renderModelPicker(e,n=0,a=80,s=24,t=null,r=null,p=null){const l=[],o="function"==typeof p&&r?p(r):null;l.push(blank(a)),l.push([span(""," "),span(C.white+BOLD,"Select model"),span(BOLD_OFF,""),...o?[span(C.gray,` — running on ${o}`)]:[]]),l.push([span(""," "),span(C.gray,"Switch between models. Your pick becomes the default for new sessions.")]),l.push([span(""," "),span(C.gray,"Nexus is pooled; any other row prompts for its provider key on pick.")]),l.push(blank(a));const h=Math.max(1,(s||24)-8),u=e.length,i=u>h?Math.min(Math.max(0,n-Math.floor(h/2)),u-h):0,c=Math.min(u,i+h);i>0&&l.push([span(""," "),span(C.gray,`↑ ${i} more above`)]);for(let a=i;a<c;a++){const s=e[a]||{},r=s.label||s.name||s.id||"",p=a===n,o=null!=t&&s.id===t,h=p?span(C.lavender,GLYPH.cursor):span(""," "),u=span(C.gray,`${a+1}.`),i=span(p?C.lavender:C.white,r),c=o?span(C.green," "+GLYPH.check):span("",""),d=" ".repeat(Math.max(1,22-[...r].length)),g="byok"!==s.cls||s.configured?"":"[key needed] ";l.push([span(""," "),h,span(""," "),u,span(""," "),i,c,span(C.gray,d+g+(s.note||s.model||""))])}return c<u&&l.push([span(""," "),span(C.gray,`↓ ${u-c} more below`)]),l.push(blank(a)),l.push([span(""," "),span(C.gray,PICKER_HINT)]),fit(l,a)}const EFFORT_LEVELS=[{label:"Low",note:"Fastest, cheapest budget"},{label:"Medium",note:"Balanced"},{label:"High",note:"Highest budget, slowest (default)"},{label:"Max",note:"Deepest reasoning where the model defines it; same budget as high"}],EFFORT_VALUES=EFFORT_LEVELS.map(e=>void 0===e.value?e.label.toLowerCase():e.value);function renderEffortPicker(e=0,n=80,a=null,s=EFFORT_LEVELS){const t=[];t.push(blank(n)),t.push([span(""," "),span(C.white+BOLD,"Select effort"),span(BOLD_OFF,"")]),t.push([span(""," "),span(C.gray,"Sets the token budget the pool sizes each turn from.")]),t.push(blank(n));for(let n=0;n<s.length;n++){const r=s[n],p=n===e,l=String(a||"high").toLowerCase()===String(r.label).toLowerCase(),o=p?span(C.lavender,GLYPH.cursor):span(""," "),h=span(p?C.lavender:C.white,r.label),u=l?span(C.green," "+GLYPH.check):span("",""),i=" ".repeat(Math.max(1,12-[...r.label].length));t.push([span(""," "),o,span(""," "),h,u,span(C.gray,i+r.note)])}return t.push(blank(n)),t.push([span(""," "),span(C.gray,PICKER_HINT)]),fit(t,n)}function renderClassPicker(e,n=0,a=80,s=null,t=null){const r=Array.isArray(e)?e:[],p=e=>("function"==typeof t?t(e):e)||e,l=[];l.push(blank(a)),l.push([span(""," "),span(C.white+BOLD,"Select class"),span(BOLD_OFF,"")]),l.push([span(""," "),span(C.gray,"Which route the next turn takes — who pays, and with which credential.")]),l.push(blank(a));for(let e=0;e<r.length;e++){const a=r[e]||{},t=a.class,o=e===n,h=null!=s&&t===s,u=o?span(C.lavender,GLYPH.cursor):span(""," "),i=p(t),c=span(o?C.lavender:C.white,i),d=h?span(C.green," "+GLYPH.check):span("",""),g=" ".repeat(Math.max(1,14-[...i].length)),y="byok"===t?a.configured?"your key, relayed by AEGIS — billed a handling fee":"needs a provider key: /byok-key <provider>":"the pool — your AEGIS account key pays for it";l.push([span(""," "),u,span(""," "),c,d,span(C.gray,g+y)])}return l.push(blank(a)),l.push([span(""," "),span(C.gray,PICKER_HINT)]),fit(l,a)}function renderResumeList(e,n=0,a=80,s=24,t=""){const r=Array.isArray(e)?e:[],p=String(null==t?"":t),l=[];l.push(blank(a)),l.push([span(""," "),span(C.gray,"─".repeat(Math.max(10,a-4)))]),l.push([span(""," "),span(C.white+BOLD,"Resume session"),span(C.gray,` (${r.length?n+1:0} of ${r.length})`),span(BOLD_OFF,"")]);const o=Math.max(10,a-4),h=p||"⌕ Search…",u=p?C.white:C.dim,i=Math.max(4,o-5),c=h.length>i?"…"+h.slice(h.length-(i-1)):h;l.push([span(""," "),span(C.gray,"╭"+"─".repeat(Math.max(0,o-2))+"╮")]),l.push([span(""," "),span(C.gray,"│"),span(u," "+c),span(p?C.lavender:""," "),span(""," ".repeat(Math.max(0,o-3-w(c)-(p?1:0)))),span(C.gray,"│")]),l.push([span(""," "),span(C.gray,"╰"+"─".repeat(Math.max(0,o-2))+"╯")]),l.push(blank(a));const d=Math.max(2,Math.min(6,s-16));r.length||l.push([span(""," "),span(C.gray,p?`no session matches “${p}”`:"No previous sessions found.")]);const g=Math.max(0,Math.min(n-Math.floor(d/2),Math.max(0,r.length-d))),y=r.slice(g,g+d);for(let e=0;e<y.length;e++){const a=y[e]||{},s=g+e===n,t=s?span(C.lavender,GLYPH.cursor):span(""," "),r=a.own?span(C.green,GLYPH.star+" "):span(C.gray,GLYPH.bullet+" "),p=span(s?C.white+BOLD:C.white,a.summary||"(untitled)");l.push([span(""," "),t,span(""," "),r,p]),l.push([span(""," "),span(C.gray,`${a.cwd||"~"} ${GLYPH.bullet} ${ago(a.time)}`)])}for(;l.length<6+2*d;)l.push(blank(a));return l.push([span(""," "),span(C.gray,"─".repeat(Math.max(10,a-4)))]),l.push([span(""," "),span(C.gray,`Ctrl+A all projects ${GLYPH.bullet} Space to preview ${GLYPH.bullet} Type to search ${GLYPH.bullet} Esc to cancel`)]),fit(l,a)}function ago(e){if(!e)return"";const n=Date.now()-new Date(String(e)).getTime();return n>=0&&!Number.isNaN(n)?n<6e4?`${Math.max(1,Math.round(n/1e3))}s ago`:n<36e5?`${Math.round(n/6e4)}m ago`:n<864e5?`${Math.round(n/36e5)}h ago`:`${Math.round(n/864e5)}d ago`:""}function renderProviderPicker(e,n=0,a=80,s=null,t=null){const r=Array.isArray(e)?e:[],p=[];p.push(blank(a)),p.push([span(""," "),span(C.white+BOLD,"Select provider"),span(BOLD_OFF,"")]),p.push([span(""," "),span(C.gray,"Which vendor the key you are about to paste belongs to.")]),p.push(blank(a));for(let e=0;e<r.length;e++){const a=r[e]||{},t=String(a.id||"");if(!t)continue;const l=e===n,o=null!=s&&t===s,h=l?span(C.lavender,GLYPH.cursor):span(""," "),u=span(l?C.lavender:C.white,t),i=o?span(C.green," "+GLYPH.check):span("",""),c=String(a.label||""),d=" ".repeat(Math.max(1,16-[...t].length)),g=a.configured?span(C.green,"set"+(a.masked?` (${a.masked})`:"")):span(C.gray,"not set");p.push([span(""," "),h,span(""," "),u,i,span(C.gray,d+(c?`${c} · `:"")),g])}return p.push(blank(a)),p.push([span(""," "),span(C.gray,t||`↑↓ or tab move ${GLYPH.bullet} enter picks ${GLYPH.bullet} esc cancels`)]),fit(p,a)}module.exports={boldMatched:boldMatched,renderPalette:renderPalette,renderModelPicker:renderModelPicker,renderEffortPicker:renderEffortPicker,renderClassPicker:renderClassPicker,renderProviderPicker:renderProviderPicker,renderResumeList:renderResumeList,EFFORT_LEVELS:EFFORT_LEVELS,EFFORT_VALUES:EFFORT_VALUES,PICKER_HINT:PICKER_HINT};
|
package/vendor/cli/src/theme.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";const{caps:caps,detect:detect,onCapsChange:onCapsChange,rgb:rgb,bg:bg}=require("./caps.js"),{STAR:STAR,stencilGlyph:stencilGlyph}=require("./art.js"),RESET="[0m",BOLD="[1m",DIM="[2m",ITALIC="[3m",UNDER="[4m",BOLD_OFF="[22m",ITALIC_OFF="[23m",UNDER_OFF="[24m",RESET_FG="[39m",RESET_BG="[49m",RGB=(e,t,n)=>rgb(e,t,n),BG=(e,t,n)=>bg(e,t,n),C={},LIGHT={},CB_DARK={},CB_LIGHT={},ANSI_DARK={},ANSI_LIGHT={};function buildDark(){return{gold:RGB(255,193,7),coral:RGB(215,119,87),lavender:RGB(177,185,249),blue:RGB(120,160,250),green:RGB(78,186,101),red:RGB(220,90,90),gray:RGB(153,153,153),dim:RGB(80,80,80),white:RGB(255,255,255),black:RGB(30,30,30),darkBg:RGB(20,20,20)}}function buildLight(){return{gold:RGB(180,130,0),coral:RGB(190,100,70),lavender:RGB(120,130,220),blue:RGB(70,110,220),green:RGB(60,150,80),red:RGB(200,60,60),gray:RGB(110,110,110),dim:RGB(170,170,170),white:RGB(40,40,40),black:RGB(245,245,245),darkBg:RGB(255,255,255)}}function buildCbDark(){return{...buildDark(),green:RGB(86,182,194),red:RGB(255,146,43),gold:RGB(255,203,71)}}function buildCbLight(){return{...buildLight(),green:RGB(30,130,145),red:RGB(200,100,20),gold:RGB(150,110,0)}}const A=e=>caps().color?`[${e}m`:"";function buildAnsiDark(){return{gold:A(93),coral:A(91),lavender:A(94),blue:A(94),green:A(92),red:A(91),gray:A(90),dim:A(90),white:A(97),black:A(40),darkBg:caps().color?"[48;5;236m":""}}function buildAnsiLight(){return{gold:A(33),coral:A(31),lavender:A(34),blue:A(34),green:A(32),red:A(31),gray:A(90),dim:A(37),white:A(30),black:A(47),darkBg:caps().color?"[48;5;254m":""}}const DIFF={},DIFF_LIGHT={};function buildDiff(){return{delFg:RGB(220,90,90),delBg:BG(61,1,0),delHiFg:RGB(248,248,242),delHiBg:BG(92,2,0),addFg:RGB(80,200,80),addBg:BG(2,40,0),addHiFg:RGB(255,255,255),addHiBg:BG(4,71,0),codeFg:RGB(248,248,242),gutter:RGB(120,120,120),kw:RGB(102,217,239),fn:RGB(166,226,46),str:RGB(230,219,116),num:RGB(174,129,255),comment:RGB(117,113,94)}}function buildDiffLight(){return{delFg:RGB(160,40,40),delBg:BG(255,235,233),delHiFg:RGB(90,0,0),delHiBg:BG(255,205,200),addFg:RGB(30,130,40),addBg:BG(232,250,232),addHiFg:RGB(0,80,0),addHiBg:BG(195,240,195),codeFg:RGB(40,40,40),gutter:RGB(150,150,150),kw:RGB(0,120,160),fn:RGB(80,140,0),str:RGB(150,110,0),num:RGB(120,60,200),comment:RGB(140,140,130)}}const THEMES={dark:C,light:LIGHT},THEME_TABLE=[{name:"Auto",note:"(match terminal)",light:!1,palette:C},{name:"Dark mode",note:"",light:!1,palette:C},{name:"Light mode",note:"",light:!0,palette:LIGHT},{name:"Dark mode",note:"(colorblind-friendly)",light:!1,palette:CB_DARK},{name:"Light mode",note:"(colorblind-friendly)",light:!0,palette:CB_LIGHT},{name:"Dark mode",note:"(ANSI colors only)",light:!1,palette:ANSI_DARK},{name:"Light mode",note:"(ANSI colors only)",light:!0,palette:ANSI_LIGHT}],AUTO_THEME_INDEX=0;function terminalIsLight(e=caps()){return"light"===e.background}function themeIsLight(e,t=caps()){const n=THEME_TABLE[e];return!!n&&(0===e?terminalIsLight(t):!!n.light)}const SIBLING_THEME_INDEX=[0,2,1,4,3,6,5];function themeContradicts(e,t=caps()){const n=THEME_TABLE[e];return!(!n||0===e||!t||!t.backgroundKnown||!!n.light==("light"===t.background))}function reconcileThemeIndex(e,t=caps()){const n=THEME_TABLE[e];if(!themeContradicts(e,t))return{index:e,changed:!1,reason:"",from:n||null};const i=SIBLING_THEME_INDEX[e],r=THEME_TABLE[i],l=e=>`${e.name}${e.note?" "+e.note:""}`;return{index:i,changed:!0,from:n,reason:`saved theme "${l(n)}" is unreadable on this ${t.background} terminal (${t.reasons.background}) — using "${l(r)}" instead`}}function themeForIndex(e){const t=THEME_TABLE[e];return t?t.palette:C}function themeOf(e){return e&&"number"==typeof e.themeIndex&&e.themeIndex>=3&&e.themeIndex<=6?themeForIndex(e.themeIndex):e&&0===e.themeIndex?terminalIsLight()?LIGHT:C:e&&e.light?LIGHT:C}function diffOf(e){return(e&&"number"==typeof e.themeIndex&&e.themeIndex>=3&&e.themeIndex<=6?THEME_TABLE[e.themeIndex].light:e&&0===e.themeIndex?terminalIsLight():e&&e.light)?DIFF_LIGHT:DIFF}function glyphsFor(e=null){const t=e?"string"==typeof e?detect(process.env,process.stdout,e):e:caps(),n="ascii"===t.glyphs,i=n||"edges"===t.face;if(n)return{cursor:">",check:"+",divider:"-",bullet:".",hint:">",pause:"||",star:stencilGlyph(STAR,t),rightarrow:"->",pointer:">",hook:"_|",block:"*",bloom:"*",spin:["|","/","-","\\","*","-"],ellipse:"...",err:"x",warn:"!",rule:"-",ruleHeavy:"="};const r={cursor:"❯",check:"✔",divider:"╌",bullet:"·",hint:"❯",pause:i?"❚❚":"⏸",star:stencilGlyph(STAR,t),rightarrow:"→",pointer:"▸",hook:i?"_|":"⎿",block:"●",bloom:"✻",spin:["✢","·","✻","*","✽","✶"],ellipse:"…",err:"✗",warn:"⚠",rule:"─",ruleHeavy:"━"};return i?{...r,bloom:"*",spin:["|","/","-","\\","*","-"]}:r}const GLYPH=glyphsFor(),VERBS=["Incubating","Tempering","Determining","Beboppin'","Julienning","Inferring","Simmering","Twisting","Fermenting","Fiddle-faddling","Orbiting","Prestidigitating"],DONE_VERBS=["Churned","Worked"];function rematerialize(){Object.assign(C,buildDark()),Object.assign(LIGHT,buildLight()),Object.assign(CB_DARK,buildCbDark()),Object.assign(CB_LIGHT,buildCbLight()),Object.assign(ANSI_DARK,buildAnsiDark()),Object.assign(ANSI_LIGHT,buildAnsiLight()),Object.assign(DIFF,buildDiff()),Object.assign(DIFF_LIGHT,buildDiffLight()),Object.assign(GLYPH,glyphsFor())}rematerialize(),onCapsChange(rematerialize),module.exports={RGB:RGB,BG:BG,RESET:RESET,BOLD:BOLD,DIM:DIM,ITALIC:"[3m",UNDER:UNDER,BOLD_OFF:"[22m",ITALIC_OFF:"[23m",UNDER_OFF:"[24m",RESET_FG:"[39m",RESET_BG:"[49m",C:C,LIGHT:LIGHT,DIFF:DIFF,DIFF_LIGHT:DIFF_LIGHT,diffOf:diffOf,CB_DARK:CB_DARK,CB_LIGHT:CB_LIGHT,ANSI_DARK:ANSI_DARK,ANSI_LIGHT:ANSI_LIGHT,THEMES:THEMES,THEME_TABLE:THEME_TABLE,AUTO_THEME_INDEX:0,themeIsLight:themeIsLight,terminalIsLight:terminalIsLight,themeForIndex:themeForIndex,themeContradicts:themeContradicts,reconcileThemeIndex:reconcileThemeIndex,SIBLING_THEME_INDEX:SIBLING_THEME_INDEX,GLYPH:GLYPH,glyphsFor:glyphsFor,VERBS:VERBS,DONE_VERBS:DONE_VERBS,themeOf:themeOf,rematerialize:rematerialize};
|
|
3
|
+
"use strict";const{caps:caps,detect:detect,onCapsChange:onCapsChange,rgb:rgb,bg:bg}=require("./caps.js"),{STAR:STAR,stencilGlyph:stencilGlyph}=require("./art.js"),RESET="[0m",BOLD="[1m",DIM="[2m",ITALIC="[3m",UNDER="[4m",BOLD_OFF="[22m",ITALIC_OFF="[23m",UNDER_OFF="[24m",RESET_FG="[39m",RESET_BG="[49m",RGB=(e,t,n)=>rgb(e,t,n),BG=(e,t,n)=>bg(e,t,n),C={},LIGHT={},CB_DARK={},CB_LIGHT={},ANSI_DARK={},ANSI_LIGHT={};function buildDark(){return{gold:RGB(255,193,7),coral:RGB(215,119,87),lavender:RGB(177,185,249),blue:RGB(120,160,250),green:RGB(78,186,101),red:RGB(220,90,90),gray:RGB(153,153,153),dim:RGB(80,80,80),white:RGB(255,255,255),black:RGB(30,30,30),darkBg:RGB(20,20,20)}}function buildLight(){return{gold:RGB(180,130,0),coral:RGB(190,100,70),lavender:RGB(120,130,220),blue:RGB(70,110,220),green:RGB(60,150,80),red:RGB(200,60,60),gray:RGB(110,110,110),dim:RGB(170,170,170),white:RGB(40,40,40),black:RGB(245,245,245),darkBg:RGB(255,255,255)}}function buildCbDark(){return{...buildDark(),green:RGB(86,182,194),red:RGB(255,146,43),gold:RGB(255,203,71)}}function buildCbLight(){return{...buildLight(),green:RGB(30,130,145),red:RGB(200,100,20),gold:RGB(150,110,0)}}const A=e=>caps().color?`[${e}m`:"";function buildAnsiDark(){return{gold:A(93),coral:A(91),lavender:A(94),blue:A(94),green:A(92),red:A(91),gray:A(90),dim:A(90),white:A(97),black:A(40),darkBg:caps().color?"[48;5;236m":""}}function buildAnsiLight(){return{gold:A(33),coral:A(31),lavender:A(34),blue:A(34),green:A(32),red:A(31),gray:A(90),dim:A(37),white:A(30),black:A(47),darkBg:caps().color?"[48;5;254m":""}}const DIFF={},DIFF_LIGHT={};function buildDiff(){return{delFg:RGB(220,90,90),delBg:BG(61,1,0),delHiFg:RGB(248,248,242),delHiBg:BG(92,2,0),addFg:RGB(80,200,80),addBg:BG(2,40,0),addHiFg:RGB(255,255,255),addHiBg:BG(4,71,0),codeFg:RGB(248,248,242),gutter:RGB(120,120,120),kw:RGB(102,217,239),fn:RGB(166,226,46),str:RGB(230,219,116),num:RGB(174,129,255),comment:RGB(117,113,94)}}function buildDiffLight(){return{delFg:RGB(160,40,40),delBg:BG(255,235,233),delHiFg:RGB(90,0,0),delHiBg:BG(255,205,200),addFg:RGB(30,130,40),addBg:BG(232,250,232),addHiFg:RGB(0,80,0),addHiBg:BG(195,240,195),codeFg:RGB(40,40,40),gutter:RGB(150,150,150),kw:RGB(0,120,160),fn:RGB(80,140,0),str:RGB(150,110,0),num:RGB(120,60,200),comment:RGB(140,140,130)}}const THEMES={dark:C,light:LIGHT},THEME_TABLE=[{name:"Auto",note:"(match terminal)",light:!1,palette:C},{name:"Dark mode",note:"",light:!1,palette:C},{name:"Light mode",note:"",light:!0,palette:LIGHT},{name:"Dark mode",note:"(colorblind-friendly)",light:!1,palette:CB_DARK},{name:"Light mode",note:"(colorblind-friendly)",light:!0,palette:CB_LIGHT},{name:"Dark mode",note:"(ANSI colors only)",light:!1,palette:ANSI_DARK},{name:"Light mode",note:"(ANSI colors only)",light:!0,palette:ANSI_LIGHT}],AUTO_THEME_INDEX=0;function terminalIsLight(e=caps()){return"light"===e.background}function themeIsLight(e,t=caps()){const n=THEME_TABLE[e];return!!n&&(0===e?terminalIsLight(t):!!n.light)}const SIBLING_THEME_INDEX=[0,2,1,4,3,6,5];function themeContradicts(e,t=caps()){const n=THEME_TABLE[e];return!(!n||0===e||!t||!t.backgroundKnown||!!n.light==("light"===t.background))}function reconcileThemeIndex(e,t=caps()){const n=THEME_TABLE[e];if(!themeContradicts(e,t))return{index:e,changed:!1,reason:"",from:n||null};const i=SIBLING_THEME_INDEX[e],r=THEME_TABLE[i],l=e=>`${e.name}${e.note?" "+e.note:""}`;return{index:i,changed:!0,from:n,reason:`saved theme "${l(n)}" is unreadable on this ${t.background} terminal (${t.reasons.background}) — using "${l(r)}" instead`}}function themeForIndex(e){const t=THEME_TABLE[e];return t?t.palette:C}function themeOf(e){return e&&"number"==typeof e.themeIndex&&e.themeIndex>=3&&e.themeIndex<=6?themeForIndex(e.themeIndex):e&&0===e.themeIndex?terminalIsLight()?LIGHT:C:e&&e.light?LIGHT:C}function diffOf(e){return(e&&"number"==typeof e.themeIndex&&e.themeIndex>=3&&e.themeIndex<=6?THEME_TABLE[e.themeIndex].light:e&&0===e.themeIndex?terminalIsLight():e&&e.light)?DIFF_LIGHT:DIFF}function glyphsFor(e=null){const t=e?"string"==typeof e?detect(process.env,process.stdout,e):e:caps(),n="ascii"===t.glyphs,i=n||"edges"===t.face;if(n)return{cursor:">",check:"+",divider:"-",bullet:".",hint:">",pause:"||",star:stencilGlyph(STAR,t),rightarrow:"->",pointer:">",hook:"_|",block:"*",bloom:"*",spin:["|","/","-","\\","*","-"],ellipse:"...",err:"x",warn:"!",rule:"-",ruleHeavy:"=",caret:"|"};const r={cursor:"❯",check:"✔",divider:"╌",bullet:"·",hint:"❯",pause:i?"❚❚":"⏸",star:stencilGlyph(STAR,t),rightarrow:"→",pointer:"▸",hook:i?"_|":"⎿",block:"●",bloom:"✻",spin:["✢","·","✻","*","✽","✶"],ellipse:"…",err:"✗",warn:"⚠",rule:"─",ruleHeavy:"━",caret:"▎"};return i?{...r,bloom:"*",spin:["|","/","-","\\","*","-"]}:r}const GLYPH=glyphsFor(),VERBS=["Incubating","Tempering","Determining","Beboppin'","Julienning","Inferring","Simmering","Twisting","Fermenting","Fiddle-faddling","Orbiting","Prestidigitating"],DONE_VERBS=["Churned","Worked"];function rematerialize(){Object.assign(C,buildDark()),Object.assign(LIGHT,buildLight()),Object.assign(CB_DARK,buildCbDark()),Object.assign(CB_LIGHT,buildCbLight()),Object.assign(ANSI_DARK,buildAnsiDark()),Object.assign(ANSI_LIGHT,buildAnsiLight()),Object.assign(DIFF,buildDiff()),Object.assign(DIFF_LIGHT,buildDiffLight()),Object.assign(GLYPH,glyphsFor())}rematerialize(),onCapsChange(rematerialize),module.exports={RGB:RGB,BG:BG,RESET:RESET,BOLD:BOLD,DIM:DIM,ITALIC:"[3m",UNDER:UNDER,BOLD_OFF:"[22m",ITALIC_OFF:"[23m",UNDER_OFF:"[24m",RESET_FG:"[39m",RESET_BG:"[49m",C:C,LIGHT:LIGHT,DIFF:DIFF,DIFF_LIGHT:DIFF_LIGHT,diffOf:diffOf,CB_DARK:CB_DARK,CB_LIGHT:CB_LIGHT,ANSI_DARK:ANSI_DARK,ANSI_LIGHT:ANSI_LIGHT,THEMES:THEMES,THEME_TABLE:THEME_TABLE,AUTO_THEME_INDEX:0,themeIsLight:themeIsLight,terminalIsLight:terminalIsLight,themeForIndex:themeForIndex,themeContradicts:themeContradicts,reconcileThemeIndex:reconcileThemeIndex,SIBLING_THEME_INDEX:SIBLING_THEME_INDEX,GLYPH:GLYPH,glyphsFor:glyphsFor,VERBS:VERBS,DONE_VERBS:DONE_VERBS,themeOf:themeOf,rematerialize:rematerialize};
|
|
@@ -134,7 +134,7 @@ const UNITS = Object.freeze([
|
|
|
134
134
|
* (`tools/desktop-seal.mjs` in the source tree, `tools/obfuscate-faces.mjs`
|
|
135
135
|
* after obfuscation), never by hand.
|
|
136
136
|
*/
|
|
137
|
-
const SEALED = '
|
|
137
|
+
const SEALED = '9da3eeddacfa15672a7b1de8f00289cccfa406478ad8d084391fd496996dc2df';
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
140
|
* Ask the question. Never throws — a check that can break the program it is
|
|
@@ -256,6 +256,7 @@ const persistGate = require('./lib/sync/persist-gate.js');
|
|
|
256
256
|
// is the only file in lib/avatar/ that touches a disk.
|
|
257
257
|
const avatarStore = require('./lib/avatar/store.js');
|
|
258
258
|
const windowState = require('./lib/window-state.js');
|
|
259
|
+
const { gpuUsable } = require('./lib/gpu-usable.js');
|
|
259
260
|
const deepLink = require('./lib/deep-link.js');
|
|
260
261
|
const quickLauncherLib = require('./lib/quick-launcher.js');
|
|
261
262
|
// Foreign-memory scanner (shared with client/foreign-memory.js). Same
|
|
@@ -5555,10 +5556,42 @@ function bootstrap() {
|
|
|
5555
5556
|
// Chromium to skip GPU-process creation entirely rather than retry it
|
|
5556
5557
|
// under software rendering — the documented combination for Electron under
|
|
5557
5558
|
// Docker/CI/headless Linux.
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5559
|
+
//
|
|
5560
|
+
// ── but not unconditionally: a real GPU is used when one is present ──────
|
|
5561
|
+
//
|
|
5562
|
+
// The switches below are the CONTAINER answer. Applying them on a desktop
|
|
5563
|
+
// with working hardware was over-correction: it forced the terminal's
|
|
5564
|
+
// xterm.js onto the DOM renderer everywhere, so a full-screen TUI repaint
|
|
5565
|
+
// touched a DOM node per row per frame on machines that had a perfectly
|
|
5566
|
+
// good GPU sitting idle. The terminal is the app's primary surface, so that
|
|
5567
|
+
// cost lands on the main thing the user does.
|
|
5568
|
+
//
|
|
5569
|
+
// So the decision is now measured rather than assumed: `gpuUsable()` below
|
|
5570
|
+
// reports whether this host actually has a graphics device, and the disable
|
|
5571
|
+
// block only runs when it does not. Every case the original comment above
|
|
5572
|
+
// was written for — container, CI, headless server — has no device, so it
|
|
5573
|
+
// still takes the disabled path unchanged, crash-loop and all avoided.
|
|
5574
|
+
//
|
|
5575
|
+
// The probe is a filesystem fact and NOT a Chromium trial: asking Chromium
|
|
5576
|
+
// whether it has a GPU means starting the GPU process, which is the exact
|
|
5577
|
+
// thing that FATAL-exits on the machines this block protects.
|
|
5578
|
+
const gpu = gpuUsable({
|
|
5579
|
+
platform: process.platform,
|
|
5580
|
+
exists: (p) => fs.existsSync(p),
|
|
5581
|
+
readdir: (p) => fs.readdirSync(p),
|
|
5582
|
+
});
|
|
5583
|
+
if (!gpu.usable) {
|
|
5584
|
+
app.disableHardwareAcceleration();
|
|
5585
|
+
app.commandLine.appendSwitch('disable-gpu');
|
|
5586
|
+
app.commandLine.appendSwitch('disable-software-rasterizer');
|
|
5587
|
+
app.commandLine.appendSwitch('disable-gpu-compositing');
|
|
5588
|
+
} else {
|
|
5589
|
+
// The GPU is real. Allow the GPU process the block below would have
|
|
5590
|
+
// suppressed, and keep the software-rasterizer gate off so Chromium can
|
|
5591
|
+
// still fall back per-context if a single context fails (a stale driver,
|
|
5592
|
+
// a lost context) rather than taking the whole window down.
|
|
5593
|
+
app.commandLine.appendSwitch('ignore-gpu-blocklist');
|
|
5594
|
+
}
|
|
5562
5595
|
// The three switches above stop the GPU process being created, but they do
|
|
5563
5596
|
// NOT stop the persistent shader cache from being opened and written: on a
|
|
5564
5597
|
// launch with no GPU present the cache writer starts, misses, and reports
|
|
@@ -5572,7 +5605,10 @@ function bootstrap() {
|
|
|
5572
5605
|
// it; the cache itself has to be turned off. This is the switch that does
|
|
5573
5606
|
// that (`log-level` tells Chromium what to SAY, this tells it what to BUILD),
|
|
5574
5607
|
// and with no GPU process to own the cache nothing is lost by disabling it.
|
|
5575
|
-
|
|
5608
|
+
//
|
|
5609
|
+
// Only meaningful when the GPU process is disabled above; on a host with a
|
|
5610
|
+
// real GPU the shader cache is what makes a repaint cheap, so it is left on.
|
|
5611
|
+
if (!gpu.usable) app.commandLine.appendSwitch('disable-gpu-program-cache');
|
|
5576
5612
|
|
|
5577
5613
|
// Chromium asks xdg-desktop-portal for the desktop accent colour on Linux so
|
|
5578
5614
|
// form controls can match the system palette. On this Cinnamon session the
|
|
@@ -6324,6 +6360,9 @@ function bootstrap() {
|
|
|
6324
6360
|
contextIsolation: true,
|
|
6325
6361
|
nodeIntegration: false,
|
|
6326
6362
|
sandbox: true,
|
|
6363
|
+
// A sandboxed preload cannot read process.env, so the GPU answer
|
|
6364
|
+
// reaches the renderer as an argv fact instead. Absent = no GPU.
|
|
6365
|
+
additionalArguments: gpu.usable ? ['--aegis-pty-gpu=1'] : [],
|
|
6327
6366
|
},
|
|
6328
6367
|
});
|
|
6329
6368
|
win.setMenuBarVisibility(false);
|
|
@@ -6955,6 +6994,10 @@ function bootstrap() {
|
|
|
6955
6994
|
nodeIntegration: false,
|
|
6956
6995
|
sandbox: true,
|
|
6957
6996
|
spellcheck: true,
|
|
6997
|
+
// The in-app terminal panel (ON9b) draws in an <iframe> inside this
|
|
6998
|
+
// window, so the GPU answer has to reach THIS renderer for the panel
|
|
6999
|
+
// to pick the WebGL tier. Same argv fact as the detached window.
|
|
7000
|
+
additionalArguments: gpu.usable ? ['--aegis-pty-gpu=1'] : [],
|
|
6958
7001
|
},
|
|
6959
7002
|
});
|
|
6960
7003
|
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
"use strict";const CODE=Object.freeze({BAD_INPUT:"bad_input"});function gpuUsable(e){const r=e||{},a=String(r.platform||""),t="function"==typeof r.exists?r.exists:()=>!1,s="function"==typeof r.readdir?r.readdir:()=>{throw new Error("no readdir injected")};if(!a)return{usable:!1,measured:!1,platform:"",reason:"no platform given: defaulting to the disabled path, which cannot crash-loop"};if("linux"===a){if(!t("/dev/dri"))return{usable:!1,measured:!0,platform:a,reason:"no /dev/dri: this host has no graphics stack (container, CI or headless)"};let r=[];try{r=s("/dev/dri")||[]}catch(e){return{usable:!1,measured:!0,platform:a,reason:`/dev/dri is unreadable (${e&&e.code||e}): treating as no GPU`}}const n=r.find(e=>/^renderD\d+$/.test(String(e)));return n?{usable:!0,measured:!0,platform:a,reason:`found /dev/dri/${n}: hardware acceleration is available`}:{usable:!1,measured:!0,platform:a,reason:`/dev/dri exists but holds no renderD* node (saw: ${r.length?r.join(", "):"nothing"})`}}return"darwin"===a||"win32"===a?{usable:!0,measured:!1,platform:a,reason:"assumed: a desktop host that can run Electron has a usable GPU; the WebGL tier still falls back if not"}:{usable:!1,measured:!1,platform:a,reason:`no GPU probe for ${a}: defaulting to the disabled path`}}module.exports={CODE:CODE,gpuUsable:gpuUsable};
|
|
@@ -134,7 +134,7 @@ const UNITS = Object.freeze([
|
|
|
134
134
|
* (`tools/desktop-seal.mjs` in the source tree, `tools/obfuscate-faces.mjs`
|
|
135
135
|
* after obfuscation), never by hand.
|
|
136
136
|
*/
|
|
137
|
-
const SEALED = '
|
|
137
|
+
const SEALED = '9da3eeddacfa15672a7b1de8f00289cccfa406478ad8d084391fd496996dc2df';
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
140
|
* Ask the question. Never throws — a check that can break the program it is
|
package/vendor/desktop/main.js
CHANGED
|
@@ -256,6 +256,7 @@ const persistGate = require('./lib/sync/persist-gate.js');
|
|
|
256
256
|
// is the only file in lib/avatar/ that touches a disk.
|
|
257
257
|
const avatarStore = require('./lib/avatar/store.js');
|
|
258
258
|
const windowState = require('./lib/window-state.js');
|
|
259
|
+
const { gpuUsable } = require('./lib/gpu-usable.js');
|
|
259
260
|
const deepLink = require('./lib/deep-link.js');
|
|
260
261
|
const quickLauncherLib = require('./lib/quick-launcher.js');
|
|
261
262
|
// Foreign-memory scanner (shared with client/foreign-memory.js). Same
|
|
@@ -5555,10 +5556,42 @@ function bootstrap() {
|
|
|
5555
5556
|
// Chromium to skip GPU-process creation entirely rather than retry it
|
|
5556
5557
|
// under software rendering — the documented combination for Electron under
|
|
5557
5558
|
// Docker/CI/headless Linux.
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5559
|
+
//
|
|
5560
|
+
// ── but not unconditionally: a real GPU is used when one is present ──────
|
|
5561
|
+
//
|
|
5562
|
+
// The switches below are the CONTAINER answer. Applying them on a desktop
|
|
5563
|
+
// with working hardware was over-correction: it forced the terminal's
|
|
5564
|
+
// xterm.js onto the DOM renderer everywhere, so a full-screen TUI repaint
|
|
5565
|
+
// touched a DOM node per row per frame on machines that had a perfectly
|
|
5566
|
+
// good GPU sitting idle. The terminal is the app's primary surface, so that
|
|
5567
|
+
// cost lands on the main thing the user does.
|
|
5568
|
+
//
|
|
5569
|
+
// So the decision is now measured rather than assumed: `gpuUsable()` below
|
|
5570
|
+
// reports whether this host actually has a graphics device, and the disable
|
|
5571
|
+
// block only runs when it does not. Every case the original comment above
|
|
5572
|
+
// was written for — container, CI, headless server — has no device, so it
|
|
5573
|
+
// still takes the disabled path unchanged, crash-loop and all avoided.
|
|
5574
|
+
//
|
|
5575
|
+
// The probe is a filesystem fact and NOT a Chromium trial: asking Chromium
|
|
5576
|
+
// whether it has a GPU means starting the GPU process, which is the exact
|
|
5577
|
+
// thing that FATAL-exits on the machines this block protects.
|
|
5578
|
+
const gpu = gpuUsable({
|
|
5579
|
+
platform: process.platform,
|
|
5580
|
+
exists: (p) => fs.existsSync(p),
|
|
5581
|
+
readdir: (p) => fs.readdirSync(p),
|
|
5582
|
+
});
|
|
5583
|
+
if (!gpu.usable) {
|
|
5584
|
+
app.disableHardwareAcceleration();
|
|
5585
|
+
app.commandLine.appendSwitch('disable-gpu');
|
|
5586
|
+
app.commandLine.appendSwitch('disable-software-rasterizer');
|
|
5587
|
+
app.commandLine.appendSwitch('disable-gpu-compositing');
|
|
5588
|
+
} else {
|
|
5589
|
+
// The GPU is real. Allow the GPU process the block below would have
|
|
5590
|
+
// suppressed, and keep the software-rasterizer gate off so Chromium can
|
|
5591
|
+
// still fall back per-context if a single context fails (a stale driver,
|
|
5592
|
+
// a lost context) rather than taking the whole window down.
|
|
5593
|
+
app.commandLine.appendSwitch('ignore-gpu-blocklist');
|
|
5594
|
+
}
|
|
5562
5595
|
// The three switches above stop the GPU process being created, but they do
|
|
5563
5596
|
// NOT stop the persistent shader cache from being opened and written: on a
|
|
5564
5597
|
// launch with no GPU present the cache writer starts, misses, and reports
|
|
@@ -5572,7 +5605,10 @@ function bootstrap() {
|
|
|
5572
5605
|
// it; the cache itself has to be turned off. This is the switch that does
|
|
5573
5606
|
// that (`log-level` tells Chromium what to SAY, this tells it what to BUILD),
|
|
5574
5607
|
// and with no GPU process to own the cache nothing is lost by disabling it.
|
|
5575
|
-
|
|
5608
|
+
//
|
|
5609
|
+
// Only meaningful when the GPU process is disabled above; on a host with a
|
|
5610
|
+
// real GPU the shader cache is what makes a repaint cheap, so it is left on.
|
|
5611
|
+
if (!gpu.usable) app.commandLine.appendSwitch('disable-gpu-program-cache');
|
|
5576
5612
|
|
|
5577
5613
|
// Chromium asks xdg-desktop-portal for the desktop accent colour on Linux so
|
|
5578
5614
|
// form controls can match the system palette. On this Cinnamon session the
|
|
@@ -6324,6 +6360,9 @@ function bootstrap() {
|
|
|
6324
6360
|
contextIsolation: true,
|
|
6325
6361
|
nodeIntegration: false,
|
|
6326
6362
|
sandbox: true,
|
|
6363
|
+
// A sandboxed preload cannot read process.env, so the GPU answer
|
|
6364
|
+
// reaches the renderer as an argv fact instead. Absent = no GPU.
|
|
6365
|
+
additionalArguments: gpu.usable ? ['--aegis-pty-gpu=1'] : [],
|
|
6327
6366
|
},
|
|
6328
6367
|
});
|
|
6329
6368
|
win.setMenuBarVisibility(false);
|
|
@@ -6955,6 +6994,10 @@ function bootstrap() {
|
|
|
6955
6994
|
nodeIntegration: false,
|
|
6956
6995
|
sandbox: true,
|
|
6957
6996
|
spellcheck: true,
|
|
6997
|
+
// The in-app terminal panel (ON9b) draws in an <iframe> inside this
|
|
6998
|
+
// window, so the GPU answer has to reach THIS renderer for the panel
|
|
6999
|
+
// to pick the WebGL tier. Same argv fact as the detached window.
|
|
7000
|
+
additionalArguments: gpu.usable ? ['--aegis-pty-gpu=1'] : [],
|
|
6958
7001
|
},
|
|
6959
7002
|
});
|
|
6960
7003
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "aegis-desktop",
|
|
3
3
|
"productName": "aegis one",
|
|
4
4
|
"desktopName": "aegis-desktop",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.61",
|
|
6
6
|
"description": "Thin Electron host for AEGIS — a local chat UI over the shared client/aegis.js transport. Ships transport + UI only; engine logic stays server-side.",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "AEGIS Code",
|
|
@@ -82,11 +82,11 @@
|
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"bytenode": "2.1.0",
|
|
85
|
-
"electron": "44.
|
|
85
|
+
"electron": "44.11.5",
|
|
86
86
|
"electron-builder": "^26.15.3"
|
|
87
87
|
},
|
|
88
88
|
"optionalDependencies": {
|
|
89
|
-
"electron": "44.
|
|
89
|
+
"electron": "44.11.5",
|
|
90
90
|
"node-pty": "^1.1.0"
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";const{contextBridge:contextBridge,ipcRenderer:ipcRenderer}=require("electron"),IPC_PREFIX="aegis:",MODEL_PREFIX="model:",SYNC_PREFIX="sync:",QUICK_PREFIX="quick:",QUEUE_PREFIX="queue:",AUTO_PREFIX="auto:",QUEUE_PROGRESS_CHANNEL="queue:progress",QUEUE_CHANGED_CHANNEL="queue:changed",CHAT_DELTA_CHANNEL="aegis:chatDelta",PTY_EVENT_CHANNEL="aegis:ptyEvent"
|
|
3
|
+
"use strict";const{contextBridge:contextBridge,ipcRenderer:ipcRenderer}=require("electron"),IPC_PREFIX="aegis:",MODEL_PREFIX="model:",SYNC_PREFIX="sync:",QUICK_PREFIX="quick:",QUEUE_PREFIX="queue:",AUTO_PREFIX="auto:",QUEUE_PROGRESS_CHANNEL="queue:progress",QUEUE_CHANGED_CHANNEL="queue:changed",CHAT_DELTA_CHANNEL="aegis:chatDelta",PTY_EVENT_CHANNEL="aegis:ptyEvent";function ptyGpuFromArgv(){try{return(process&&Array.isArray(process.argv)?process.argv:[]).includes("--aegis-pty-gpu=1")}catch{return!1}}const UPDATE_STATUS_CHANNEL="aegis:updateStatus",ACCOUNT_STATUS_CHANNEL="aegis:accountStatusChanged",MENU_NEW_CHAT_CHANNEL="aegis:menuNewChat",MENU_SEARCH_CHANNEL="aegis:menuSearch",MENU_SEARCH_MEMORY_CHANNEL="aegis:menuSearchMemory",MENU_CREDITS_CHANNEL="aegis:menuCredits",MENU_PALETTE_CHANNEL="aegis:menuPalette",MENU_TOGGLE_SIDEBAR_CHANNEL="aegis:menuToggleSidebar",MENU_FIND_CHANNEL="aegis:menuFind",MENU_GO_BACK_CHANNEL="aegis:menuGoBack",MENU_GO_FORWARD_CHANNEL="aegis:menuGoForward",MENU_EXPORT_MARKDOWN_CHANNEL="aegis:menuExportMarkdown",MENU_EXPORT_JSON_CHANNEL="aegis:menuExportJson",MENU_FINGERPRINT_CHANNEL="aegis:menuFingerprint",MENU_GOOGLE_DRIVE_CHANNEL="aegis:menuGoogleDrive",DEEP_LINK_CHANNEL="aegis:deepLink",QUICK_LAUNCHER_PUSH_CHANNEL="aegis:quickLauncherPush";function invoke(e,n){return ipcRenderer.invoke("aegis:"+e,void 0===n?void 0:n)}function invokeModel(e,n){return ipcRenderer.invoke("model:"+e,void 0===n?void 0:n)}function invokeSync(e,n){return ipcRenderer.invoke("sync:"+e,void 0===n?void 0:n)}function invokeQuick(e,n){return ipcRenderer.invoke("quick:"+e,void 0===n?void 0:n)}function invokeQueue(e,n){return ipcRenderer.invoke("queue:"+e,void 0===n?void 0:n)}function invokeAuto(e,n){return ipcRenderer.invoke("auto:"+e,void 0===n?void 0:n)}function deltaListener(e,n){const o=e||null;return(e,i)=>{(i&&i.id?i.id:null)===o&&n(i)}}const api={status:()=>invoke("status"),attachments:Object.freeze({pathFor:e=>{try{const{webUtils:n}=require("electron");return n&&"function"==typeof n.getPathForFile&&n.getPathForFile(e)||""}catch{return""}},ingest:e=>invoke("attachments:ingest",{path:String(null==e?"":e)})}),setApiKey:e=>invoke("setApiKey",{key:e}),verifyApiKey:()=>invoke("verifyApiKey"),tokenBankBalance:()=>invoke("tokenBankBalance"),billingCheckout:()=>invoke("billingCheckout"),tokenBankTopup:e=>invoke("tokenBankTopup",{amountEur:e}),listModels:()=>invoke("listModels"),readTextFile:(e,n)=>{try{return ipcRenderer.sendSync("model:readTextFile",{file:e,cwd:n})}catch{return null}},chatCompletion:(e,n)=>{const o=e||{};if("function"!=typeof n)return invoke("chatCompletion",{...o,stream:!1});const i=deltaListener(o.sessionId,n),r=()=>ipcRenderer.removeListener("aegis:chatDelta",i);return ipcRenderer.on("aegis:chatDelta",i),invoke("chatCompletion",{...o,stream:!0}).then(e=>(r(),e),e=>{throw r(),e})},byokStatus:()=>invoke("byokStatus"),byokSet:(e,n)=>invoke("byokSet",{provider:e,apiKey:n}),memorySearch:(e,n)=>invoke("memorySearch",{query:e,limit:n}),memorySave:e=>invoke("memorySave",{entry:e}),memoryList:e=>invoke("memoryList",{limit:e}),verifyToken:e=>invoke("verifyToken",{token:e}),memoryActivate:e=>invoke("memoryActivate",{token:e}),memoryPull:e=>invoke("memoryPull",{since:e}),memorySaveBatch:e=>invoke("memorySaveBatch",{entries:e}),memoryImport:e=>invoke("memoryImport",e||{}),sessionsImportScan:()=>invoke("sessionsImportScan"),sessionsImport:e=>invoke("sessionsImport",e||{}),importConversation:e=>invoke("importConversation",e||{}),openExternal:e=>invoke("openExternal",{url:e}),fingerprintStatus:()=>invoke("fingerprintStatus"),fingerprintKeygen:e=>invoke("fingerprintKeygen",e||{}),fingerprintMint:e=>invoke("fingerprintMint",e||{}),fingerprintVerify:e=>invoke("fingerprintVerify",e||{}),fingerprintBackup:e=>invoke("fingerprintBackup",e||{}),
|
|
4
4
|
// The vault: publish a sealed record (default gdrive:AEGIS-AGPL/records),
|
|
5
|
-
fingerprintPublish:e=>invoke("fingerprintPublish",e||{}),fingerprintAnchor:e=>invoke("fingerprintAnchor",e||{}),fingerprintVault:()=>invoke("fingerprintVault"),fingerprintVaultAudit:()=>invoke("fingerprintVaultAudit"),getConfirmMode:()=>invoke("getConfirmMode"),setConfirmMode:e=>invoke("setConfirmMode",{enabled:Boolean(e)}),getDevMode:()=>invoke("getDevMode"),setDevMode:e=>invoke("setDevMode",{enabled:Boolean(e)}),getModelAutoSync:()=>invoke("getModelAutoSync"),setModelAutoSync:e=>invoke("setModelAutoSync",{enabled:Boolean(e)}),getAccountUsername:()=>invoke("getAccountUsername"),setAccountUsername:e=>invoke("setAccountUsername",{username:null==e?null:String(e)}),getFontScale:()=>invoke("getFontScale"),setFontScale:e=>invoke("setFontScale",{scale:Number(e)}),getAccent:()=>invoke("getAccent"),setAccent:e=>invoke("setAccent",{name:String(e)}),getPermissionMode:()=>invoke("getPermissionMode"),setPermissionMode:e=>invoke("setPermissionMode",{mode:e?"plan":null}),permRulesList:()=>invoke("permRulesList"),permRulesAdd:(e,n)=>invoke("permRulesAdd",{list:String(e||""),rule:String(n||"")}),permRulesRemove:(e,n)=>invoke("permRulesRemove",{list:String(e||""),rule:String(n||"")}),personaRead:()=>invoke("personaRead"),personaPatch:e=>invoke("personaPatch",{patch:e||{}}),getSandboxPolicy:()=>invoke("getSandboxPolicy"),setSandboxPolicy:(e,n)=>invoke("setSandboxPolicy",{mode:String(e||""),network:String(n||"")}),getVaultBackend:()=>invoke("getVaultBackend"),openCliFace:e=>invoke("openCliFace",{args:Array.isArray(e)?e.map(String):[]}),openPtyWindow:()=>invoke("openPtyWindow",{}),closePtyWindow:()=>invoke("closePtyWindow",{}),pty:Object.freeze({hello:()=>invoke("ptyHello",{}),exec:(e,n)=>invoke("ptyExec",{id:e,params:n||{}}),write:(e,n)=>invoke("ptyWrite",{id:e,data:String(null==n?"":n)}),resize:(e,n,o)=>invoke("ptyResize",{id:e,cols:Number(n)||0,rows:Number(o)||0}),cancel:e=>invoke("ptyCancel",{id:e}),onEvent:(e,n)=>{const o=(o,i)=>{i&&i.id===e&&n(i)};return ipcRenderer.on("aegis:ptyEvent",o),()=>ipcRenderer.removeListener("aegis:ptyEvent",o)}}),setVaultBackend:e=>invoke("setVaultBackend",{backend:String(e||"")}),telemetryEvent:(e,n)=>{const o=n||{};return invoke("telemetryEvent",{event:null==e?"":String(e),campaign:null==o.campaign?null:String(o.campaign),surface:null==o.surface?null:String(o.surface)})},telemetryReport:()=>invoke("telemetryReport"),covenantStatus:()=>invoke("covenantStatus"),covenantGapReport:()=>invoke("covenantGapReport"),getMemoryPersist:()=>invoke("memoryPersist.get"),setMemoryPersist:e=>invoke("memoryPersist.set",{enabled:Boolean(e)}),checkForUpdates:()=>invoke("checkForUpdates"),downloadUpdate:()=>invoke("downloadUpdate"),quitAndInstallUpdate:()=>invoke("quitAndInstallUpdate"),updateStatus:()=>invoke("updateStatus"),onUpdateStatus:e=>{const n=(n,o)=>e(o);return ipcRenderer.on("aegis:updateStatus",n),()=>ipcRenderer.removeListener("aegis:updateStatus",n)},accountStatus:()=>invoke("accountStatus"),registerAccount:()=>invoke("registerAccount"),onAccountStatus:e=>{const n=(n,o)=>e(o);return ipcRenderer.on(ACCOUNT_STATUS_CHANNEL,n),()=>ipcRenderer.removeListener(ACCOUNT_STATUS_CHANNEL,n)},driveSignIn:()=>invoke("driveSignIn"),driveConnect:()=>invoke("driveConnect"),driveStatus:()=>invoke("driveStatus"),driveSyncMemory:()=>invoke("driveSyncMemory"),driveBackupConversation:e=>invoke("driveBackupConversation",{sessionId:e}),speechStatus:()=>invoke("speechStatus"),speechSet:e=>{const n=e||{},o={};return"boolean"==typeof n.enabled&&(o.enabled=n.enabled),"string"==typeof n.engine&&(o.engine="local"===n.engine?"local":"none"),"string"==typeof n.model&&(o.model=n.model),"string"==typeof n.language&&(o.language=n.language),null!=n.maxSeconds&&Number.isFinite(Number(n.maxSeconds))&&(o.maxSeconds=Number(n.maxSeconds)),invoke("speechSet",o)},speechTranscribe:e=>{const n=e||{};return invoke("speechTranscribe",{audio:n.audio,ext:null==n.ext?"webm":String(n.ext)})},skillsList:()=>invoke("skillsList"),skillsRead:e=>invoke("skillsRead",{name:String(null==e?"":e)}),skillsCreate:e=>{const n=e||{};return invoke("skillsCreate",{name:String(null==n.name?"":n.name),description:String(null==n.description?"":n.description),body:String(null==n.body?"":n.body),targetDir:String(null==n.targetDir?"":n.targetDir)})},skillsRemove:e=>invoke("skillsRemove",{name:String(null==e?"":e)}),skillsImport:e=>{const n=e||{};return invoke("skillsImport",{url:String(null==n.url?"":n.url),name:String(null==n.name?"":n.name),targetDir:String(null==n.targetDir?"":n.targetDir)})},onMenuNewChat:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuNewChat",n),()=>ipcRenderer.removeListener("aegis:menuNewChat",n)},onMenuSearch:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuSearch",n),()=>ipcRenderer.removeListener("aegis:menuSearch",n)},onMenuSearchMemory:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuSearchMemory",n),()=>ipcRenderer.removeListener("aegis:menuSearchMemory",n)},onMenuCredits:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuCredits",n),()=>ipcRenderer.removeListener("aegis:menuCredits",n)},credits:()=>invoke("credits"),onMenuPalette:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuPalette",n),()=>ipcRenderer.removeListener("aegis:menuPalette",n)},onMenuToggleSidebar:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuToggleSidebar",n),()=>ipcRenderer.removeListener("aegis:menuToggleSidebar",n)},onMenuFind:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuFind",n),()=>ipcRenderer.removeListener("aegis:menuFind",n)},onMenuGoBack:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuGoBack",n),()=>ipcRenderer.removeListener("aegis:menuGoBack",n)},onMenuGoForward:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuGoForward",n),()=>ipcRenderer.removeListener("aegis:menuGoForward",n)},setNavState:e=>invoke("setNavState",e),onMenuExportMarkdown:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuExportMarkdown",n),()=>ipcRenderer.removeListener("aegis:menuExportMarkdown",n)},onMenuFingerprint:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuFingerprint",n),()=>ipcRenderer.removeListener("aegis:menuFingerprint",n)},onMenuGoogleDrive:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuGoogleDrive",n),()=>ipcRenderer.removeListener("aegis:menuGoogleDrive",n)},onMenuExportJson:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuExportJson",n),()=>ipcRenderer.removeListener("aegis:menuExportJson",n)},exportSession:(e,n)=>invoke("exportSession",{sessionId:e,format:n}),onDeepLink:e=>{const n=(n,o)=>e(o);return ipcRenderer.on("aegis:deepLink",n),()=>ipcRenderer.removeListener("aegis:deepLink",n)},onQuickLauncherPush:e=>{const n=(n,o)=>e(o);return ipcRenderer.on("aegis:quickLauncherPush",n),()=>ipcRenderer.removeListener("aegis:quickLauncherPush",n)}},models={listClasses:()=>invokeModel("listClasses"),listModels:e=>invokeModel("listModels",{class:e}),chat:(e,n)=>{const o=e||{};if("function"!=typeof n)return invokeModel("chat",o);const i=deltaListener(o.sessionId,n),r=()=>ipcRenderer.removeListener("aegis:chatDelta",i);return ipcRenderer.on("aegis:chatDelta",i),invokeModel("chat",o).then(e=>(r(),e),e=>{throw r(),e})},settings:{get:()=>invokeModel("settings.get"),set:(e,n)=>invokeModel("settings.set",{provider:e,baseURL:n&&n.baseURL,key:n&&n.key}),remove:e=>invokeModel("settings.remove",{provider:e})},userModels:{get:()=>invokeModel("userModels.get"),add:(e,n)=>invokeModel("userModels.add",{provider:e,model:n}),remove:(e,n)=>invokeModel("userModels.remove",{provider:e,model:n}),discover:e=>invokeModel("userModels.discover",{provider:e}),addAll:(e,n)=>invokeModel("userModels.addAll",{provider:e,ids:n}),canDiscover:e=>invokeModel("userModels.canDiscover",{provider:e}),discoverable:()=>invokeModel("userModels.discoverable"),syncPlan:e=>invokeModel("userModels.syncPlan",{only:e}),syncApply:(e,n)=>invokeModel("userModels.syncApply",{plan:e,only:n}),syncStatus:()=>invokeModel("userModels.syncStatus"),syncNow:e=>invokeModel("userModels.syncNow",{only:e})},cancel:e=>invokeModel("cancel",{sessionId:e}),respondApproval:(e,n)=>invokeModel("respondApproval",{approvalId:e,decision:n}),respondRoundsAsk:(e,n)=>invokeModel("respondRoundsAsk",{roundsAskId:e,decision:n}),clearApprovals:e=>invokeModel("clearApprovals",{sessionId:e}),listUndoable:e=>invokeModel("listUndoable",{sessionId:e}),undoMutation:(e,n)=>invokeModel("undoMutation",{sessionId:e,id:n})},sync={listSessions:()=>invokeSync("listSessions"),searchSessions:(e,n)=>invokeSync("searchSessions",{query:e,limit:n}),open:e=>invokeSync("open",{sessionId:e}),save:e=>invokeSync("save",e||{}),nameSession:e=>invokeSync("nameSession",{sessionId:e&&e.sessionId,prompt:e&&e.prompt,class:e&&e.class,model:e&&e.model}),append:(e,n)=>invokeSync("append",{sessionId:e,message:n}),delete:e=>invokeSync("delete",{sessionId:e}),rename:(e,n)=>invokeSync("rename",{sessionId:e,title:n}),push:()=>invokeSync("push"),pull:()=>invokeSync("pull"),status:()=>invokeSync("status"),auto:()=>invokeSync("auto"),memoryPersistState:()=>invokeSync("memoryPersistState")},quickLauncher={status:()=>invokeQuick("status"),setConfig:e=>invokeQuick("setConfig",{enabled:e&&e.enabled,shortcut:e&&e.shortcut}),pushToMain:e=>invokeQuick("pushToMain",e||{})},queue={enqueue:e=>invokeQueue("enqueue",queueTaskFields(e)),list:()=>invokeQueue("list"),clear:e=>invokeQueue("clear",{all:Boolean(e)}),entitlement:e=>invokeQueue("entitlement",{force:Boolean(e)}),retry:e=>queueWithId("retry",e),remove:e=>queueWithId("remove",e),drain:()=>invokeQueue("drain",{}),proceed:()=>invokeQueue("proceed",{}),stop:e=>{const n=queueTaskId(e);return invokeQueue("stop",null==n?{}:{id:n})},onProgress:e=>{if("function"!=typeof e)return()=>{};const n=(n,o)=>e(o);return ipcRenderer.on("queue:progress",n),()=>ipcRenderer.removeListener("queue:progress",n)},onChanged:e=>{if("function"!=typeof e)return()=>{};const n=()=>e();return ipcRenderer.on("queue:changed",n),()=>ipcRenderer.removeListener("queue:changed",n)}},auto={status:()=>invokeAuto("autoStatus"),setDrain:e=>{const n=e||{},o={enabled:Boolean(n.enabled)};return null!=n.intervalMs&&Number.isFinite(Number(n.intervalMs))&&(o.intervalMs=Number(n.intervalMs)),invokeAuto("autoSetDrain",o)},setMint:e=>{const n=e||{};return invokeAuto("autoSetMint",{enabled:Boolean(n.enabled),publish:Boolean(n.publish)})},sealNow:e=>invokeAuto("autoSealNow",{publish:Boolean(e)})};function queueTaskId(e){const n=Number(e);return Number.isInteger(n)&&n>0?n:null}function queueWithId(e,n){const o=queueTaskId(n);return null==o?Promise.resolve({ok:!1,reason:`${e} needs a task id`}):invokeQueue(e,{id:o})}function queueTaskFields(e){const n=e||{};return{task:String(null==n.task?"":n.task),cwd:String(null==n.cwd?"":n.cwd),class:null==n.class?null:String(n.class),model:null==n.model?null:String(n.model),effort:null==n.effort?null:String(n.effort),workers:null==n.workers?null:Number(n.workers),maxRounds:null==n.maxRounds?null:Number(n.maxRounds),fanout:Boolean(n.fanout),commit:Boolean(n.commit)}}contextBridge.exposeInMainWorld("aegis",Object.freeze(api)),contextBridge.exposeInMainWorld("models",Object.freeze(models)),contextBridge.exposeInMainWorld("sync",Object.freeze(sync)),contextBridge.exposeInMainWorld("quickLauncher",Object.freeze(quickLauncher)),contextBridge.exposeInMainWorld("queue",Object.freeze(queue)),contextBridge.exposeInMainWorld("auto",Object.freeze(auto));
|
|
5
|
+
fingerprintPublish:e=>invoke("fingerprintPublish",e||{}),fingerprintAnchor:e=>invoke("fingerprintAnchor",e||{}),fingerprintVault:()=>invoke("fingerprintVault"),fingerprintVaultAudit:()=>invoke("fingerprintVaultAudit"),getConfirmMode:()=>invoke("getConfirmMode"),setConfirmMode:e=>invoke("setConfirmMode",{enabled:Boolean(e)}),getDevMode:()=>invoke("getDevMode"),setDevMode:e=>invoke("setDevMode",{enabled:Boolean(e)}),getModelAutoSync:()=>invoke("getModelAutoSync"),setModelAutoSync:e=>invoke("setModelAutoSync",{enabled:Boolean(e)}),getAccountUsername:()=>invoke("getAccountUsername"),setAccountUsername:e=>invoke("setAccountUsername",{username:null==e?null:String(e)}),getFontScale:()=>invoke("getFontScale"),setFontScale:e=>invoke("setFontScale",{scale:Number(e)}),getAccent:()=>invoke("getAccent"),setAccent:e=>invoke("setAccent",{name:String(e)}),getPermissionMode:()=>invoke("getPermissionMode"),setPermissionMode:e=>invoke("setPermissionMode",{mode:e?"plan":null}),permRulesList:()=>invoke("permRulesList"),permRulesAdd:(e,n)=>invoke("permRulesAdd",{list:String(e||""),rule:String(n||"")}),permRulesRemove:(e,n)=>invoke("permRulesRemove",{list:String(e||""),rule:String(n||"")}),personaRead:()=>invoke("personaRead"),personaPatch:e=>invoke("personaPatch",{patch:e||{}}),getSandboxPolicy:()=>invoke("getSandboxPolicy"),setSandboxPolicy:(e,n)=>invoke("setSandboxPolicy",{mode:String(e||""),network:String(n||"")}),getVaultBackend:()=>invoke("getVaultBackend"),openCliFace:e=>invoke("openCliFace",{args:Array.isArray(e)?e.map(String):[]}),openPtyWindow:()=>invoke("openPtyWindow",{}),closePtyWindow:()=>invoke("closePtyWindow",{}),pty:Object.freeze({gpu:ptyGpuFromArgv(),hello:()=>invoke("ptyHello",{}),exec:(e,n)=>invoke("ptyExec",{id:e,params:n||{}}),write:(e,n)=>invoke("ptyWrite",{id:e,data:String(null==n?"":n)}),resize:(e,n,o)=>invoke("ptyResize",{id:e,cols:Number(n)||0,rows:Number(o)||0}),cancel:e=>invoke("ptyCancel",{id:e}),onEvent:(e,n)=>{const o=(o,i)=>{i&&i.id===e&&n(i)};return ipcRenderer.on("aegis:ptyEvent",o),()=>ipcRenderer.removeListener("aegis:ptyEvent",o)}}),setVaultBackend:e=>invoke("setVaultBackend",{backend:String(e||"")}),telemetryEvent:(e,n)=>{const o=n||{};return invoke("telemetryEvent",{event:null==e?"":String(e),campaign:null==o.campaign?null:String(o.campaign),surface:null==o.surface?null:String(o.surface)})},telemetryReport:()=>invoke("telemetryReport"),covenantStatus:()=>invoke("covenantStatus"),covenantGapReport:()=>invoke("covenantGapReport"),getMemoryPersist:()=>invoke("memoryPersist.get"),setMemoryPersist:e=>invoke("memoryPersist.set",{enabled:Boolean(e)}),checkForUpdates:()=>invoke("checkForUpdates"),downloadUpdate:()=>invoke("downloadUpdate"),quitAndInstallUpdate:()=>invoke("quitAndInstallUpdate"),updateStatus:()=>invoke("updateStatus"),onUpdateStatus:e=>{const n=(n,o)=>e(o);return ipcRenderer.on("aegis:updateStatus",n),()=>ipcRenderer.removeListener("aegis:updateStatus",n)},accountStatus:()=>invoke("accountStatus"),registerAccount:()=>invoke("registerAccount"),onAccountStatus:e=>{const n=(n,o)=>e(o);return ipcRenderer.on(ACCOUNT_STATUS_CHANNEL,n),()=>ipcRenderer.removeListener(ACCOUNT_STATUS_CHANNEL,n)},driveSignIn:()=>invoke("driveSignIn"),driveConnect:()=>invoke("driveConnect"),driveStatus:()=>invoke("driveStatus"),driveSyncMemory:()=>invoke("driveSyncMemory"),driveBackupConversation:e=>invoke("driveBackupConversation",{sessionId:e}),speechStatus:()=>invoke("speechStatus"),speechSet:e=>{const n=e||{},o={};return"boolean"==typeof n.enabled&&(o.enabled=n.enabled),"string"==typeof n.engine&&(o.engine="local"===n.engine?"local":"none"),"string"==typeof n.model&&(o.model=n.model),"string"==typeof n.language&&(o.language=n.language),null!=n.maxSeconds&&Number.isFinite(Number(n.maxSeconds))&&(o.maxSeconds=Number(n.maxSeconds)),invoke("speechSet",o)},speechTranscribe:e=>{const n=e||{};return invoke("speechTranscribe",{audio:n.audio,ext:null==n.ext?"webm":String(n.ext)})},skillsList:()=>invoke("skillsList"),skillsRead:e=>invoke("skillsRead",{name:String(null==e?"":e)}),skillsCreate:e=>{const n=e||{};return invoke("skillsCreate",{name:String(null==n.name?"":n.name),description:String(null==n.description?"":n.description),body:String(null==n.body?"":n.body),targetDir:String(null==n.targetDir?"":n.targetDir)})},skillsRemove:e=>invoke("skillsRemove",{name:String(null==e?"":e)}),skillsImport:e=>{const n=e||{};return invoke("skillsImport",{url:String(null==n.url?"":n.url),name:String(null==n.name?"":n.name),targetDir:String(null==n.targetDir?"":n.targetDir)})},onMenuNewChat:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuNewChat",n),()=>ipcRenderer.removeListener("aegis:menuNewChat",n)},onMenuSearch:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuSearch",n),()=>ipcRenderer.removeListener("aegis:menuSearch",n)},onMenuSearchMemory:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuSearchMemory",n),()=>ipcRenderer.removeListener("aegis:menuSearchMemory",n)},onMenuCredits:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuCredits",n),()=>ipcRenderer.removeListener("aegis:menuCredits",n)},credits:()=>invoke("credits"),onMenuPalette:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuPalette",n),()=>ipcRenderer.removeListener("aegis:menuPalette",n)},onMenuToggleSidebar:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuToggleSidebar",n),()=>ipcRenderer.removeListener("aegis:menuToggleSidebar",n)},onMenuFind:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuFind",n),()=>ipcRenderer.removeListener("aegis:menuFind",n)},onMenuGoBack:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuGoBack",n),()=>ipcRenderer.removeListener("aegis:menuGoBack",n)},onMenuGoForward:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuGoForward",n),()=>ipcRenderer.removeListener("aegis:menuGoForward",n)},setNavState:e=>invoke("setNavState",e),onMenuExportMarkdown:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuExportMarkdown",n),()=>ipcRenderer.removeListener("aegis:menuExportMarkdown",n)},onMenuFingerprint:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuFingerprint",n),()=>ipcRenderer.removeListener("aegis:menuFingerprint",n)},onMenuGoogleDrive:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuGoogleDrive",n),()=>ipcRenderer.removeListener("aegis:menuGoogleDrive",n)},onMenuExportJson:e=>{const n=()=>e();return ipcRenderer.on("aegis:menuExportJson",n),()=>ipcRenderer.removeListener("aegis:menuExportJson",n)},exportSession:(e,n)=>invoke("exportSession",{sessionId:e,format:n}),onDeepLink:e=>{const n=(n,o)=>e(o);return ipcRenderer.on("aegis:deepLink",n),()=>ipcRenderer.removeListener("aegis:deepLink",n)},onQuickLauncherPush:e=>{const n=(n,o)=>e(o);return ipcRenderer.on("aegis:quickLauncherPush",n),()=>ipcRenderer.removeListener("aegis:quickLauncherPush",n)}},models={listClasses:()=>invokeModel("listClasses"),listModels:e=>invokeModel("listModels",{class:e}),chat:(e,n)=>{const o=e||{};if("function"!=typeof n)return invokeModel("chat",o);const i=deltaListener(o.sessionId,n),r=()=>ipcRenderer.removeListener("aegis:chatDelta",i);return ipcRenderer.on("aegis:chatDelta",i),invokeModel("chat",o).then(e=>(r(),e),e=>{throw r(),e})},settings:{get:()=>invokeModel("settings.get"),set:(e,n)=>invokeModel("settings.set",{provider:e,baseURL:n&&n.baseURL,key:n&&n.key}),remove:e=>invokeModel("settings.remove",{provider:e})},userModels:{get:()=>invokeModel("userModels.get"),add:(e,n)=>invokeModel("userModels.add",{provider:e,model:n}),remove:(e,n)=>invokeModel("userModels.remove",{provider:e,model:n}),discover:e=>invokeModel("userModels.discover",{provider:e}),addAll:(e,n)=>invokeModel("userModels.addAll",{provider:e,ids:n}),canDiscover:e=>invokeModel("userModels.canDiscover",{provider:e}),discoverable:()=>invokeModel("userModels.discoverable"),syncPlan:e=>invokeModel("userModels.syncPlan",{only:e}),syncApply:(e,n)=>invokeModel("userModels.syncApply",{plan:e,only:n}),syncStatus:()=>invokeModel("userModels.syncStatus"),syncNow:e=>invokeModel("userModels.syncNow",{only:e})},cancel:e=>invokeModel("cancel",{sessionId:e}),respondApproval:(e,n)=>invokeModel("respondApproval",{approvalId:e,decision:n}),respondRoundsAsk:(e,n)=>invokeModel("respondRoundsAsk",{roundsAskId:e,decision:n}),clearApprovals:e=>invokeModel("clearApprovals",{sessionId:e}),listUndoable:e=>invokeModel("listUndoable",{sessionId:e}),undoMutation:(e,n)=>invokeModel("undoMutation",{sessionId:e,id:n})},sync={listSessions:()=>invokeSync("listSessions"),searchSessions:(e,n)=>invokeSync("searchSessions",{query:e,limit:n}),open:e=>invokeSync("open",{sessionId:e}),save:e=>invokeSync("save",e||{}),nameSession:e=>invokeSync("nameSession",{sessionId:e&&e.sessionId,prompt:e&&e.prompt,class:e&&e.class,model:e&&e.model}),append:(e,n)=>invokeSync("append",{sessionId:e,message:n}),delete:e=>invokeSync("delete",{sessionId:e}),rename:(e,n)=>invokeSync("rename",{sessionId:e,title:n}),push:()=>invokeSync("push"),pull:()=>invokeSync("pull"),status:()=>invokeSync("status"),auto:()=>invokeSync("auto"),memoryPersistState:()=>invokeSync("memoryPersistState")},quickLauncher={status:()=>invokeQuick("status"),setConfig:e=>invokeQuick("setConfig",{enabled:e&&e.enabled,shortcut:e&&e.shortcut}),pushToMain:e=>invokeQuick("pushToMain",e||{})},queue={enqueue:e=>invokeQueue("enqueue",queueTaskFields(e)),list:()=>invokeQueue("list"),clear:e=>invokeQueue("clear",{all:Boolean(e)}),entitlement:e=>invokeQueue("entitlement",{force:Boolean(e)}),retry:e=>queueWithId("retry",e),remove:e=>queueWithId("remove",e),drain:()=>invokeQueue("drain",{}),proceed:()=>invokeQueue("proceed",{}),stop:e=>{const n=queueTaskId(e);return invokeQueue("stop",null==n?{}:{id:n})},onProgress:e=>{if("function"!=typeof e)return()=>{};const n=(n,o)=>e(o);return ipcRenderer.on("queue:progress",n),()=>ipcRenderer.removeListener("queue:progress",n)},onChanged:e=>{if("function"!=typeof e)return()=>{};const n=()=>e();return ipcRenderer.on("queue:changed",n),()=>ipcRenderer.removeListener("queue:changed",n)}},auto={status:()=>invokeAuto("autoStatus"),setDrain:e=>{const n=e||{},o={enabled:Boolean(n.enabled)};return null!=n.intervalMs&&Number.isFinite(Number(n.intervalMs))&&(o.intervalMs=Number(n.intervalMs)),invokeAuto("autoSetDrain",o)},setMint:e=>{const n=e||{};return invokeAuto("autoSetMint",{enabled:Boolean(n.enabled),publish:Boolean(n.publish)})},sealNow:e=>invokeAuto("autoSealNow",{publish:Boolean(e)})};function queueTaskId(e){const n=Number(e);return Number.isInteger(n)&&n>0?n:null}function queueWithId(e,n){const o=queueTaskId(n);return null==o?Promise.resolve({ok:!1,reason:`${e} needs a task id`}):invokeQueue(e,{id:o})}function queueTaskFields(e){const n=e||{};return{task:String(null==n.task?"":n.task),cwd:String(null==n.cwd?"":n.cwd),class:null==n.class?null:String(n.class),model:null==n.model?null:String(n.model),effort:null==n.effort?null:String(n.effort),workers:null==n.workers?null:Number(n.workers),maxRounds:null==n.maxRounds?null:Number(n.maxRounds),fanout:Boolean(n.fanout),commit:Boolean(n.commit)}}contextBridge.exposeInMainWorld("aegis",Object.freeze(api)),contextBridge.exposeInMainWorld("models",Object.freeze(models)),contextBridge.exposeInMainWorld("sync",Object.freeze(sync)),contextBridge.exposeInMainWorld("quickLauncher",Object.freeze(quickLauncher)),contextBridge.exposeInMainWorld("queue",Object.freeze(queue)),contextBridge.exposeInMainWorld("auto",Object.freeze(auto));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";const PTY_PANEL_FRAME_SRC="pty-frame.html",PTY_PANEL_FRAME_ROOT="pty-frame-root";function ptyPanelCreateId(){return"undefined"!=typeof window&&window.crypto&&"function"==typeof window.crypto.randomUUID?window.crypto.randomUUID():`pty-${Date.now()}-${Math.random().toString(36).slice(2)}`}const ptyPanelSessions=new Map;let ptyPanelNextLabel=1,ptyPanelShell=null;function ptyPanelBuildShell(){const e=document.createElement("div");return e.className="pty-panel-overlay",e.innerHTML='<div class="pty-panel" role="dialog" aria-label="Terminal"><div class="pty-panel-header"><span class="pty-panel-tabs" role="tablist" aria-label="Terminal sessions"></span><button type="button" class="pty-panel-new" aria-label="New terminal" title="New terminal">+</button><button type="button" class="pty-panel-close" aria-label="Close terminal" title="Close this terminal">×</button></div><div class="pty-panel-body"></div></div>',e}function ptyPanelMount(e){const t=ptyPanelShell;if(!t)return!1;const n=t.querySelector(".pty-panel-tabs"),l=t.querySelector(".pty-panel-body");if(!n||!l)return!1;const a=document.createElement("button");a.type="button",a.className="pty-panel-tab",a.setAttribute("role","tab"),a.setAttribute("aria-selected","false"),a.textContent=e.label,a.addEventListener("click",()=>ptyPanelActivate(e)),n.appendChild(a);const o=document.createElement("div");o.className="pty-panel-slot",o.hidden=!0;const
|
|
3
|
+
"use strict";const PTY_PANEL_FRAME_SRC="pty-frame.html",PTY_PANEL_FRAME_ROOT="pty-frame-root";function ptyPanelCreateId(){return"undefined"!=typeof window&&window.crypto&&"function"==typeof window.crypto.randomUUID?window.crypto.randomUUID():`pty-${Date.now()}-${Math.random().toString(36).slice(2)}`}const ptyPanelSessions=new Map;let ptyPanelNextLabel=1,ptyPanelShell=null;function ptyPanelBuildShell(){const e=document.createElement("div");return e.className="pty-panel-overlay",e.innerHTML='<div class="pty-panel" role="dialog" aria-label="Terminal"><div class="pty-panel-header"><span class="pty-panel-tabs" role="tablist" aria-label="Terminal sessions"></span><button type="button" class="pty-panel-new" aria-label="New terminal" title="New terminal">+</button><button type="button" class="pty-panel-close" aria-label="Close terminal" title="Close this terminal">×</button></div><div class="pty-panel-body"></div></div>',e}function ptyPanelMount(e){const t=ptyPanelShell;if(!t)return!1;const n=t.querySelector(".pty-panel-tabs"),l=t.querySelector(".pty-panel-body");if(!n||!l)return!1;const a=document.createElement("button");a.type="button",a.className="pty-panel-tab",a.setAttribute("role","tab"),a.setAttribute("aria-selected","false"),a.textContent=e.label,a.addEventListener("click",()=>ptyPanelActivate(e)),n.appendChild(a);const o=document.createElement("div");o.className="pty-panel-slot",o.hidden=!0;const i=document.createElement("iframe");return i.className="pty-panel-frame",i.title=`Terminal ${e.label} (aegiscode)`,i.src="pty-frame.html",o.appendChild(i),l.appendChild(o),e.tab=a,e.slot=o,e.frame=i,!0}function ptyPanelActivate(e){if(e&&!e.closed){for(const t of ptyPanelSessions.values()){const n=t===e;t.slot&&(t.slot.hidden=!n),t.tab&&(t.tab.classList.toggle("is-active",n),t.tab.setAttribute("aria-selected",n?"true":"false"))}if(ptyPanelShell.active=e.id,e.term&&e.host){const t=e.term,n=e.host;requestAnimationFrame(()=>{e.closed||e.slot.hidden||ptyPanelFit(t,n)})}e.term&&e.term.focus()}}function ptyPanelTeardown(e){if(e){e.closed=!0;try{e.unsubscribe&&e.unsubscribe()}catch{}try{window.aegis.pty.cancel(e.id)}catch{}try{e.term&&e.term.dispose()}catch{}try{e.resizeObserver&&e.resizeObserver.disconnect()}catch{}e.tab&&e.tab.parentNode&&e.tab.parentNode.removeChild(e.tab),e.slot&&e.slot.parentNode&&e.slot.parentNode.removeChild(e.slot)}}function ptyPanelClose(e){const t=e?ptyPanelSessions.get(e):ptyPanelSessions.get(ptyPanelShell&&ptyPanelShell.active);if(!t)return;if(ptyPanelSessions.delete(t.id),ptyPanelTeardown(t),0===ptyPanelSessions.size)return void ptyPanelCloseAll();const n=Array.from(ptyPanelSessions.values());ptyPanelActivate(n[n.length-1])}function ptyPanelCloseAll(){for(const e of Array.from(ptyPanelSessions.values()))ptyPanelSessions.delete(e.id),ptyPanelTeardown(e);ptyPanelShell&&ptyPanelShell.parentNode&&ptyPanelShell.parentNode.removeChild(ptyPanelShell),ptyPanelShell=null}function ptyPanelFontFamily(e){try{return e.getComputedStyle(e.document.documentElement).getPropertyValue("--font-mono").trim()||"monospace"}catch{return"monospace"}}function ptyPanelAttachRenderer(e,t){const n=t&&t.aegisPtyRenderer;return n&&"function"==typeof n.attach?n.attach(e,{win:t,bridge:window.aegis}):{tier:"dom",addon:null,tried:["dom"],errors:[]}}function ptyPanelFail(e,t){if(!e||!e.slot)return;const n=document.createElement("p");n.className="pty-panel-note",n.textContent=t,e.slot.appendChild(n)}function ptyPanelBoot(e){if(!e||e.closed||e.term)return;const t=e.frame&&e.frame.contentWindow,n=t&&t.document,l=n&&n.getElementById("pty-frame-root");if(!t||"function"!=typeof t.Terminal||!l)return void ptyPanelFail(e,"the terminal panel is not available in this build (xterm.js missing)");const a=new t.Terminal({convertEol:!0,cursorBlink:!1,fontSize:13,fontFamily:ptyPanelFontFamily(t)});e.term=a,e.host=l,a.open(l),e.renderer=ptyPanelAttachRenderer(a,t),ptyPanelFit(a,l),ptyPanelSettle(e,a,l);const o=t.document.fonts;o&&"object"==typeof o.ready&&"function"==typeof o.ready.then&&o.ready.then(()=>{e.closed||e.slot.hidden||ptyPanelFit(a,l)});const i=e.id;e.unsubscribe=window.aegis.pty.onEvent(i,e=>{const t=e&&e.p;t&&("data"===t.kind?a.write(t.chunk):"exit"===t.kind&&a.write("\r\n[process exited]\r\n"))}),e.slot&&"function"==typeof ResizeObserver&&(e.resizeObserver=new ResizeObserver(()=>{ptyPanelFitting!==a&&ptyPanelFit(a,l)}),e.resizeObserver.observe(e.slot)),a.onData(e=>window.aegis.pty.write(i,e)),a.onResize(({cols:e,rows:t})=>window.aegis.pty.resize(i,e,t)),window.aegis.pty.exec(i,{cols:a.cols,rows:a.rows}).then(e=>{e&&e.ok||a.write(`\r\n[could not start: ${e&&e.e&&e.e.msg||"unknown error"}]\r\n`)}),a.focus()}function ptyPanelOpen(){if("undefined"==typeof window||void 0===window.aegis||!window.aegis.pty)return{ok:!1,reason:"the terminal panel bridge is not available in this build"};ptyPanelShell||(ptyPanelShell=ptyPanelBuildShell(),document.body.appendChild(ptyPanelShell),ptyPanelShell.querySelector(".pty-panel-new").addEventListener("click",()=>ptyPanelOpen()),ptyPanelShell.querySelector(".pty-panel-close").addEventListener("click",()=>ptyPanelClose()),ptyPanelShell.addEventListener("keydown",e=>{"Escape"===e.key&&ptyPanelClose()}));const e={id:ptyPanelCreateId(),label:String(ptyPanelNextLabel++),tab:null,slot:null,frame:null,term:null,host:null,unsubscribe:null,resizeObserver:null,closed:!1};return ptyPanelSessions.set(e.id,e),ptyPanelMount(e)?(ptyPanelActivate(e),e.frame&&e.frame.addEventListener("load",()=>ptyPanelBoot(e)),{ok:!0,id:e.id}):(ptyPanelSessions.delete(e.id),{ok:!1,reason:"could not build the terminal panel"})}let ptyPanelFitting=null;function ptyPanelSettle(e,t,n){let l=null,a=0;const o=()=>{if(!e||e.closed||e.term!==t)return;if(a>=3)return;a+=1;let i=null;try{const e=ptyPanelFit(t,n);i=e?`${e.cols}x${e.rows}`:null}catch{return}i&&i===l||(l=i,"function"==typeof requestAnimationFrame&&requestAnimationFrame(o))};"function"==typeof requestAnimationFrame&&requestAnimationFrame(o)}function ptyPanelPad(e,t,n){const l=e=>{const t=parseFloat(e);return Number.isFinite(t)?t:0};return l(e&&e[t])+l(e&&e[n])}function ptyPanelFit(e,t){const n=e._core,l=n&&n._renderService&&n._renderService.dimensions&&n._renderService.dimensions.css.cell;if(!l||!l.width||!l.height)return null;const a=(t.ownerDocument&&t.ownerDocument.defaultView||window).getComputedStyle(t),o=ptyPanelPad(a,"paddingLeft","paddingRight"),i=ptyPanelPad(a,"paddingTop","paddingBottom"),s=Math.max(2,Math.floor((t.clientWidth-o)/l.width)),r=Math.max(1,Math.floor((t.clientHeight-i)/l.height));if(s!==e.cols||r!==e.rows){ptyPanelFitting=e;try{e.resize(s,r)}finally{ptyPanelFitting=null}}return{cols:s,rows:r}}function ptyPanelIsOpen(){return ptyPanelSessions.size>0}"undefined"!=typeof module&&module.exports&&(module.exports={createId:ptyPanelCreateId,open:ptyPanelOpen,close:ptyPanelClose,closeAll:ptyPanelCloseAll,isOpen:ptyPanelIsOpen,count:()=>ptyPanelSessions.size,FRAME_SRC:"pty-frame.html",FRAME_ROOT:"pty-frame-root"}),"undefined"!=typeof window&&(window.aegisPtyPanel={open:ptyPanelOpen,close:ptyPanelClose,closeAll:ptyPanelCloseAll,isOpen:ptyPanelIsOpen,count:()=>ptyPanelSessions.size});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
"use strict";const PTY_RENDER_TIERS=Object.freeze(["webgl","canvas","dom"]);function ptyGpuAllowed(n){const e=(n||{}).pty;return Boolean(e)&&!0===e.gpu}function addonCtor(n,e){return"function"==typeof n?n:n&&"object"==typeof n&&"function"==typeof n[e]?n[e]:null}function ptyRenderPlan(n){const e=n||{},o=e.win||{},t=[];return ptyGpuAllowed(e.bridge)&&addonCtor(o.WebglAddon,"WebglAddon")&&t.push("webgl"),addonCtor(o.CanvasAddon,"CanvasAddon")&&t.push("canvas"),t.push("dom"),t}function ptyAttachRenderer(n,e){const o=e||{},t=o.win||{},d=ptyRenderPlan(o),r=[],a=[];for(const e of d){if(r.push(e),"dom"===e)return"function"==typeof o.onTier&&o.onTier("dom",null),{tier:"dom",addon:null,tried:r,errors:a};const d="webgl"===e?addonCtor(t.WebglAddon,"WebglAddon"):addonCtor(t.CanvasAddon,"CanvasAddon");if("function"==typeof d)try{const t=new d;return n.loadAddon(t),"function"==typeof o.onTier&&o.onTier(e,t),{tier:e,addon:t,tried:r,errors:a}}catch(n){a.push(`${e}: ${n&&n.message||n}`);continue}else a.push(`${e}: addon is not loaded`)}return{tier:"dom",addon:null,tried:r,errors:a}}"undefined"!=typeof window&&(window.aegisPtyRenderer={TIERS:PTY_RENDER_TIERS,gpuAllowed:ptyGpuAllowed,ctor:addonCtor,plan:ptyRenderPlan,attach:ptyAttachRenderer}),"undefined"!=typeof module&&module.exports&&(module.exports={PTY_RENDER_TIERS:PTY_RENDER_TIERS,addonCtor:addonCtor,ptyGpuAllowed:ptyGpuAllowed,ptyRenderPlan:ptyRenderPlan,ptyAttachRenderer:ptyAttachRenderer});
|
|
@@ -67,6 +67,9 @@
|
|
|
67
67
|
</div>
|
|
68
68
|
<div id="pty-win-body"></div>
|
|
69
69
|
<script src="vendor/xterm.js"></script>
|
|
70
|
+
<script src="vendor/addon-canvas.js"></script>
|
|
71
|
+
<script src="vendor/addon-webgl.js"></script>
|
|
72
|
+
<script src="pty-renderer.js"></script>
|
|
70
73
|
<script src="pty-window.js"></script>
|
|
71
74
|
</body>
|
|
72
75
|
</html>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
2
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
-
"use strict";const ptyWinSessions=new Map;let ptyWinNextLabel=1,ptyWinActive=null;function ptyWinId(){return window.crypto&&"function"==typeof window.crypto.randomUUID?window.crypto.randomUUID():`pty-${Date.now()}-${Math.random().toString(36).slice(2)}`}let ptyWinFitting=null;function ptyWinFit(t,e){const n=t&&t._core,i=n&&n._renderService&&n._renderService.dimensions&&n._renderService.dimensions.css.cell;if(!i||!i.width||!i.height)return null;const o=Math.max(2,Math.floor(e.clientWidth/i.width)),
|
|
3
|
+
"use strict";const ptyWinSessions=new Map;let ptyWinNextLabel=1,ptyWinActive=null;function ptyWinId(){return window.crypto&&"function"==typeof window.crypto.randomUUID?window.crypto.randomUUID():`pty-${Date.now()}-${Math.random().toString(36).slice(2)}`}let ptyWinFitting=null;function ptyPad(t,e,n){const i=t=>{const e=parseFloat(t);return Number.isFinite(e)?e:0};return i(t&&t[e])+i(t&&t[n])}function ptyWinFit(t,e){const n=t&&t._core,i=n&&n._renderService&&n._renderService.dimensions&&n._renderService.dimensions.css.cell;if(!i||!i.width||!i.height)return null;const o=ptyPad(getComputedStyle(e),"paddingLeft","paddingRight"),s=ptyPad(getComputedStyle(e),"paddingTop","paddingBottom"),r=Math.max(2,Math.floor((e.clientWidth-o)/i.width)),l=Math.max(1,Math.floor((e.clientHeight-s)/i.height));if(r!==t.cols||l!==t.rows){ptyWinFitting=t;try{t.resize(r,l)}finally{ptyWinFitting=null}}return{cols:r,rows:l}}function ptyWinFontFamily(){return getComputedStyle(document.documentElement).getPropertyValue("--font-mono").trim()||"ui-monospace, SFMono-Regular, Menlo, monospace"}function ptyWinSettle(t,e,n){let i=null,o=0;const s=()=>{if(!t||t.closed||t.term!==e)return;if(o>=3)return;o+=1;let r=null;try{const t=ptyWinFit(e,n);r=t?`${t.cols}x${t.rows}`:null}catch{return}r&&r===i||(i=r,"function"==typeof requestAnimationFrame&&requestAnimationFrame(s))};"function"==typeof requestAnimationFrame&&requestAnimationFrame(s)}function ptyWinActivate(t){if(t&&!t.closed){for(const e of ptyWinSessions.values()){const n=e===t;e.slot&&(e.slot.hidden=!n),e.tab&&(e.tab.classList.toggle("is-active",n),e.tab.setAttribute("aria-selected",n?"true":"false"))}if(ptyWinActive=t.id,t.term&&t.slot){const e=t.term,n=t.slot;requestAnimationFrame(()=>{t.closed||ptyWinFit(e,n)})}t.term&&t.term.focus()}}function ptyWinTeardown(t){if(t){t.closed=!0;try{t.unsubscribe&&t.unsubscribe()}catch{}try{t.ro&&t.ro.disconnect()}catch{}try{window.aegis.pty.cancel(t.id)}catch{}if(ptyWinSessions.delete(t.id),t.tab&&t.tab.remove&&t.tab.remove(),t.slot&&t.slot.remove&&t.slot.remove(),ptyWinActive===t.id){const t=ptyWinSessions.values().next().value||null;ptyWinActive=null,t&&ptyWinActivate(t)}}}function ptyWinClose(t){const e=t?ptyWinSessions.get(t):ptyWinActive&&ptyWinSessions.get(ptyWinActive);e&&ptyWinTeardown(e),0===ptyWinSessions.size&&window.aegis&&"function"==typeof window.aegis.closePtyWindow&&window.aegis.closePtyWindow()}function ptyWinFail(t,e){const n=document.createElement("div");n.className="pty-win-note",n.textContent=e,t.slot&&t.slot.appendChild(n)}function ptyWinAttachRenderer(t){const e="undefined"!=typeof window?window.aegisPtyRenderer:null;return e&&"function"==typeof e.attach?e.attach(t,{win:window,bridge:window.aegis}):{tier:"dom",addon:null,tried:["dom"],errors:[]}}function ptyWinStart(){if("undefined"==typeof window||!window.aegis||!window.aegis.pty)return document.getElementById("pty-win-body").innerHTML='<div class="pty-win-note">the terminal bridge is not available in this build</div>',null;if("function"!=typeof window.Terminal)return document.getElementById("pty-win-body").innerHTML='<div class="pty-win-note">xterm.js is missing from this build — the terminal cannot render</div>',null;const t=document.getElementById("pty-win-tabs"),e=document.getElementById("pty-win-body"),n=ptyWinId(),i=String(ptyWinNextLabel++),o=document.createElement("button");o.type="button",o.className="pty-win-tab",o.setAttribute("role","tab"),o.textContent=i,o.title=`Terminal ${i} — click to switch, middle-click to close`;const s=document.createElement("div");s.className="pty-win-slot",s.hidden=!0;const r={id:n,label:i,tab:o,slot:s,term:null,unsubscribe:null,ro:null,closed:!1};ptyWinSessions.set(n,r),o.addEventListener("click",()=>ptyWinActivate(r)),o.addEventListener("auxclick",t=>{1===t.button&&(t.preventDefault(),ptyWinClose(n))}),t.appendChild(o),e.appendChild(s);const l=new window.Terminal({convertEol:!0,cursorBlink:!1,fontSize:13,fontFamily:ptyWinFontFamily(),allowProposedApi:!0});r.term=l,l.open(s),r.renderer=ptyWinAttachRenderer(l),ptyWinFit(l,s),ptyWinSettle(r,l,s);const c=document.fonts;return c&&c.ready&&"function"==typeof c.ready.then&&c.ready.then(()=>{r.closed||ptyWinFit(l,s)}),r.unsubscribe=window.aegis.pty.onEvent(n,t=>{const e=t&&t.p;e&&("data"===e.kind?l.write(e.chunk):"exit"===e.kind&&l.write("\r\n[process exited]\r\n"))}),"function"==typeof ResizeObserver&&(r.ro=new ResizeObserver(()=>{ptyWinFitting!==l&&ptyWinFit(l,s)}),r.ro.observe(e)),l.onData(t=>window.aegis.pty.write(n,t)),l.onResize(({cols:t,rows:e})=>window.aegis.pty.resize(n,t,e)),window.aegis.pty.exec(n,{cols:l.cols,rows:l.rows}).then(t=>{t&&t.ok||l.write(`\r\n[could not start: ${t&&t.e&&t.e.msg||"unknown error"}]\r\n`)}),ptyWinActivate(r),r}window.addEventListener("DOMContentLoaded",()=>{const t=document.getElementById("pty-win-new");t&&t.addEventListener("click",()=>ptyWinStart()),window.addEventListener("keydown",t=>{t.ctrlKey&&t.shiftKey&&("T"===t.key||"t"===t.key)?(t.preventDefault(),ptyWinStart()):t.ctrlKey&&t.shiftKey&&("W"===t.key||"w"===t.key)&&(t.preventDefault(),ptyWinClose())}),ptyWinStart()}),window.aegisPtyWindow={start:ptyWinStart,close:ptyWinClose,count:()=>ptyWinSessions.size,active:()=>ptyWinActive,renderers:()=>[...ptyWinSessions.values()].map(t=>t.renderer&&t.renderer.tier||"dom"),inspect:()=>{const t=ptyWinActive?ptyWinSessions.get(ptyWinActive):null;if(!t||!t.term)return null;const e=t.term,n=e.buffer&&e.buffer.active;let i="";if(n&&"function"==typeof n.getLine){const t=[];for(let e=0;e<n.length;e+=1){const i=n.getLine(e);i&&t.push("function"==typeof i.translateToString?i.translateToString(!0):i.text||"")}i=t.join("\n")}const o=t.slot,s=o?o.querySelectorAll("canvas"):[];return{tier:t.renderer&&t.renderer.tier||"dom",text:i,fontFamily:e.options&&e.options.fontFamily||null,cols:e.cols,rows:e.rows,canvases:s.length,canvasSize:s.length?[s[0].width,s[0].height]:null,slotSize:o?[o.clientWidth,o.clientHeight]:null}}};
|