aegis-desktop 0.8.15 → 0.8.16
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/main.js +20 -5
- package/package.json +1 -1
- package/renderer/app.js +13 -5
package/main.js
CHANGED
|
@@ -733,14 +733,29 @@ function createIpcDispatch(aegis, dir, persistApiKey, openExternal, providerConf
|
|
|
733
733
|
// In-app API key entry (plan rebuild): replace the live client key and
|
|
734
734
|
// persist it encrypted at rest via the settings store. The renderer only
|
|
735
735
|
// ever sees the masked preview back — never the raw key.
|
|
736
|
+
// Resolves `{ ok, ... }` / `{ ok: false, error }` rather than throwing —
|
|
737
|
+
// same reasoning as the fingerprint handlers below: an IPC rejection
|
|
738
|
+
// reaches the renderer as an opaque "Error invoking remote method" with
|
|
739
|
+
// the real cause buried in main-process logs, and key entry is the one
|
|
740
|
+
// flow every user hits on first run.
|
|
736
741
|
setApiKey: (payload) => {
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
742
|
+
try {
|
|
743
|
+
const key = payload && payload.key;
|
|
744
|
+
aegis.setApiKey(key || '');
|
|
745
|
+
if (persistApiKey) persistApiKey(aegis.apiKey);
|
|
746
|
+
return { ok: true, keyConfigured: Boolean(aegis.apiKey), keyMask: maskKey(aegis.apiKey) };
|
|
747
|
+
} catch (e) {
|
|
748
|
+
return { ok: false, error: (e && e.message) || String(e) };
|
|
749
|
+
}
|
|
741
750
|
},
|
|
742
751
|
|
|
743
|
-
verifyApiKey: () =>
|
|
752
|
+
verifyApiKey: async () => {
|
|
753
|
+
try {
|
|
754
|
+
return { ok: true, ...(await aegis.verifyApiKey()) };
|
|
755
|
+
} catch (e) {
|
|
756
|
+
return { ok: false, error: (e && e.message) || String(e) };
|
|
757
|
+
}
|
|
758
|
+
},
|
|
744
759
|
tokenBankBalance: () => aegis.tokenBankBalance(),
|
|
745
760
|
|
|
746
761
|
// Billing (plan upgrade + token-bank top-up). aegis1 creates a Stripe
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aegis-desktop",
|
|
3
3
|
"productName": "AEGIS Desktop",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.16",
|
|
5
5
|
"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.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "AEGIS Code",
|
package/renderer/app.js
CHANGED
|
@@ -967,9 +967,11 @@ function renderUpdateBanner(state) {
|
|
|
967
967
|
async function loadAccountInfo() {
|
|
968
968
|
try {
|
|
969
969
|
const verify = await aegis.verifyApiKey();
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
970
|
+
if (!verify || !verify.ok) {
|
|
971
|
+
els.plan.textContent = 'unavailable';
|
|
972
|
+
} else {
|
|
973
|
+
els.plan.textContent = verify.valid ? (verify.plan || 'active') : 'invalid key';
|
|
974
|
+
}
|
|
973
975
|
} catch {
|
|
974
976
|
els.plan.textContent = 'unavailable';
|
|
975
977
|
}
|
|
@@ -1098,11 +1100,14 @@ async function saveApiKey() {
|
|
|
1098
1100
|
els.apiKeyHint.textContent = 'saving…';
|
|
1099
1101
|
try {
|
|
1100
1102
|
const res = await aegis.setApiKey(key);
|
|
1103
|
+
if (!res || !res.ok) {
|
|
1104
|
+
throw new Error((res && res.error) || 'save failed');
|
|
1105
|
+
}
|
|
1101
1106
|
// Never retain the raw key in the DOM once saved — show only the masked
|
|
1102
1107
|
// preview the main process returned.
|
|
1103
1108
|
els.apiKeyInput.value = '';
|
|
1104
1109
|
els.apiKeyHint.textContent = key
|
|
1105
|
-
? `saved (${res
|
|
1110
|
+
? `saved (${res.keyMask ? res.keyMask : 'configured'})`
|
|
1106
1111
|
: 'key cleared';
|
|
1107
1112
|
await refreshAfterKeyChange();
|
|
1108
1113
|
} catch (err) {
|
|
@@ -1119,7 +1124,10 @@ async function verifyAegisKey() {
|
|
|
1119
1124
|
els.apiKeyHint.textContent = 'verifying…';
|
|
1120
1125
|
try {
|
|
1121
1126
|
const verify = await aegis.verifyApiKey();
|
|
1122
|
-
|
|
1127
|
+
if (!verify || !verify.ok) {
|
|
1128
|
+
throw new Error((verify && verify.error) || 'verify failed');
|
|
1129
|
+
}
|
|
1130
|
+
els.apiKeyHint.textContent = verify.valid
|
|
1123
1131
|
? `valid (${verify.plan || 'active'})`
|
|
1124
1132
|
: 'invalid key';
|
|
1125
1133
|
} catch (err) {
|