aegisone 1.0.39 → 1.0.41
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/LICENSING.md +186 -0
- package/README.md +2 -2
- package/bin/aegis.js +1 -1
- package/package.json +3 -2
- package/scripts/predist.mjs +1 -1
- package/src/child.js +1 -1
- package/src/permissions.js +1 -1
- package/vendor/cli/package.json +4 -2
- package/vendor/cli/src/app.js +1 -1
- package/vendor/cli/src/chatflow.js +1 -1
- package/vendor/cli/src/commands.js +3 -1
- package/vendor/cli/src/config.js +1 -1
- package/vendor/cli/src/diff.js +1 -1
- package/vendor/cli/src/diffview.js +1 -1
- package/vendor/cli/src/engine.js +1 -1
- package/vendor/cli/src/history.js +1 -1
- package/vendor/cli/src/models.js +1 -1
- package/vendor/cli/src/overlays.js +1 -1
- package/vendor/cli/src/panels.js +1 -1
- package/vendor/cli/vendor/client/brain-catalog.js +1 -1
- package/vendor/cli/vendor/client/byok-catalog.js +1 -1
- package/vendor/cli/vendor/client/credits.js +45 -0
- package/vendor/cli/vendor/client/foreign-sessions.js +3 -0
- package/vendor/cli/vendor/client/naming.js +1 -1
- package/vendor/cli/vendor/client/prefs.js +1 -1
- package/vendor/cli/vendor/client/session-search.js +3 -0
- package/vendor/cli/vendor/desktop/lib/local/claude-pro.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/engine.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/integrity.js +42 -2
- package/vendor/cli/vendor/desktop/lib/local/perm-rules.js +206 -0
- package/vendor/cli/vendor/desktop/lib/local/perm-store.js +298 -0
- package/vendor/cli/vendor/desktop/lib/local/perm-write.js +199 -0
- package/vendor/cli/vendor/desktop/lib/local/pro-sessions.js +3 -0
- package/vendor/cli/vendor/desktop/lib/local/sandbox-appcontainer.js +242 -0
- package/vendor/cli/vendor/desktop/lib/local/sandbox-bwrap.js +316 -0
- package/vendor/cli/vendor/desktop/lib/local/sandbox-seatbelt.js +380 -0
- package/vendor/cli/vendor/desktop/lib/local/sandbox.js +493 -0
- package/vendor/cli/vendor/desktop/lib/local/shell.js +155 -20
- package/vendor/cli/vendor/desktop/lib/local/tools.js +29 -4
- package/vendor/cli/vendor/desktop/lib/settings.js +1 -1
- package/vendor/cli/vendor/desktop/main.js +774 -37
- package/vendor/cli/vendor/desktop/renderer/usage.js +1 -1
- package/vendor/cli/vendor/mcp/admission.js +3 -0
- package/vendor/cli/vendor/mcp/server.js +1 -1
- package/vendor/cli/vendor/one/src/child.js +1 -1
- package/vendor/cli/vendor/one/src/permissions.js +1 -1
- package/vendor/desktop/bin/aegis.js +1 -1
- package/vendor/desktop/lib/local/claude-pro.js +1 -1
- package/vendor/desktop/lib/local/engine.js +1 -1
- package/vendor/desktop/lib/local/integrity.js +42 -2
- package/vendor/desktop/lib/local/perm-rules.js +206 -0
- package/vendor/desktop/lib/local/perm-store.js +298 -0
- package/vendor/desktop/lib/local/perm-write.js +199 -0
- package/vendor/desktop/lib/local/pro-sessions.js +3 -0
- package/vendor/desktop/lib/local/sandbox-appcontainer.js +242 -0
- package/vendor/desktop/lib/local/sandbox-bwrap.js +316 -0
- package/vendor/desktop/lib/local/sandbox-seatbelt.js +380 -0
- package/vendor/desktop/lib/local/sandbox.js +493 -0
- package/vendor/desktop/lib/local/shell.js +155 -20
- package/vendor/desktop/lib/local/tools.js +29 -4
- package/vendor/desktop/lib/settings.js +1 -1
- package/vendor/desktop/lib/sync/memory-store.js +3 -0
- package/vendor/desktop/main.js +774 -37
- package/vendor/desktop/package.json +19 -7
- package/vendor/desktop/preload.js +1 -1
- package/vendor/desktop/renderer/app.js +5 -1
- package/vendor/desktop/renderer/diff.js +1 -1
- package/vendor/desktop/renderer/diffview.js +1 -1
- package/vendor/desktop/renderer/index.html +221 -5
- package/vendor/desktop/renderer/provider-mark.js +1 -1
- package/vendor/desktop/renderer/provider-toolbar.js +1 -1
- package/vendor/desktop/renderer/providers.js +1 -1
- package/vendor/desktop/renderer/style.css +223 -6
- package/vendor/desktop/renderer/usage.js +1 -1
- package/vendor/desktop/vendor/brain-catalog.js +1 -1
- package/vendor/desktop/vendor/byok-catalog.js +1 -1
- package/vendor/desktop/vendor/credits.js +45 -0
- package/vendor/desktop/vendor/faces/cli/package.json +3 -2
- 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/commands.js +3 -1
- package/vendor/desktop/vendor/faces/cli/src/config.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/diff.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/diffview.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/engine.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/history.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/models.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/overlays.js +1 -1
- package/vendor/desktop/vendor/faces/cli/src/panels.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/brain-catalog.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/byok-catalog.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/credits.js +45 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/foreign-sessions.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/client/naming.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/prefs.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/client/session-search.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/claude-pro.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/engine.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/lib/local/perm-rules.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/perm-store.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/perm-write.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/pro-sessions.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/sandbox-appcontainer.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/sandbox-bwrap.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/sandbox-seatbelt.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/sandbox.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/shell.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/local/tools.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/lib/settings.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/main.js +4 -2
- package/vendor/desktop/vendor/faces/cli/vendor/desktop/renderer/usage.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/mcp/admission.js +3 -0
- package/vendor/desktop/vendor/faces/cli/vendor/mcp/server.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/one/src/child.js +1 -1
- package/vendor/desktop/vendor/faces/cli/vendor/one/src/permissions.js +1 -1
- package/vendor/desktop/vendor/foreign-sessions.js +3 -0
- package/vendor/desktop/vendor/naming.js +1 -1
- package/vendor/desktop/vendor/prefs.js +1 -1
- package/vendor/desktop/vendor/sandbox/provenance.json +20 -0
- package/vendor/desktop/vendor/sandbox/x64-linux/bwrap +0 -0
- package/vendor/desktop/vendor/session-search.js +3 -0
|
@@ -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";let fs=null,path=null;try{"function"==typeof require&&(fs=require("node:fs"),path=require("node:path"))}catch{fs=null,path=null}const DIFF_LIMITS={fileBytes:262144,lcsCells:25e4,rows:400,context:3};function splitLines(t){const e=String(null==t?"":t).replace(/\r\n?/g,"\n");if(""===e)return[];const n=e.split("\n");return n.length&&""===n[n.length-1]&&n.pop(),n}function lineDiff(t,e){const n=splitLines(t),s=splitLines(e);let i=0;for(;i<n.length&&i<s.length&&n[i]===s[i];)i++;let l=0;for(;l<n.length-i&&l<s.length-i&&n[n.length-1-l]===s[s.length-1-l];)l++;const r=n.slice(i,n.length-l),o=s.slice(i,s.length-l),
|
|
3
|
+
"use strict";let fs=null,path=null;try{"function"==typeof require&&(fs=require("node:fs"),path=require("node:path"))}catch{fs=null,path=null}const DIFF_LIMITS={fileBytes:262144,lcsCells:25e4,rows:400,context:3};function splitLines(t){const e=String(null==t?"":t).replace(/\r\n?/g,"\n");if(""===e)return[];const n=e.split("\n");return n.length&&""===n[n.length-1]&&n.pop(),n}function lineDiff(t,e){const n=splitLines(t),s=splitLines(e);let i=0;for(;i<n.length&&i<s.length&&n[i]===s[i];)i++;let l=0;for(;l<n.length-i&&l<s.length-i&&n[n.length-1-l]===s[s.length-1-l];)l++;const r=n.slice(i,n.length-l),o=s.slice(i,s.length-l),c=lcsOps(r,o),a=null===c,u=c||[...r.map((t=>({sign:"-",text:t}))),...o.map((t=>({sign:"+",text:t})))];if(!u.some((t=>" "!==t.sign)))return{rows:[],adds:0,dels:0,truncated:a};const g=DIFF_LIMITS.context,p=[];let f=1,d=1;const h=i>g?i-g:0,x=h;x>0&&p.push({sign:" ",text:"",marker:!0,note:`… ${x} unchanged line${1===x?"":"s"}`});for(let t=h;t<i;t++)p.push({sign:" ",text:n[t],no:d}),d++,f++;for(const t of u)" "===t.sign?(p.push({sign:" ",text:t.text,no:d}),d++,f++):"-"===t.sign?(p.push({sign:"-",text:t.text,no:f}),f++):(p.push({sign:"+",text:t.text,no:d}),d++);const m=s.length-l,I=Math.min(l,g);d=m+1;for(let t=0;t<I;t++)p.push({sign:" ",text:s[m+t],no:d}),d++,f++;if(l>g){const t=l-g;p.push({sign:" ",text:"",marker:!0,note:`… ${t} unchanged line${1===t?"":"s"}`})}const _=p.filter((t=>"+"===t.sign)).length,w=p.filter((t=>"-"===t.sign)).length;let y=p,F=!1;return y.length>DIFF_LIMITS.rows&&(y=y.slice(0,DIFF_LIMITS.rows),y.push({sign:" ",text:"",marker:!0,note:`… ${p.length-DIFF_LIMITS.rows} more diff lines`}),F=!0),{rows:y,adds:_,dels:w,truncated:a||F}}function lcsOps(t,e){const n=t.length,s=e.length;if(!n||!s)return[...t.map((t=>({sign:"-",text:t}))),...e.map((t=>({sign:"+",text:t})))];if(n*s>DIFF_LIMITS.lcsCells)return null;const i=s+1,l=new Int32Array((n+1)*i);for(let r=n-1;r>=0;r--)for(let n=s-1;n>=0;n--)l[r*i+n]=t[r]===e[n]?l[(r+1)*i+(n+1)]+1:Math.max(l[(r+1)*i+n],l[r*i+(n+1)]);const r=[];let o=0,c=0;for(;o<n&&c<s;)t[o]===e[c]?(r.push({sign:" ",text:t[o]}),o++,c++):l[(o+1)*i+c]>=l[o*i+(c+1)]?(r.push({sign:"-",text:t[o]}),o++):(r.push({sign:"+",text:e[c]}),c++);for(;o<n;)r.push({sign:"-",text:t[o++]});for(;c<s;)r.push({sign:"+",text:e[c++]});return r}function fileRows(t){const e=splitLines(t),n=e.slice(0,DIFF_LIMITS.rows),s=n.map(((t,e)=>({sign:" ",text:t,no:e+1}))),i=e.length-n.length;return i>0&&s.push({sign:" ",text:"",marker:!0,note:`… ${i} more lines`}),{rows:s,adds:0,dels:0,truncated:i>0}}function readCapped(t,e={}){if(!fs)return{text:null,missing:!0};const n=null==e.bytes?DIFF_LIMITS.fileBytes:e.bytes;try{const e=fs.statSync(t);if(!e.isFile())return{text:null,missing:!0};const s=fs.readFileSync(t,"utf8");return e.size>n?{text:s.slice(0,n),missing:!1,truncated:!0}:{text:s,missing:!1}}catch{return{text:null,missing:!0}}}function shortPath(t,e){const n=String(t||"");if(!e||!path)return n;const s=path.relative(e,n);if(s&&!s.startsWith("..")&&!path.isAbsolute(s))return s;const i=n.split(path.sep).filter(Boolean),l=n.startsWith(path.sep)?path.sep:"";return i.length>2?l+"…"+path.sep+i.slice(-2).join(path.sep):n}function editPreview(t,e,n={}){try{const s=null==n.cwd?"undefined"!=typeof process?process.cwd():"":n.cwd,i=n.readFile||readCapped;if(!e||"object"!=typeof e)return null;const l="string"==typeof e.file_path?e.file_path:"string"==typeof e.path?e.path:null;if(!l)return null;const r={file:l,short:shortPath(l,s)};if("Edit"===t||"editFile"===t)return"string"!=typeof e.old_string||"string"!=typeof e.new_string?null:Object.assign({kind:"Update"},r,lineDiff(e.old_string,e.new_string),{replaceAll:!!e.replace_all});if("Write"===t||"writeFile"===t){if("string"!=typeof e.content)return null;const t=i(l)||{text:null,missing:!0};let n=lineDiff(null==t.text?"":t.text,e.content);return n.rows.length||t.missing||!e.content||(n=fileRows(e.content)),Object.assign({kind:t.missing?"Create":"Write"},r,n,{truncated:n.truncated||!!t.truncated})}if("MultiEdit"===t){const t=(Array.isArray(e.edits)?e.edits:[]).filter((t=>t&&"string"==typeof t.old_string&&"string"==typeof t.new_string));if(!t.length)return null;const n=i(l)||{text:null,missing:!0};if("string"==typeof n.text){let e=n.text,s=0;for(const n of t)-1!==e.indexOf(n.old_string)?e=n.replace_all?e.split(n.old_string).join(n.new_string):e.replace(n.old_string,n.new_string):s++;const i=lineDiff(n.text,e);return Object.assign({kind:"Update"},r,i,{misses:s,replaceAll:t.some((t=>t.replace_all))})}let s=[],o=0,c=0,a=!1;return t.forEach(((e,n)=>{const i=lineDiff(e.old_string,e.new_string);n&&s.push({sign:" ",text:"",marker:!0,note:`… edit ${n+1} of ${t.length}`}),s=s.concat(i.rows),o+=i.adds,c+=i.dels,a=a||i.truncated})),Object.assign({kind:"Update"},r,{rows:s,adds:o,dels:c,truncated:a,stacked:t.length})}return null}catch{return null}}function changeSummary(t){const e=[];return t.adds&&e.push(`Added ${t.adds} line${1===t.adds?"":"s"}`),t.dels&&e.push(`removed ${t.dels} line${1===t.dels?"":"s"}`),e.length?e.join(", "):"no line changes"}"undefined"!=typeof module&&module.exports&&(module.exports={DIFF_LIMITS:DIFF_LIMITS,splitLines:splitLines,lineDiff:lineDiff,lcsOps:lcsOps,readCapped:readCapped,shortPath:shortPath,changeSummary:changeSummary,editPreview:editPreview});
|
|
@@ -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 AUTO_OPEN_ROWS=30,MAX_BLOCK_ROWS=200,DIFF_COLORS={delFg:"#dc5a5a",delBg:"#3d0100",addFg:"#50c850",addBg:"#022800",delHiFg:"#f8f8f2",delHiBg:"#5c0200",addHiFg:"#ffffff",addHiBg:"#044700",codeFg:"#f8f8f2",gutter:"#787878",kind:"#c099ff",kw:"#66d9ef",fn:"#a6e22e",str:"#e6db74",num:"#ae81ff",comment:"#75715e"},KEYWORDS=new Set(["const","let","var","function","return","if","else","for","while","do","switch","case","break","continue","import","export","from","default","class","extends","new","try","catch","finally","throw","async","await","yield","static","typeof","instanceof","in","of","delete","this","super","null","undefined","true","false","def","elif","lambda","pass","raise","with","as","not","and","or","is","None","True","False","self","fn","mut","pub","impl","struct","enum","trait","match","package","func","defer","chan","nil","echo","local","then","fi","esac"]);function highlightLine(e,t){const n=t||DIFF_COLORS,i=[],d=String(null==e?"":e),l=/(\/\/[^\n]*|#[^\n]*|\/\*[\s\S]*?\*\/)|('(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|`(?:\\.|[^`\\])*`)|(0[xX][0-9a-fA-F]+|\d+(?:\.\d+)?)|([A-Za-z_$][A-Za-z0-9_$]*)/g,a=(e,t)=>{e&&i.push({t:e,c:t})};let o,s=0;for(;o=l.exec(d);){if(o.index>s&&a(d.slice(s,o.index),n.codeFg),o[1])a(o[1],n.comment);else if(o[2])a(o[2],n.str);else if(o[3])a(o[3],n.num);else{const e=o[4],t=/^\s*\(/.test(d.slice(o.index+e.length));a(e,KEYWORDS.has(e)?n.kw:t?n.fn:n.codeFg)}s=o.index+o[0].length}return s<d.length&&a(d.slice(s),n.codeFg),i}function markIntraLine(e){for(let t=0;t<e.length;t++){if("-"!==e[t].sign)continue;let n=t;for(;n<e.length&&"-"===e[n].sign;)n++;let i=n;for(;i<e.length&&"+"===e[i].sign;)i++;const d=n-t;if(d&&d===i-n)for(let i=0;i<d;i++){const d=intraLine(e[t+i].text,e[n+i].text);d&&(e[t+i].hi={start:d.delStart,end:d.delEnd,side:"del"},e[n+i].hi={start:d.addStart,end:d.addEnd,side:"add"})}t=i-1}return e}function intraLine(e,t){const n=[...String(null==e?"":e)],i=[...String(null==t?"":t)];let d=0;for(;d<n.length&&d<i.length&&n[d]===i[d];)d++;let l=0;for(;l<n.length-d&&l<i.length-d&&n[n.length-1-l]===i[i.length-1-l];)l++;return d+l<.4*(Math.max(n.length,i.length)||1)?null:{delStart:d,delEnd:n.length-l,addStart:d,addEnd:i.length-l}}function defaultOpen(e){return!(!e||!e.rows)&&e.rows.length<=AUTO_OPEN_ROWS}function tokenSpan(e,t,n,i,d){const l=e.createElement("span");return i?(l.style.background=i,l.style.color=d):l.style.color=n,l.textContent=String(t),l}function appendCode(e,t,n,i){const d=String(null==n?"":n);let l=0;for(const n of highlightLine(d,DIFF_COLORS)){const d=[...n.t],a=l,o=l+d.length;if(l=o,!i||o<=i.start||a>=i.end){t.appendChild(tokenSpan(e,n.t,n.c));continue}const s=Math.max(i.start,a)-a,r=Math.min(i.end,o)-a;if(s>0&&t.appendChild(tokenSpan(e,d.slice(0,s).join(""),n.c)),r>s){const n="del"===i.side?DIFF_COLORS.delHiBg:DIFF_COLORS.addHiBg,l="del"===i.side?DIFF_COLORS.delHiFg:DIFF_COLORS.addHiFg;t.appendChild(tokenSpan(e,d.slice(s,r).join(""),null,n,l))}r<d.length&&t.appendChild(tokenSpan(e,d.slice(r).join(""),n.c))}}function renderRow(e,t,n){const i="-"===t.sign?"del":"+"===t.sign?"add":"ctx",d=e.createElement("div");d.className=`diff-row diff-${i}`;const l=e.createElement("span");l.className="diff-gutter",l.textContent=`${String(null==t.no?"":t.no).padStart(n)} `,d.appendChild(l);const a=e.createElement("span");a.className="diff-sign",a.textContent=" "===t.sign?" ":t.sign,d.appendChild(a);const o=e.createElement("span");return o.className="diff-code",appendCode(e,o,t.text,t.hi),d.appendChild(o),d}function markerRow(e,t){const n=e.createElement("div");n.className="diff-row diff-marker";const i=e.createElement("span");return i.className="diff-code",i.textContent=String(null==t?"":t),n.appendChild(i),n}function renderDiffBlock(e,t,n={}){const i=t||(void 0!==i?i:null);if(!i||!e||!e.rows)return null;let d=null==n.open?defaultOpen(e):!!n.open;const l=i.createElement("div");l.className="diff-block";const a=i.createElement("div");a.className="diff-summary","function"==typeof a.setAttribute&&(a.setAttribute("role","button"),a.setAttribute("aria-expanded",String(d)));const o=i.createElement("div");function s(){a.textContent="";const t=[{t:"⎿ ",c:DIFF_COLORS.gutter},{t:`${e.kind}(${e.short})`,c:DIFF_COLORS.kind}];e.adds&&t.push({t:` +${e.adds}`,c:DIFF_COLORS.addFg}),e.dels&&t.push({t:` -${e.dels}`,c:DIFF_COLORS.delFg}),e.adds||e.dels||t.push({t:" no line changes",c:DIFF_COLORS.gutter}),e.misses&&t.push({t:` ${e.misses} edit(s) not applied`,c:"#ffd166"}),
|
|
3
|
+
"use strict";const AUTO_OPEN_ROWS=30,MAX_BLOCK_ROWS=200,DIFF_COLORS={delFg:"#dc5a5a",delBg:"#3d0100",addFg:"#50c850",addBg:"#022800",delHiFg:"#f8f8f2",delHiBg:"#5c0200",addHiFg:"#ffffff",addHiBg:"#044700",codeFg:"#f8f8f2",gutter:"#787878",kind:"#c099ff",kw:"#66d9ef",fn:"#a6e22e",str:"#e6db74",num:"#ae81ff",comment:"#75715e"},KEYWORDS=new Set(["const","let","var","function","return","if","else","for","while","do","switch","case","break","continue","import","export","from","default","class","extends","new","try","catch","finally","throw","async","await","yield","static","typeof","instanceof","in","of","delete","this","super","null","undefined","true","false","def","elif","lambda","pass","raise","with","as","not","and","or","is","None","True","False","self","fn","mut","pub","impl","struct","enum","trait","match","package","func","defer","chan","nil","echo","local","then","fi","esac"]);function highlightLine(e,t){const n=t||DIFF_COLORS,i=[],d=String(null==e?"":e),l=/(\/\/[^\n]*|#[^\n]*|\/\*[\s\S]*?\*\/)|('(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|`(?:\\.|[^`\\])*`)|(0[xX][0-9a-fA-F]+|\d+(?:\.\d+)?)|([A-Za-z_$][A-Za-z0-9_$]*)/g,a=(e,t)=>{e&&i.push({t:e,c:t})};let o,s=0;for(;o=l.exec(d);){if(o.index>s&&a(d.slice(s,o.index),n.codeFg),o[1])a(o[1],n.comment);else if(o[2])a(o[2],n.str);else if(o[3])a(o[3],n.num);else{const e=o[4],t=/^\s*\(/.test(d.slice(o.index+e.length));a(e,KEYWORDS.has(e)?n.kw:t?n.fn:n.codeFg)}s=o.index+o[0].length}return s<d.length&&a(d.slice(s),n.codeFg),i}function markIntraLine(e){for(let t=0;t<e.length;t++){if("-"!==e[t].sign)continue;let n=t;for(;n<e.length&&"-"===e[n].sign;)n++;let i=n;for(;i<e.length&&"+"===e[i].sign;)i++;const d=n-t;if(d&&d===i-n)for(let i=0;i<d;i++){const d=intraLine(e[t+i].text,e[n+i].text);d&&(e[t+i].hi={start:d.delStart,end:d.delEnd,side:"del"},e[n+i].hi={start:d.addStart,end:d.addEnd,side:"add"})}t=i-1}return e}function intraLine(e,t){const n=[...String(null==e?"":e)],i=[...String(null==t?"":t)];let d=0;for(;d<n.length&&d<i.length&&n[d]===i[d];)d++;let l=0;for(;l<n.length-d&&l<i.length-d&&n[n.length-1-l]===i[i.length-1-l];)l++;return d+l<.4*(Math.max(n.length,i.length)||1)?null:{delStart:d,delEnd:n.length-l,addStart:d,addEnd:i.length-l}}function defaultOpen(e){return!(!e||!e.rows)&&e.rows.length<=AUTO_OPEN_ROWS}function tokenSpan(e,t,n,i,d){const l=e.createElement("span");return i?(l.style.background=i,l.style.color=d):l.style.color=n,l.textContent=String(t),l}function appendCode(e,t,n,i){const d=String(null==n?"":n);let l=0;for(const n of highlightLine(d,DIFF_COLORS)){const d=[...n.t],a=l,o=l+d.length;if(l=o,!i||o<=i.start||a>=i.end){t.appendChild(tokenSpan(e,n.t,n.c));continue}const s=Math.max(i.start,a)-a,r=Math.min(i.end,o)-a;if(s>0&&t.appendChild(tokenSpan(e,d.slice(0,s).join(""),n.c)),r>s){const n="del"===i.side?DIFF_COLORS.delHiBg:DIFF_COLORS.addHiBg,l="del"===i.side?DIFF_COLORS.delHiFg:DIFF_COLORS.addHiFg;t.appendChild(tokenSpan(e,d.slice(s,r).join(""),null,n,l))}r<d.length&&t.appendChild(tokenSpan(e,d.slice(r).join(""),n.c))}}function renderRow(e,t,n){const i="-"===t.sign?"del":"+"===t.sign?"add":"ctx",d=e.createElement("div");d.className=`diff-row diff-${i}`;const l=e.createElement("span");l.className="diff-gutter",l.textContent=`${String(null==t.no?"":t.no).padStart(n)} `,d.appendChild(l);const a=e.createElement("span");a.className="diff-sign",a.textContent=" "===t.sign?" ":t.sign,d.appendChild(a);const o=e.createElement("span");return o.className="diff-code",appendCode(e,o,t.text,t.hi),d.appendChild(o),d}function markerRow(e,t){const n=e.createElement("div");n.className="diff-row diff-marker";const i=e.createElement("span");return i.className="diff-code",i.textContent=String(null==t?"":t),n.appendChild(i),n}function renderDiffBlock(e,t,n={}){const i=t||(void 0!==i?i:null);if(!i||!e||!e.rows)return null;let d=null==n.open?defaultOpen(e):!!n.open;const l=i.createElement("div");l.className="diff-block";const a=i.createElement("div");a.className="diff-summary","function"==typeof a.setAttribute&&(a.setAttribute("role","button"),a.setAttribute("aria-expanded",String(d)));const o=i.createElement("div");function s(){a.textContent="";const t=[{t:"⎿ ",c:DIFF_COLORS.gutter},{t:`${e.kind}(${e.short})`,c:DIFF_COLORS.kind}];if(e.adds&&t.push({t:` +${e.adds}`,c:DIFF_COLORS.addFg}),e.dels&&t.push({t:` -${e.dels}`,c:DIFF_COLORS.delFg}),e.adds||e.dels||t.push({t:" no line changes",c:DIFF_COLORS.gutter}),e.misses&&t.push({t:` ${e.misses} edit(s) not applied`,c:"#ffd166"}),e.rows&&e.rows.length){const n=d?"· click to collapse":e.adds||e.dels?"· click to view diff":"· click to view file";t.push({t:` ${n}`,c:DIFF_COLORS.comment})}for(const e of t){const t=i.createElement("span");t.style.color=e.c,t.textContent=e.t,a.appendChild(t)}"function"==typeof a.setAttribute&&a.setAttribute("aria-expanded",String(d))}function r(){if(o.textContent="",!d)return;const t=markIntraLine(e.rows.slice(0,200).map((e=>Object.assign({},e))));let n=1;for(const e of t)e.no&&e.no>n&&(n=e.no);const l=Math.max(2,String(n).length);for(const e of t)e.marker?o.appendChild(markerRow(i,e.note)):o.appendChild(renderRow(i,e,l));const a=e.rows.length-200;a>0&&o.appendChild(markerRow(i,`… ${a} more diff lines`)),e.truncated&&o.appendChild(markerRow(i,"… diff truncated (file too large to compare in full)"))}function c(){d=!d,s(),r()}return o.className="diff-body","function"==typeof a.addEventListener&&(a.addEventListener("click",c),a.addEventListener("keydown",(e=>{!e||"Enter"!==e.key&&" "!==e.key||("function"==typeof e.preventDefault&&e.preventDefault(),c())}))),s(),r(),l.appendChild(a),l.appendChild(o),l}"undefined"!=typeof module&&module.exports&&(module.exports={AUTO_OPEN_ROWS:AUTO_OPEN_ROWS,MAX_BLOCK_ROWS:200,DIFF_COLORS:DIFF_COLORS,defaultOpen:defaultOpen,highlightLine:highlightLine,markIntraLine:markIntraLine,renderDiffBlock:renderDiffBlock});
|
|
@@ -35,6 +35,17 @@
|
|
|
35
35
|
for, so an untouched thread never shows a `0 tokens` it never measured. -->
|
|
36
36
|
<div class="session-meter" id="session-meter" hidden></div>
|
|
37
37
|
<div class="spacer"></div>
|
|
38
|
+
<!-- Import session. In the TOOLBAR, not buried in the Memory card, because
|
|
39
|
+
it is the first thing a user arriving from another tool wants: their
|
|
40
|
+
existing conversations, in here, where they can read and continue them.
|
|
41
|
+
Opening the sheet is a dry scan (read-only, nothing copied); the copy
|
|
42
|
+
only happens from the sheet's own button, which names the count. -->
|
|
43
|
+
<button
|
|
44
|
+
type="button"
|
|
45
|
+
id="import-session-btn"
|
|
46
|
+
class="ghost-btn toolbar-import"
|
|
47
|
+
title="Import sessions & memory from other AI tools"
|
|
48
|
+
>Import session</button>
|
|
38
49
|
<button type="button" id="new-chat" class="ghost-btn">New chat</button>
|
|
39
50
|
</header>
|
|
40
51
|
|
|
@@ -371,6 +382,74 @@
|
|
|
371
382
|
<span>confirm before running tools</span>
|
|
372
383
|
</label>
|
|
373
384
|
<p class="hint" id="confirm-mode-hint"></p>
|
|
385
|
+
|
|
386
|
+
<label
|
|
387
|
+
class="flow-toggle"
|
|
388
|
+
for="plan-mode-toggle"
|
|
389
|
+
title="Read-only session: the agent may read files, search and run read-only shell commands, but writeFile / editFile / mutating exec calls are refused outright — no approval card, because plan mode promises not to ask. Turn off to let it edit again."
|
|
390
|
+
>
|
|
391
|
+
<input type="checkbox" id="plan-mode-toggle" />
|
|
392
|
+
<span>plan mode (read-only)</span>
|
|
393
|
+
</label>
|
|
394
|
+
<p class="hint" id="plan-mode-hint"></p>
|
|
395
|
+
|
|
396
|
+
<!-- Rules: what the gate decides WITHOUT asking. Same file the CLI's
|
|
397
|
+
/permissions command edits (~/.aegiscode/permissions.json), so a
|
|
398
|
+
rule added here is honoured by both faces. Deny is rendered first
|
|
399
|
+
because it is the floor: an allow cannot override it. -->
|
|
400
|
+
<div class="rules-block" id="perm-rules">
|
|
401
|
+
<h3 class="rules-title">Rules</h3>
|
|
402
|
+
<p class="hint" id="perm-rules-hint">
|
|
403
|
+
A rule is <code>tool(pattern)</code> — <code>exec(npm test)</code>,
|
|
404
|
+
<code>exec(npm run *)</code>, <code>writeFile(src/**)</code>.
|
|
405
|
+
Deny beats allow. Anything with no rule still asks.
|
|
406
|
+
</p>
|
|
407
|
+
<ul class="rules-list" id="perm-rules-list"></ul>
|
|
408
|
+
<form class="rules-add" id="perm-rules-form">
|
|
409
|
+
<select id="perm-rules-list-select" aria-label="Rule list">
|
|
410
|
+
<option value="allow">allow</option>
|
|
411
|
+
<option value="deny">deny</option>
|
|
412
|
+
<option value="ask">ask</option>
|
|
413
|
+
</select>
|
|
414
|
+
<input
|
|
415
|
+
type="text"
|
|
416
|
+
id="perm-rules-input"
|
|
417
|
+
class="rules-input"
|
|
418
|
+
placeholder="exec(npm test)"
|
|
419
|
+
autocomplete="off"
|
|
420
|
+
spellcheck="false"
|
|
421
|
+
aria-label="Rule"
|
|
422
|
+
/>
|
|
423
|
+
<button type="submit" class="ghost-btn" id="perm-rules-add">Add</button>
|
|
424
|
+
</form>
|
|
425
|
+
<p class="hint" id="perm-rules-status"></p>
|
|
426
|
+
</div>
|
|
427
|
+
|
|
428
|
+
<!-- Sandbox posture (docs/agent-safety-plan.md §1). The switch above
|
|
429
|
+
decides whether you are ASKED; this decides what a command can
|
|
430
|
+
reach once it runs. They are different bounds and the copy says so,
|
|
431
|
+
because a user who reads this as "more approvals" would set it to
|
|
432
|
+
off and lose the only bound that survives an injected model. -->
|
|
433
|
+
<div class="rules-block" id="sandbox-policy">
|
|
434
|
+
<h3 class="rules-title">Command sandbox</h3>
|
|
435
|
+
<p class="hint" id="sandbox-policy-hint">
|
|
436
|
+
What a shell command can touch once it runs. Rules decide whether
|
|
437
|
+
you are asked; this decides what "yes" is allowed to mean.
|
|
438
|
+
</p>
|
|
439
|
+
<label class="rules-add" for="sandbox-mode-select">
|
|
440
|
+
<span>Mode</span>
|
|
441
|
+
<select id="sandbox-mode-select" aria-label="Sandbox mode">
|
|
442
|
+
<option value="workspace-write">workspace-write</option>
|
|
443
|
+
<option value="read-only">read-only</option>
|
|
444
|
+
<option value="off">off</option>
|
|
445
|
+
</select>
|
|
446
|
+
</label>
|
|
447
|
+
<label class="flow-toggle" for="sandbox-network-toggle">
|
|
448
|
+
<input type="checkbox" id="sandbox-network-toggle" />
|
|
449
|
+
<span>allow network from sandboxed commands</span>
|
|
450
|
+
</label>
|
|
451
|
+
<p class="hint" id="sandbox-policy-status"></p>
|
|
452
|
+
</div>
|
|
374
453
|
</section>
|
|
375
454
|
|
|
376
455
|
<!-- Sessions and Memory are panes behind one strip now, not two
|
|
@@ -624,7 +703,11 @@
|
|
|
624
703
|
<template id="welcome-template">
|
|
625
704
|
<div class="chat-welcome" id="chat-welcome">
|
|
626
705
|
<div class="chat-greeting-row">
|
|
627
|
-
|
|
706
|
+
<!-- Decorative mark, drawn in CSS (desktop/renderer/style.css
|
|
707
|
+
.chat-welcome .glyph) rather than this element's content —
|
|
708
|
+
the shape is a mask-image, not text, see that rule for why.
|
|
709
|
+
"Hello" already carries the row's meaning. -->
|
|
710
|
+
<div class="glyph" aria-hidden="true"></div>
|
|
628
711
|
<div class="title" id="chat-greeting">Hello</div>
|
|
629
712
|
</div>
|
|
630
713
|
<div class="sub" id="welcome-tagline">Your intent, AI automated.</div>
|
|
@@ -888,6 +971,134 @@
|
|
|
888
971
|
</div>
|
|
889
972
|
</div>
|
|
890
973
|
|
|
974
|
+
<!-- Session search (View > Search sessions…, Cmd/Ctrl+K).
|
|
975
|
+
|
|
976
|
+
This sheet is what that menu item now opens. It used to open the memory
|
|
977
|
+
inspector below — the label, the accelerator and the sheet all named
|
|
978
|
+
different things, and nothing in the app searched conversations at all.
|
|
979
|
+
Static markup populated by renderSessionSearch() (app.js); no inline
|
|
980
|
+
handlers, because this renderer runs under `script-src 'self'`.
|
|
981
|
+
|
|
982
|
+
The ranking is main.js's `searchSessions` channel over
|
|
983
|
+
client/session-search.js — the SAME module the terminal's /resume picker
|
|
984
|
+
filters with, so the two faces cannot disagree about which conversation
|
|
985
|
+
matches. -->
|
|
986
|
+
<div class="memory-overlay session-overlay" id="session-overlay" hidden>
|
|
987
|
+
<div class="memory-backdrop" id="session-backdrop"></div>
|
|
988
|
+
<div
|
|
989
|
+
class="memory-panel"
|
|
990
|
+
role="dialog"
|
|
991
|
+
aria-modal="true"
|
|
992
|
+
aria-labelledby="session-panel-title"
|
|
993
|
+
>
|
|
994
|
+
<header class="memory-panel-head">
|
|
995
|
+
<h2 id="session-panel-title">Sessions</h2>
|
|
996
|
+
<span class="memory-count" id="session-count"></span>
|
|
997
|
+
<div class="spacer"></div>
|
|
998
|
+
<button type="button" id="session-close" class="ghost-btn" title="Close (Esc)">
|
|
999
|
+
Close
|
|
1000
|
+
</button>
|
|
1001
|
+
</header>
|
|
1002
|
+
|
|
1003
|
+
<form class="memory-filters" id="session-filters">
|
|
1004
|
+
<input
|
|
1005
|
+
type="text"
|
|
1006
|
+
id="session-query"
|
|
1007
|
+
placeholder="Search sessions by title, path or anything you typed…"
|
|
1008
|
+
autocomplete="off"
|
|
1009
|
+
aria-controls="session-list"
|
|
1010
|
+
/>
|
|
1011
|
+
<button type="submit">Search</button>
|
|
1012
|
+
<button type="button" id="session-clear" class="ghost-btn">Clear</button>
|
|
1013
|
+
</form>
|
|
1014
|
+
|
|
1015
|
+
<p class="hint" id="session-hint"></p>
|
|
1016
|
+
|
|
1017
|
+
<div class="memory-scroll">
|
|
1018
|
+
<ul class="memory-list" id="session-list"></ul>
|
|
1019
|
+
</div>
|
|
1020
|
+
</div>
|
|
1021
|
+
</div>
|
|
1022
|
+
|
|
1023
|
+
<!-- Import session (the toolbar's Import session button).
|
|
1024
|
+
|
|
1025
|
+
Two lists, because two different things are imported and mixing them
|
|
1026
|
+
would hide the half that matters:
|
|
1027
|
+
|
|
1028
|
+
sessions — whole conversations, copied into the SHARED session store
|
|
1029
|
+
(client/session-store.js) so they appear in Sessions and in
|
|
1030
|
+
the terminal's /resume;
|
|
1031
|
+
memory — durable fragments, pushed to cloud memory exactly as the
|
|
1032
|
+
Memory card's own import always did.
|
|
1033
|
+
|
|
1034
|
+
Rows are painted from the scan the toolbar button already ran — the sheet
|
|
1035
|
+
never scans by itself, so opening it twice costs no extra disk walk. -->
|
|
1036
|
+
<div class="memory-overlay import-overlay" id="import-overlay" hidden>
|
|
1037
|
+
<div class="memory-backdrop" id="import-backdrop"></div>
|
|
1038
|
+
<div
|
|
1039
|
+
class="memory-panel"
|
|
1040
|
+
role="dialog"
|
|
1041
|
+
aria-modal="true"
|
|
1042
|
+
aria-labelledby="import-panel-title"
|
|
1043
|
+
>
|
|
1044
|
+
<header class="memory-panel-head">
|
|
1045
|
+
<h2 id="import-panel-title">Import from other AI tools</h2>
|
|
1046
|
+
<span class="memory-count" id="import-count"></span>
|
|
1047
|
+
<div class="spacer"></div>
|
|
1048
|
+
<button type="button" id="import-close" class="ghost-btn" title="Close (Esc)">
|
|
1049
|
+
Close
|
|
1050
|
+
</button>
|
|
1051
|
+
</header>
|
|
1052
|
+
|
|
1053
|
+
<p class="hint" id="import-hint">scanning…</p>
|
|
1054
|
+
|
|
1055
|
+
<div class="memory-scroll">
|
|
1056
|
+
<ul class="memory-list" id="import-list"></ul>
|
|
1057
|
+
</div>
|
|
1058
|
+
|
|
1059
|
+
<footer class="import-actions">
|
|
1060
|
+
<label class="import-sync">
|
|
1061
|
+
<input type="checkbox" id="import-sync" />
|
|
1062
|
+
also sync imported sessions to my account
|
|
1063
|
+
</label>
|
|
1064
|
+
<div class="spacer"></div>
|
|
1065
|
+
<button type="button" id="import-memory-btn" class="ghost-btn">
|
|
1066
|
+
Import memory only
|
|
1067
|
+
</button>
|
|
1068
|
+
<button type="button" id="import-sessions-btn" class="btn-block">Import sessions</button>
|
|
1069
|
+
</footer>
|
|
1070
|
+
</div>
|
|
1071
|
+
</div>
|
|
1072
|
+
|
|
1073
|
+
<!-- Credits & licence (Help > Credits & licence…).
|
|
1074
|
+
|
|
1075
|
+
Every row is painted from main.js's `credits` channel, which is
|
|
1076
|
+
client/credits.js reading LICENSING.md and the two NOTICE files. That is
|
|
1077
|
+
the point: the attribution is not retyped here, so bumping a vendored
|
|
1078
|
+
file is a one-file change and this sheet follows. -->
|
|
1079
|
+
<div class="memory-overlay credits-overlay" id="credits-overlay" hidden>
|
|
1080
|
+
<div class="memory-backdrop" id="credits-backdrop"></div>
|
|
1081
|
+
<div
|
|
1082
|
+
class="memory-panel"
|
|
1083
|
+
role="dialog"
|
|
1084
|
+
aria-modal="true"
|
|
1085
|
+
aria-labelledby="credits-panel-title"
|
|
1086
|
+
>
|
|
1087
|
+
<header class="memory-panel-head">
|
|
1088
|
+
<h2 id="credits-panel-title">Credits & Licence</h2>
|
|
1089
|
+
<span class="memory-count" id="credits-licence-tag"></span>
|
|
1090
|
+
<div class="spacer"></div>
|
|
1091
|
+
<button type="button" id="credits-close" class="ghost-btn" title="Close (Esc)">
|
|
1092
|
+
Close
|
|
1093
|
+
</button>
|
|
1094
|
+
</header>
|
|
1095
|
+
|
|
1096
|
+
<div class="memory-scroll" id="credits-body">
|
|
1097
|
+
<p class="hint" id="credits-status">loading…</p>
|
|
1098
|
+
</div>
|
|
1099
|
+
</div>
|
|
1100
|
+
</div>
|
|
1101
|
+
|
|
891
1102
|
<!-- φ(α) panel. Same sheet as the memory inspector (the classes are shared on
|
|
892
1103
|
purpose: one translucent layer, one Escape policy). Every control is
|
|
893
1104
|
bound in fingerprint.js, which is also where these ids are declared — a
|
|
@@ -1123,6 +1334,15 @@
|
|
|
1123
1334
|
</div>
|
|
1124
1335
|
|
|
1125
1336
|
<script src="providers.js"></script>
|
|
1337
|
+
<!-- Must load before provider-toolbar.js: that script reads
|
|
1338
|
+
window.aegisProviderMark into a top-level `const` at parse time (the
|
|
1339
|
+
same pattern providers.js's `window.aegisProviders` already uses one
|
|
1340
|
+
line up), so loading it after would capture `undefined` forever — the
|
|
1341
|
+
icon beside every row would silently never paint, with no error, since
|
|
1342
|
+
`M && ...` reads as a quiet no-op. See the "loaded before app.js" note
|
|
1343
|
+
below for the comment this tag used to carry; app.js also needs it, but
|
|
1344
|
+
provider-toolbar.js needs it FIRST. -->
|
|
1345
|
+
<script src="provider-mark.js"></script>
|
|
1126
1346
|
<script src="provider-toolbar.js"></script>
|
|
1127
1347
|
<script src="companion.js"></script>
|
|
1128
1348
|
<script src="budget.js"></script>
|
|
@@ -1136,10 +1356,6 @@
|
|
|
1136
1356
|
<script src="vendor/purify.min.js"></script>
|
|
1137
1357
|
<script src="vendor/aegis-highlight.js"></script>
|
|
1138
1358
|
<script src="markdown.js"></script>
|
|
1139
|
-
<!-- Paints the provider glyph in the composer row from the selected model
|
|
1140
|
-
id. Loaded before app.js, which calls window.aegisProviderMark.paint
|
|
1141
|
-
through updateBudgetControls(). -->
|
|
1142
|
-
<script src="provider-mark.js"></script>
|
|
1143
1359
|
<!-- Loaded before app.js: app.js's init() calls window.aegisFingerprint.mount
|
|
1144
1360
|
and composes its overlay into the Escape policy, and the orphan check in
|
|
1145
1361
|
test/renderer-wiring.test.mjs fails if this tag goes missing. -->
|
|
@@ -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 VENDOR_MATCHERS=Object.freeze(["azure-openai","huggingface","openrouter","together-ai","anthropic","deepseek","fireworks","voyage-ai","together","gemini","google","mistral","openai","grok","x-ai","xai","groq"]),PROVIDER_LABELS=Object.freeze({openai:"OpenAI",anthropic:"Anthropic",deepseek:"DeepSeek",google:"Gemini",gemini:"Gemini",groq:"Groq",mistral:"Mistral",openrouter:"OpenRouter",together:"Together","together-ai":"Together",xai:"xAI","x-ai":"xAI",grok:"xAI",huggingface:"Hugging Face",fireworks:"Fireworks","voyage-ai":"Voyage AI","azure-openai":"Azure OpenAI"});function providerOfModel(e){const r=String(null==e?"":e).toLowerCase();if(!r)return"";const t=r.indexOf(":");if(t>0){const e=r.slice(0,t);if(PROVIDER_LABELS[e])return e}const i=r.indexOf("/");if(i>0){const e=r.slice(0,i);if(PROVIDER_LABELS[e])return e}if(r.startsWith("claude"))return"anthropic";if(/^gpt([-.\d]|$)/.test(r))return"openai";for(const e of VENDOR_MATCHERS)if(new RegExp(`(^|[/_.\\-])${e}($|[/_.\\-])`).test(r))return e;return""}function providerGlyph(e){switch(e){case"openai":return[["circle",{cx:"8",cy:"8",r:"5.4"}],["path",{d:"M8 2.6v10.8"}]];case"anthropic":return[["path",{d:"M8 2.2 12.6 13.8H10.2L9.2 11H6.8L5.8 13.8H3.4Z"}]];case"deepseek":return[["path",{d:"M2 10.4c2.2 0 3-3.2 5-3.2s2.6 2.4 4.4 2.4 1.8-1.6 2.6-1.6"}]];case"google":case"gemini":return[["path",{d:"M8 1.8 9.6 6.4 14.2 8 9.6 9.6 8 14.2 6.4 9.6 1.8 8 6.4 6.4Z"}]];case"groq":return[["path",{d:"M9.4 1.6 3.6 9.2h3.6L6 14.4l6.4-8.2H8.6Z"}]];case"mistral":return[["path",{d:"M2 13V7h3v6Z"}],["path",{d:"M6.5 13V4.6h3V13Z"}],["path",{d:"M11 13V8h3v5Z"}]];case"openrouter":return[["path",{d:"M2 8h4.4c1.2 0 1.8-.8 2.4-1.6"}],["path",{d:"M2 8h4.4c1.2 0 1.8.8 2.4 1.6"}],["path",{d:"M8.4 5.4 11.6 8 8.4 10.6"}]];case"together":case"together-ai":return[["circle",{cx:"4.6",cy:"8",r:"2.5"}],["circle",{cx:"11.4",cy:"8",r:"2.5"}]];case"xai":case"x-ai":case"grok":return[["path",{d:"M3 3l10 10M13 3L3 13"}]];case"huggingface":return[["path",{d:"M8 2.4 13.4 5.4 8 8.4 2.6 5.4Z"}],["path",{d:"M2.6 8 8 11l5.4-3"}]];case"fireworks":case"voyage-ai":return[["path",{d:"M2 8h2.4l1.4-4 2.4 8 2.4-6 1.4 2h2"}]];case"azure-openai":return[["rect",{x:"2.4",y:"2.4",width:"11.2",height:"11.2",rx:"2"}],["circle",{cx:"8",cy:"8",r:"2.8"}]];default:return[["circle",{cx:"8",cy:"8",r:"3.2"}]]}}function buildProviderMark(e,r,t){const i=providerOfModel(r),o=PROVIDER_LABELS[i]||String(t||""),n=e.createElement("span");n.className="provider-mark"+(i?` provider-${i}`:" provider-unknown"),n.setAttribute("role","img"),n.setAttribute("aria-label",o||"unknown provider"),n.title=o?`This model is served by ${o}`:"Provider unknown for this model";const a="http://www.w3.org/2000/svg",d=e.createElementNS(a,"svg");d.setAttribute("viewBox","0 0 16 16"),d.setAttribute("width","14"),d.setAttribute("height","14"),d.setAttribute("aria-hidden","true"),d.setAttribute("focusable","false");for(const[r,t]of providerGlyph(i)){const i=e.createElementNS(a,r);for(const e of Object.keys(t))i.setAttribute(e,t[e]);d.appendChild(i)}return n.appendChild(d),{el:n,provider:i,label:o}}function paintProviderMark(e,r,t){if(!e||"undefined"==typeof document)return!1;const i=buildProviderMark(document,r,t);return e.textContent="",e.appendChild(i.el),!0}"undefined"!=typeof window&&(window.aegisProviderMark={paint:paintProviderMark,build:buildProviderMark,providerOfModel:providerOfModel,providerGlyph:providerGlyph,PROVIDER_LABELS:PROVIDER_LABELS}),"undefined"!=typeof module&&module.exports&&(module.exports={providerOfModel:providerOfModel,providerGlyph:providerGlyph,buildProviderMark:buildProviderMark,PROVIDER_LABELS:PROVIDER_LABELS,VENDOR_MATCHERS:VENDOR_MATCHERS});
|
|
3
|
+
"use strict";const VENDOR_MATCHERS=Object.freeze(["azure-openai","huggingface","openrouter","together-ai","anthropic","deepseek","fireworks","voyage-ai","together","gemini","google","mistral","openai","ollama","grok","x-ai","xai","groq"]),PROVIDER_LABELS=Object.freeze({openai:"OpenAI",anthropic:"Anthropic",deepseek:"DeepSeek",google:"Gemini",gemini:"Gemini",groq:"Groq",mistral:"Mistral",openrouter:"OpenRouter",together:"Together","together-ai":"Together",xai:"xAI","x-ai":"xAI",grok:"xAI",huggingface:"Hugging Face",fireworks:"Fireworks","voyage-ai":"Voyage AI","azure-openai":"Azure OpenAI",ollama:"Ollama",local:"Ollama"});function providerOfModel(e){const r=String(null==e?"":e).toLowerCase();if(!r)return"";const t=r.indexOf(":");if(t>0){const e=r.slice(0,t);if(PROVIDER_LABELS[e])return e}const a=r.indexOf("/");if(a>0){const e=r.slice(0,a);if(PROVIDER_LABELS[e])return e}if(r.startsWith("claude"))return"anthropic";if(/^gpt([-.\d]|$)/.test(r))return"openai";for(const e of VENDOR_MATCHERS)if(new RegExp(`(^|[/_.\\-])${e}($|[/_.\\-])`).test(r))return e;return""}const REAL_MARK_ATTRS=Object.freeze({fill:"currentColor",stroke:"none",transform:"scale(.666667)"});function providerGlyph(e){switch(e){case"openai":return[["circle",{cx:"8",cy:"8",r:"5.4"}],["path",{d:"M8 2.6v10.8"}]];case"anthropic":return[["path",{...REAL_MARK_ATTRS,d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"}]];case"deepseek":return[["path",{...REAL_MARK_ATTRS,d:"M23.748 4.651c-.254-.124-.364.113-.512.233-.051.04-.094.09-.137.137-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.155-.708-.311-.955-.65-.172-.24-.219-.509-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.094.172.187.129.323-.082.28-.18.553-.266.833-.055.179-.137.218-.328.14a5.5 5.5 0 0 1-1.737-1.179c-.857-.828-1.631-1.743-2.597-2.46a12 12 0 0 0-.689-.47c-.985-.957.13-1.743.387-1.836.27-.098.094-.433-.778-.428-.872.003-1.67.295-2.687.685a3 3 0 0 1-.465.136 9.6 9.6 0 0 0-2.883-.101c-1.885.21-3.39 1.1-4.497 2.622C.082 8.776-.231 10.854.152 13.02c.403 2.284 1.568 4.175 3.36 5.653 1.857 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.132-.284 4.994-1.86.47.234.962.328 1.78.398.629.058 1.235-.031 1.705-.129.735-.155.684-.836.418-.961-2.155-1.004-1.682-.595-2.112-.926 1.095-1.295 2.768-3.598 3.284-6.733.05-.346.115-.834.108-1.114-.004-.171.035-.238.23-.257a4.2 4.2 0 0 0 1.545-.475c1.397-.763 1.96-2.016 2.093-3.517.02-.23-.004-.467-.247-.588M11.58 18.168c-2.088-1.642-3.101-2.183-3.52-2.16-.39.024-.32.472-.234.763.09.288.207.487.371.74.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.168-1.361-.801-2.5-1.86-3.301-3.306-.775-1.393-1.225-2.888-1.299-4.482-.02-.385.094-.522.477-.592a4.7 4.7 0 0 1 1.53-.038c2.131.311 3.946 1.264 5.467 2.774.868.86 1.525 1.887 2.202 2.89.72 1.066 1.494 2.082 2.48 2.915.348.291.626.513.892.677-.802.09-2.14.109-3.055-.615zm1.001-6.44a.306.306 0 0 1 .415-.287.3.3 0 0 1 .113.074.3.3 0 0 1 .086.214c0 .17-.136.307-.308.307a.303.303 0 0 1-.306-.307m3.11 1.596c-.2.081-.4.151-.591.16a1.25 1.25 0 0 1-.798-.254c-.274-.23-.47-.358-.551-.758a1.7 1.7 0 0 1 .015-.588c.07-.327-.007-.537-.238-.727-.188-.156-.426-.199-.689-.199a.6.6 0 0 1-.254-.078.253.253 0 0 1-.114-.358 1 1 0 0 1 .192-.21c.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.392.451.462.576.685.915.176.264.336.536.446.848.066.194-.02.353-.25.45"}]];case"google":case"gemini":return[["path",{...REAL_MARK_ATTRS,d:"M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81"}]];case"groq":return[["path",{d:"M9.4 1.6 3.6 9.2h3.6L6 14.4l6.4-8.2H8.6Z"}]];case"mistral":return[["path",{d:"M2 13V7h3v6Z"}],["path",{d:"M6.5 13V4.6h3V13Z"}],["path",{d:"M11 13V8h3v5Z"}]];case"openrouter":return[["path",{d:"M2 8h4.4c1.2 0 1.8-.8 2.4-1.6"}],["path",{d:"M2 8h4.4c1.2 0 1.8.8 2.4 1.6"}],["path",{d:"M8.4 5.4 11.6 8 8.4 10.6"}]];case"together":case"together-ai":return[["circle",{cx:"4.6",cy:"8",r:"2.5"}],["circle",{cx:"11.4",cy:"8",r:"2.5"}]];case"xai":case"x-ai":case"grok":return[["path",{...REAL_MARK_ATTRS,d:"M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z"}]];case"huggingface":return[["path",{d:"M8 2.4 13.4 5.4 8 8.4 2.6 5.4Z"}],["path",{d:"M2.6 8 8 11l5.4-3"}]];case"fireworks":case"voyage-ai":return[["path",{d:"M2 8h2.4l1.4-4 2.4 8 2.4-6 1.4 2h2"}]];case"azure-openai":return[["rect",{x:"2.4",y:"2.4",width:"11.2",height:"11.2",rx:"2"}],["circle",{cx:"8",cy:"8",r:"2.8"}]];case"ollama":case"local":return[["path",{...REAL_MARK_ATTRS,d:"M16.361 10.26a.894.894 0 0 0-.558.47l-.072.148.001.207c0 .193.004.217.059.353.076.193.152.312.291.448.24.238.51.3.872.205a.86.86 0 0 0 .517-.436.752.752 0 0 0 .08-.498c-.064-.453-.33-.782-.724-.897a1.06 1.06 0 0 0-.466 0zm-9.203.005c-.305.096-.533.32-.65.639a1.187 1.187 0 0 0-.06.52c.057.309.31.59.598.667.362.095.632.033.872-.205.14-.136.215-.255.291-.448.055-.136.059-.16.059-.353l.001-.207-.072-.148a.894.894 0 0 0-.565-.472 1.02 1.02 0 0 0-.474.007Zm4.184 2c-.131.071-.223.25-.195.383.031.143.157.288.353.407.105.063.112.072.117.136.004.038-.01.146-.029.243-.02.094-.036.194-.036.222.002.074.07.195.143.253.064.052.076.054.255.059.164.005.198.001.264-.03.169-.082.212-.234.15-.525-.052-.243-.042-.28.087-.355.137-.08.281-.219.324-.314a.365.365 0 0 0-.175-.48.394.394 0 0 0-.181-.033c-.126 0-.207.03-.355.124l-.085.053-.053-.032c-.219-.13-.259-.145-.391-.143a.396.396 0 0 0-.193.032zm.39-2.195c-.373.036-.475.05-.654.086-.291.06-.68.195-.951.328-.94.46-1.589 1.226-1.787 2.114-.04.176-.045.234-.045.53 0 .294.005.357.043.524.264 1.16 1.332 2.017 2.714 2.173.3.033 1.596.033 1.896 0 1.11-.125 2.064-.727 2.493-1.571.114-.226.169-.372.22-.602.039-.167.044-.23.044-.523 0-.297-.005-.355-.045-.531-.288-1.29-1.539-2.304-3.072-2.497a6.873 6.873 0 0 0-.855-.031zm.645.937a3.283 3.283 0 0 1 1.44.514c.223.148.537.458.671.662.166.251.26.508.303.82.02.143.01.251-.043.482-.08.345-.332.705-.672.957a3.115 3.115 0 0 1-.689.348c-.382.122-.632.144-1.525.138-.582-.006-.686-.01-.853-.042-.57-.107-1.022-.334-1.35-.68-.264-.28-.385-.535-.45-.946-.03-.192.025-.509.137-.776.136-.326.488-.73.836-.963.403-.269.934-.46 1.422-.512.187-.02.586-.02.773-.002zm-5.503-11a1.653 1.653 0 0 0-.683.298C5.617.74 5.173 1.666 4.985 2.819c-.07.436-.119 1.04-.119 1.503 0 .544.064 1.24.155 1.721.02.107.031.202.023.208a8.12 8.12 0 0 1-.187.152 5.324 5.324 0 0 0-.949 1.02 5.49 5.49 0 0 0-.94 2.339 6.625 6.625 0 0 0-.023 1.357c.091.78.325 1.438.727 2.04l.13.195-.037.064c-.269.452-.498 1.105-.605 1.732-.084.496-.095.629-.095 1.294 0 .67.009.803.088 1.266.095.555.288 1.143.503 1.534.071.128.243.393.264.407.007.003-.014.067-.046.141a7.405 7.405 0 0 0-.548 1.873c-.062.417-.071.552-.071.991 0 .56.031.832.148 1.279L3.42 24h1.478l-.05-.091c-.297-.552-.325-1.575-.068-2.597.117-.472.25-.819.498-1.296l.148-.29v-.177c0-.165-.003-.184-.057-.293a.915.915 0 0 0-.194-.25 1.74 1.74 0 0 1-.385-.543c-.424-.92-.506-2.286-.208-3.451.124-.486.329-.918.544-1.154a.787.787 0 0 0 .223-.531c0-.195-.07-.355-.224-.522a3.136 3.136 0 0 1-.817-1.729c-.14-.96.114-2.005.69-2.834.563-.814 1.353-1.336 2.237-1.475.199-.033.57-.028.776.01.226.04.367.028.512-.041.179-.085.268-.19.374-.431.093-.215.165-.333.36-.576.234-.29.46-.489.822-.729.413-.27.884-.467 1.352-.561.17-.035.25-.04.569-.04.319 0 .398.005.569.04a4.07 4.07 0 0 1 1.914.997c.117.109.398.457.488.602.034.057.095.177.132.267.105.241.195.346.374.43.14.068.286.082.503.045.343-.058.607-.053.943.016 1.144.23 2.14 1.173 2.581 2.437.385 1.108.276 2.267-.296 3.153-.097.15-.193.27-.333.419-.301.322-.301.722-.001 1.053.493.539.801 1.866.708 3.036-.062.772-.26 1.463-.533 1.854a2.096 2.096 0 0 1-.224.258.916.916 0 0 0-.194.25c-.054.109-.057.128-.057.293v.178l.148.29c.248.476.38.823.498 1.295.253 1.008.231 2.01-.059 2.581a.845.845 0 0 0-.044.098c0 .006.329.009.732.009h.73l.02-.074.036-.134c.019-.076.057-.3.088-.516.029-.217.029-1.016 0-1.258-.11-.875-.295-1.57-.597-2.226-.032-.074-.053-.138-.046-.141.008-.005.057-.074.108-.152.376-.569.607-1.284.724-2.228.031-.26.031-1.378 0-1.628-.083-.645-.182-1.082-.348-1.525a6.083 6.083 0 0 0-.329-.7l-.038-.064.131-.194c.402-.604.636-1.262.727-2.04a6.625 6.625 0 0 0-.024-1.358 5.512 5.512 0 0 0-.939-2.339 5.325 5.325 0 0 0-.95-1.02 8.097 8.097 0 0 1-.186-.152.692.692 0 0 1 .023-.208c.208-1.087.201-2.443-.017-3.503-.19-.924-.535-1.658-.98-2.082-.354-.338-.716-.482-1.15-.455-.996.059-1.8 1.205-2.116 3.01a6.805 6.805 0 0 0-.097.726c0 .036-.007.066-.015.066a.96.96 0 0 1-.149-.078A4.857 4.857 0 0 0 12 3.03c-.832 0-1.687.243-2.456.698a.958.958 0 0 1-.148.078c-.008 0-.015-.03-.015-.066a6.71 6.71 0 0 0-.097-.725C8.997 1.392 8.337.319 7.46.048a2.096 2.096 0 0 0-.585-.041Zm.293 1.402c.248.197.523.759.682 1.388.03.113.06.244.069.292.007.047.026.152.041.233.067.365.098.76.102 1.24l.002.475-.12.175-.118.178h-.278c-.324 0-.646.041-.954.124l-.238.06c-.033.007-.038-.003-.057-.144a8.438 8.438 0 0 1 .016-2.323c.124-.788.413-1.501.696-1.711.067-.05.079-.049.157.013zm9.825-.012c.17.126.358.46.498.888.28.854.36 2.028.212 3.145-.019.14-.024.151-.057.144l-.238-.06a3.693 3.693 0 0 0-.954-.124h-.278l-.119-.178-.119-.175.002-.474c.004-.669.066-1.19.214-1.772.157-.623.434-1.185.68-1.382.078-.062.09-.063.159-.012z"}]];default:return[["circle",{cx:"8",cy:"8",r:"3.2"}]]}}function buildProviderMark(e,r,t,a){const i=a||providerOfModel(r),o=PROVIDER_LABELS[i]||String(t||""),c=e.createElement("span");c.className="provider-mark"+(i?` provider-${i}`:" provider-unknown"),c.setAttribute("role","img"),c.setAttribute("aria-label",o||"unknown provider"),c.title=o?`This model is served by ${o}`:"Provider unknown for this model";const n="http://www.w3.org/2000/svg",l=e.createElementNS(n,"svg");l.setAttribute("viewBox","0 0 16 16"),l.setAttribute("width","14"),l.setAttribute("height","14"),l.setAttribute("aria-hidden","true"),l.setAttribute("focusable","false");for(const[r,t]of providerGlyph(i)){const a=e.createElementNS(n,r);for(const e of Object.keys(t))a.setAttribute(e,t[e]);l.appendChild(a)}return c.appendChild(l),{el:c,provider:i,label:o}}function paintProviderMark(e,r,t,a){if(!e||"undefined"==typeof document)return!1;const i=buildProviderMark(document,r,t,a);return e.textContent="",e.appendChild(i.el),!0}"undefined"!=typeof window&&(window.aegisProviderMark={paint:paintProviderMark,build:buildProviderMark,providerOfModel:providerOfModel,providerGlyph:providerGlyph,PROVIDER_LABELS:PROVIDER_LABELS}),"undefined"!=typeof module&&module.exports&&(module.exports={providerOfModel:providerOfModel,providerGlyph:providerGlyph,buildProviderMark:buildProviderMark,PROVIDER_LABELS:PROVIDER_LABELS,VENDOR_MATCHERS:VENDOR_MATCHERS});
|
|
@@ -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";!function(){if("undefined"==typeof window)return;const e=window.aegisProviders;function
|
|
3
|
+
"use strict";!function(){if("undefined"==typeof window)return;const e=window.aegisProviders;if(!e)return;const t=window.aegisProviderMark;function n(e,t,n){const l=document.createElement(e);return t&&(l.className=t),null!=n&&(l.textContent=n),l}window.aegisProviderToolbar={mount:function(l){const o=l||{};let i=[];function r(l){const i=n("li","pt-row");if(l.selectable){const r=n("button","pt-pick");r.type="button";const d=n("div","pt-head");if(t&&"function"==typeof t.build){const e="local"===l.class?"ollama":l.provider||"",n=t.build(document,l.model,l.classLabel,e);n.el.classList.add("pt-mark"),d.appendChild(n.el)}d.appendChild(n("span","pt-model",l.modelLabel||l.model)),r.appendChild(d),l.model&&l.modelLabel&&l.modelLabel!==l.model&&r.appendChild(n("span","pt-id",l.model)),r.appendChild(n("span","pt-target",l.url?`${l.method} ${l.url}`:"no network route — runs as a local process")),r.addEventListener("click",(()=>{o.onSelect&&o.onSelect(e.selectionFor(l))})),i.appendChild(r)}else i.appendChild(n("span","pt-model pt-muted",l.modelLabel)),i.appendChild(n("span","pt-target",l.url?`${l.method} ${l.url}`:"—"));return l.billing&&i.appendChild(n("span","pt-billing",l.billing)),l.blocked&&i.appendChild(n("span","pt-blocked",l.blocked)),i}function d(t){const l=e.filterEntries(i,t);if(o.count&&(o.count.textContent=i.length?`${l.length} of ${i.length} provider route${1===i.length?"":"s"}`:"no providers reported"),o.list){o.list.innerHTML="";let e=null,t=null;for(const i of l){if(i.group!==e){e=i.group;const l=n("li","pt-group");l.appendChild(n("h3","pt-group-title",e)),t=n("ul","pt-rows"),l.appendChild(t),o.list.appendChild(l)}t.appendChild(r(i))}l.length||o.list.appendChild(n("li","pt-empty",i.length?"No provider or model matches that filter.":"No provider paths yet — press Refresh once a key is saved."))}if(o.hint&&t&&l.length){const e=l.filter((e=>e.url&&!/localhost|127\.0\.0\.1/.test(e.url))).length,t=l.filter((e=>e.url&&/localhost|127\.0\.0\.1/.test(e.url))).length,n=l.filter((e=>!e.url)).length;o.hint.textContent=[e?`${e} over the network`:"",t?`${t} on this machine`:"",n?`${n} with no route`:""].filter(Boolean).join(" · ")}else o.hint&&!t&&(o.hint.textContent=i.length?"Every provider this build can address, and the URL a turn to it uses.":"")}return o.search&&o.search.addEventListener("input",(()=>d(o.search.value))),{set:t=>(i=e.buildProviderPaths(t),d(o.search?o.search.value:""),i),entries:()=>i.slice()}}}}();
|
|
@@ -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 POOLED_PATH="/api/v1/chat/completions",BYOK_PATH="/api/v1/byok/chat/completions",LOCAL_PATH="/v1/chat/completions",DEFAULT_CLOUD_BASE="https://aegiscloud.org",DEFAULT_LOCAL_BASE="http://localhost:11434";function joinUrl(e,l){const o="string"==typeof e?e.trim():"",r="string"==typeof l?l.trim():"";return o?/^https?:\/\//i.test(r)?r:r?`${o.replace(/\/+$/,"")}/${r.replace(/^\/+/,"")}`:o.replace(/\/+$/,""):""}function billingFor(e,l,o,r){if("pro"===e)return"Claude Code subscription — no AEGIS tokens spent";if("local"===e)return"free — runs on this machine";if("byok"===e){const e=r&&r.fee||null;return e&&e.require_balance?"your provider key pays the vendor; an AEGIS key and a funded balance pay the handling fee":"your provider key pays the vendor; an AEGIS key attributes the handling fee"}return"billed to your AEGIS account"}function blockedReason(e,l,o,r){return"aegis"===e&&r&&r.needsKey?"no AEGIS API key on this machine":"local"===e&&r&&r.needsDaemon?"no model server listening":"local"===e&&r&&!1===r.listed?"server answered but lists no models":"byok"===e&&o&&!1===o.configured?o.keyRejected?`provider key rejected: ${o.keyRejected}`:"no key saved for this provider":"pro"===e&&l&&!1===l.configured?"not signed in to Claude Code":null}function buildProviderPaths(e){const l=[],o=Array.isArray(e)?e:[];for(const e of o){if(!e||"string"!=typeof e.class)continue;const o=e.class,r={configured:!1!==e.classConfigured},
|
|
3
|
+
"use strict";const POOLED_PATH="/api/v1/chat/completions",BYOK_PATH="/api/v1/byok/chat/completions",LOCAL_PATH="/v1/chat/completions",DEFAULT_CLOUD_BASE="https://aegiscloud.org",DEFAULT_LOCAL_BASE="http://localhost:11434";function joinUrl(e,l){const o="string"==typeof e?e.trim():"",r="string"==typeof l?l.trim():"";return o?/^https?:\/\//i.test(r)?r:r?`${o.replace(/\/+$/,"")}/${r.replace(/^\/+/,"")}`:o.replace(/\/+$/,""):""}function billingFor(e,l,o,r){if("pro"===e)return"Claude Code subscription — no AEGIS tokens spent";if("local"===e)return"free — runs on this machine";if("byok"===e){const e=r&&r.fee||null;return e&&e.require_balance?"your provider key pays the vendor; an AEGIS key and a funded balance pay the handling fee":"your provider key pays the vendor; an AEGIS key attributes the handling fee"}return"billed to your AEGIS account"}function blockedReason(e,l,o,r){return"aegis"===e&&r&&r.needsKey?"no AEGIS API key on this machine":"local"===e&&r&&r.needsDaemon?"no model server listening":"local"===e&&r&&!1===r.listed?"server answered but lists no models":"byok"===e&&o&&!1===o.configured?o.keyRejected?`provider key rejected: ${o.keyRejected}`:"no key saved for this provider":"pro"===e&&l&&!1===l.configured?"not signed in to Claude Code":null}function buildProviderPaths(e){const l=[],o=Array.isArray(e)?e:[];for(const e of o){if(!e||"string"!=typeof e.class)continue;const o=e.class,r={configured:!1!==e.classConfigured},i=e.list&&"object"==typeof e.list?e.list:null,n=Array.isArray(i&&i.models)?i.models:[],s=i&&(i.apiBase||i.baseURL)||DEFAULT_CLOUD_BASE,t=i&&i.baseURL||DEFAULT_LOCAL_BASE;if(n.length)for(const a of n){if(!a||!a.id)continue;const n="string"==typeof a.provider&&a.provider?a.provider:o;let d=null,c=null;"aegis"===o?(d=joinUrl(s,POOLED_PATH),c="POST"):"byok"===o?(d=joinUrl(s,BYOK_PATH),c="POST"):"local"===o&&(d=joinUrl(t,LOCAL_PATH),c="POST"),l.push({class:o,classLabel:e.classLabel||o,model:a.id,modelLabel:a.label||a.id,provider:n,uniqueModel:`${o}:${a.id}`,group:e.classLabel||o,url:d,method:c,billing:billingFor(o,r,a,i),blocked:blockedReason(o,r,a,i),selectable:!0})}else{const n="aegis"===o||"local"===o;l.push({class:o,classLabel:e.classLabel||o,model:"",modelLabel:"aegis"===o?"server default (auto)":"local"===o?"type a model tag in the Model card":"—",provider:"",uniqueModel:o,group:e.classLabel||o,url:n?joinUrl("local"===o?t:s,"local"===o?LOCAL_PATH:POOLED_PATH):null,method:n?"POST":null,billing:billingFor(o,r,null,i),blocked:blockedReason(o,r,null,i),selectable:!1})}}return l}function filterEntries(e,l){const o=Array.isArray(e)?e:[],r=String(null==l?"":l).trim().toLowerCase();if(!r)return o.slice();const i=r.split(/\s+/).filter(Boolean);return o.filter((e=>{const l=[e.model,e.modelLabel,e.provider,e.class,e.classLabel,e.url||""].join("\n").toLowerCase();return i.every((e=>l.includes(e)))}))}function selectionFor(e){return e?{class:e.class,model:"aegis"!==e.class||e.model?e.model:""}:null}"undefined"!=typeof module&&module.exports&&(module.exports={buildProviderPaths:buildProviderPaths,filterEntries:filterEntries,selectionFor:selectionFor,joinUrl:joinUrl,POOLED_PATH:POOLED_PATH,BYOK_PATH:BYOK_PATH,LOCAL_PATH:LOCAL_PATH}),"undefined"!=typeof window&&(window.aegisProviders={buildProviderPaths:buildProviderPaths,filterEntries:filterEntries,selectionFor:selectionFor,joinUrl:joinUrl,POOLED_PATH:POOLED_PATH,BYOK_PATH:BYOK_PATH,LOCAL_PATH:LOCAL_PATH});
|