aegisone 1.0.31 → 1.0.33
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 +2 -2
- package/package.json +1 -1
- package/scripts/predist.mjs +1 -1
- package/vendor/cli/package.json +1 -1
- package/vendor/cli/src/filepreview.js +3 -0
- package/vendor/cli/src/naming.js +1 -1
- package/vendor/cli/src/render.js +1 -1
- package/vendor/cli/vendor/client/naming.js +3 -0
- package/vendor/cli/vendor/client/session-store.js +1 -1
- package/vendor/cli/vendor/desktop/lib/local/exec-plan.js +269 -1
- package/vendor/cli/vendor/desktop/lib/local/integrity.js +165 -0
- package/vendor/cli/vendor/desktop/lib/local/shell.js +712 -1
- package/vendor/cli/vendor/desktop/lib/local/tools.js +1328 -1
- package/vendor/cli/vendor/desktop/main.js +4893 -0
- package/vendor/desktop/lib/local/integrity.js +1 -1
- package/vendor/desktop/main.js +57 -2
- package/vendor/desktop/package.json +1 -1
- package/vendor/desktop/preload.js +1 -1
- package/vendor/desktop/renderer/app.js +1 -1
- package/vendor/desktop/renderer/filepreview.js +3 -0
- package/vendor/desktop/renderer/index.html +75 -22
- package/vendor/desktop/renderer/provider-mark.js +3 -0
- package/vendor/desktop/renderer/style.css +232 -19
- package/vendor/desktop/vendor/naming.js +3 -0
- package/vendor/desktop/vendor/session-store.js +1 -1
|
@@ -94,7 +94,7 @@ const UNITS = Object.freeze([
|
|
|
94
94
|
* (`tools/desktop-seal.mjs` in the source tree, `tools/obfuscate-faces.mjs`
|
|
95
95
|
* after obfuscation), never by hand.
|
|
96
96
|
*/
|
|
97
|
-
const SEALED = '
|
|
97
|
+
const SEALED = 'dc27eef1b63a4ba52eaacc8476dcf5de82020d3d4614662a44b9b99fa18e5579';
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
100
|
* Ask the question. Never throws — a check that can break the program it is
|
package/vendor/desktop/main.js
CHANGED
|
@@ -1980,7 +1980,7 @@ function createModelDispatch(engine, { env = process.env, settings } = {}) {
|
|
|
1980
1980
|
* resolve `{ ok: false, reason }` without ever throwing, and every local
|
|
1981
1981
|
* flow (save/append/list) keeps working untouched.
|
|
1982
1982
|
*/
|
|
1983
|
-
function createSyncDispatch(sessions, dir, aegis, settingsDir) {
|
|
1983
|
+
function createSyncDispatch(sessions, dir, aegis, settingsDir, modelDispatch) {
|
|
1984
1984
|
let lastSyncAt = null;
|
|
1985
1985
|
|
|
1986
1986
|
function hasCloud() {
|
|
@@ -2149,6 +2149,61 @@ function createSyncDispatch(sessions, dir, aegis, settingsDir) {
|
|
|
2149
2149
|
),
|
|
2150
2150
|
delete: (payload) =>
|
|
2151
2151
|
sessions.deleteSession(dir, payload && payload.sessionId),
|
|
2152
|
+
// The naming ladder (client/naming.js), run in the MAIN process.
|
|
2153
|
+
//
|
|
2154
|
+
// The window used to name a thread `prompt.slice(0, 60)` — in the renderer,
|
|
2155
|
+
// before anything could rename it — so a desktop session was called after
|
|
2156
|
+
// its first message while the same conversation in a terminal was called
|
|
2157
|
+
// after its topic. Bringing the ladder to this side rather than the
|
|
2158
|
+
// renderer is deliberate: the model round needs the session's own class,
|
|
2159
|
+
// model and key, which live here, and a renderer-side naming round would
|
|
2160
|
+
// be a second, differently-authenticated client.
|
|
2161
|
+
//
|
|
2162
|
+
// Best-effort throughout, like the CLI's: an unavailable engine or an
|
|
2163
|
+
// unusable answer leaves the seed in place, and `null` means "no opinion".
|
|
2164
|
+
nameSession: async (payload) => {
|
|
2165
|
+
const sessionId = payload && payload.sessionId;
|
|
2166
|
+
const prompt = payload && payload.prompt;
|
|
2167
|
+
if (!sessionId || !String(prompt == null ? '' : prompt).trim()) return null;
|
|
2168
|
+
let namingLib;
|
|
2169
|
+
for (const candidate of ['../client/naming.js', './vendor/naming.js', './vendor/client/naming.js']) {
|
|
2170
|
+
try {
|
|
2171
|
+
namingLib = require(candidate);
|
|
2172
|
+
break;
|
|
2173
|
+
} catch {
|
|
2174
|
+
/* try the next layout: repo, then published */
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
if (!namingLib) return null;
|
|
2178
|
+
// The naming round must go through the session's own turn path: same
|
|
2179
|
+
// class, same model, same key, `tools: false` (naming is not a turn),
|
|
2180
|
+
// and a small budget because the answer is 2–6 words.
|
|
2181
|
+
const callModel = async (text, opts = {}) => {
|
|
2182
|
+
if (!modelDispatch || typeof modelDispatch.chat !== 'function') return null;
|
|
2183
|
+
try {
|
|
2184
|
+
const data = await modelDispatch.chat({
|
|
2185
|
+
class: (payload && payload.class) || 'model',
|
|
2186
|
+
model: payload && payload.model,
|
|
2187
|
+
prompt: text,
|
|
2188
|
+
system: opts.system,
|
|
2189
|
+
maxTokens: 64,
|
|
2190
|
+
sessionId,
|
|
2191
|
+
// `tools: false` is the engine's own opt-out (a naming round must
|
|
2192
|
+
// not run the agent loop); nothing else here is a wire field.
|
|
2193
|
+
tools: false,
|
|
2194
|
+
});
|
|
2195
|
+
const choice = (data && data.choices && data.choices[0]) || {};
|
|
2196
|
+
return (choice.message && choice.message.content) || null;
|
|
2197
|
+
} catch {
|
|
2198
|
+
return null;
|
|
2199
|
+
}
|
|
2200
|
+
};
|
|
2201
|
+
try {
|
|
2202
|
+
return await namingLib.nameSession(sessions, dir, sessionId, prompt, { callModel });
|
|
2203
|
+
} catch {
|
|
2204
|
+
return null;
|
|
2205
|
+
}
|
|
2206
|
+
},
|
|
2152
2207
|
push,
|
|
2153
2208
|
pull,
|
|
2154
2209
|
status: () => ({
|
|
@@ -2268,7 +2323,7 @@ function createHeartbeatRetry(push, opts = {}) {
|
|
|
2268
2323
|
*/
|
|
2269
2324
|
function registerModelIpc(ipcMain, engine, sessionsDir, aegis, onReplyFinished, heartbeatOpts, settingsDir) {
|
|
2270
2325
|
const modelDispatch = createModelDispatch(engine);
|
|
2271
|
-
const syncDispatch = createSyncDispatch(sessionStore, sessionsDir, aegis, settingsDir);
|
|
2326
|
+
const syncDispatch = createSyncDispatch(sessionStore, sessionsDir, aegis, settingsDir, modelDispatch);
|
|
2272
2327
|
|
|
2273
2328
|
const heartbeat = createHeartbeatRetry(() => syncDispatch.push(), heartbeatOpts);
|
|
2274
2329
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "aegis-desktop",
|
|
3
3
|
"productName": "AEGIS Desktop",
|
|
4
4
|
"desktopName": "aegis-desktop",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.25",
|
|
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",
|
|
@@ -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{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_PREFIX}progress`,CHAT_DELTA_CHANNEL="aegis:chatDelta",UPDATE_STATUS_CHANNEL="aegis:updateStatus",ACCOUNT_STATUS_CHANNEL="aegis:accountStatusChanged",MENU_NEW_CHAT_CHANNEL="aegis:menuNewChat",MENU_SEARCH_CHANNEL="aegis:menuSearch",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_PREFIX+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),t=()=>ipcRenderer.removeListener("aegis:chatDelta",i);return ipcRenderer.on("aegis:chatDelta",i),invoke("chatCompletion",{...o,stream:!0}).then((e=>(t(),e)),(e=>{throw t(),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||{}),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||{}),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)}),getVaultBackend:()=>invoke("getVaultBackend"),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}),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)},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),t=()=>ipcRenderer.removeListener("aegis:chatDelta",i);return ipcRenderer.on("aegis:chatDelta",i),invokeModel("chat",o).then((e=>(t(),e)),(e=>{throw t(),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")},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})},sync={listSessions:()=>invokeSync("listSessions"),open:e=>invokeSync("open",{sessionId:e}),save:e=>invokeSync("save",e||{}),append:(e,n)=>invokeSync("append",{sessionId:e,message:n}),delete:e=>invokeSync("delete",{sessionId:e}),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_CHANNEL,n),()=>ipcRenderer.removeListener(QUEUE_PROGRESS_CHANNEL,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));
|
|
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_PREFIX}progress`,CHAT_DELTA_CHANNEL="aegis:chatDelta",UPDATE_STATUS_CHANNEL="aegis:updateStatus",ACCOUNT_STATUS_CHANNEL="aegis:accountStatusChanged",MENU_NEW_CHAT_CHANNEL="aegis:menuNewChat",MENU_SEARCH_CHANNEL="aegis:menuSearch",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_PREFIX+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),t=()=>ipcRenderer.removeListener("aegis:chatDelta",i);return ipcRenderer.on("aegis:chatDelta",i),invoke("chatCompletion",{...o,stream:!0}).then((e=>(t(),e)),(e=>{throw t(),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||{}),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||{}),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)}),getVaultBackend:()=>invoke("getVaultBackend"),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}),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)},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),t=()=>ipcRenderer.removeListener("aegis:chatDelta",i);return ipcRenderer.on("aegis:chatDelta",i),invokeModel("chat",o).then((e=>(t(),e)),(e=>{throw t(),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")},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})},sync={listSessions:()=>invokeSync("listSessions"),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}),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_CHANNEL,n),()=>ipcRenderer.removeListener(QUEUE_PROGRESS_CHANNEL,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));
|