aegisone 1.0.54 → 1.0.55
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 +1 -1
- package/bin/aegis.js +1 -1
- package/package.json +1 -1
- package/vendor/cli/package.json +1 -1
- package/vendor/cli/vendor/desktop/lib/local/integrity.js +1 -1
- package/vendor/cli/vendor/desktop/main.js +60 -7
- package/vendor/desktop/lib/local/integrity.js +1 -1
- package/vendor/desktop/main.js +60 -7
- package/vendor/desktop/package.json +1 -1
- package/vendor/desktop/renderer/app.js +3 -3
- package/vendor/desktop/renderer/filepreview.js +1 -1
- package/vendor/desktop/renderer/index.html +12 -0
- package/vendor/desktop/renderer/style.css +59 -0
- package/vendor/desktop/vendor/faces/cli/package.json +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
package/README.md
CHANGED
package/bin/aegis.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
3
|
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
4
|
-
"use strict";const fs=require("node:fs"),path=require("node:path"),{spawnSync:spawnSync,spawn:spawn}=require("node:child_process"),{decide:decide,FACE:FACE}=require("../src/dispatch.js"),WIN=require("../src/iface/window.js"),probes=require("../src/probes.js"),release=require("../src/release.js"),productHelp=require("../src/producthelp.js"),productUpdate=require("../src/productupdate.js"),EXIT_USAGE=2,PRODUCT=require("../package.json");function faceManifestPaths(e,t){const r=t||__dirname;return[path.join(r,"..","vendor",e.dir,"package.json"),path.join(r,"..","..",e.dir,"package.json")]}function readFaceVersions(e){return release.FACE_LINES.map((t=>{for(const r of faceManifestPaths(t,e))try{return{package:t.package,version:JSON.parse(fs.readFileSync(r,"utf8")).version,source:r}}catch{}return{package:t.package,version:null,source:null}}))}function write(e,t){try{e.write(t.endsWith("\n")?t:t+"\n")}catch{}}function runUpdate(e,t,r){const s=t||{},{stdout:n,stderr:i,input:o}=r,a=void 0!==s.installed?s.installed:isInstalledLayout(s.binDir),c=s.updatePlan?s.updatePlan():productUpdate.plan({installed:a,env:o&&o.env||{}});if(!c.ok)return write(i,`aegis: ${c.msg}`),EXIT_USAGE;const u=s.fetchLatest||defaultFetchLatest(s.binDir);return productUpdate.check({current:PRODUCT.version,action:e.action},{fetchImpl:u}).then((t=>{for(const e of t.lines)write(n,e);if("apply"!==e.action)return!0===t.upToDate?0:1;const r=productUpdate.apply(c,t,{runImpl:s.runInstall||defaultRunInstall});if(r.ok){write(n,r.lines?r.lines[0]:"Installed.");for(const e of String(r.output||"").split("\n").slice(-6))e.trim()&&write(n,` ${e}`);return 0}return r.skipped?(write(n,` ${r.msg}`),!0===t.upToDate?0:1):(write(i,`aegis: ${r.msg||"the install failed"}`),r.error&&write(i,`aegis: ${r.error}`),r.command&&write(i,`aegis: run it yourself: ${r.command}`),3)}))}function isInstalledLayout(e){const t=e||__dirname,r=path.join(t,"..");try{return!fs.existsSync(path.join(r,"..","one","package.json"))}catch{return!0}}function defaultFetchLatest(e){const t=e||__dirname,r=path.join(t,".."),s=[path.join(r,"client","update.js"),path.join(r,"vendor","cli","vendor","client","update.js")];for(const e of s)try{const t=require(e);if("function"==typeof t.fetchLatestDetailed)return e=>t.fetchLatestDetailed({...e||{},pkg:productUpdate.PRODUCT_PKG});if("function"==typeof t.fetchLatest)return e=>t.fetchLatest({...e||{},pkg:productUpdate.PRODUCT_PKG})}catch{}return null}function defaultRunInstall(e){try{const t=spawnSync(e.command,e.args,{encoding:"utf8",timeout:18e4,stdio:["ignore","pipe","pipe"],shell:!0===e.shell,windowsHide:!0});return t.error?{ok:!1,error:String(t.error.message||t.error)}:0!==t.status?{ok:!1,error:String((t.stderr||t.stdout||"").trim()||`exited ${t.status}`)}:{ok:!0,output:String(t.stdout||"")}}catch(e){return{ok:!1,error:String(e&&e.message||e)}}}function statusOf(e){return"number"==typeof e.status?e.status:"SIGINT"===e.signal?130:"SIGTERM"===e.signal?143:1}function run(e,t){const r=t||{},s=r.stderr||process.stderr,n=r.stdout||process.stdout,i=r.input||probes.collect({argv:e}),o=Array.isArray(e)?{...i,argv:e}:i,a=release.versionRequest(o.argv);if(a){const e=a.verbose?r.readFaceVersions?r.readFaceVersions():readFaceVersions(r.binDir):null;return write(n,release.renderVersion({product:{name:PRODUCT.name,version:PRODUCT.version},faces:e})),0}if((r.helpRequest||productHelp.helpRequest)(o.argv))return write(n,productHelp.renderHelp({version:PRODUCT.version})),0;const c=(r.updateRequest||productUpdate.updateRequest)(o.argv);if(c&&"help"===c.action)return write(n,productUpdate.renderUsage(PRODUCT.version)),0;if(c)return runUpdate(c,r,{stdout:n,stderr:s,input:o});const u=(o.argv||[]).indexOf("doctor");if(-1!==u&&!(o.argv||[]).slice(0,u).some((e=>!e.startsWith("-")))){const e=r.doctor||require("../src/doctor.js"),t=Object.assign({env:o.env,stdout:n,electron:o._electron||r.electron||null},r.doctorDeps||{}),s=e.main((o.argv||[]).slice(u+1),t);return"number"==typeof s?s:EXIT_USAGE}const d=decide(o),p=r.permissions||require("../src/permissions.js"),l=(o.argv||[]).indexOf(p.SKIP_FLAG||"--dangerously-skip-permissions"),f=Boolean(o.tty&&o.tty.stdin&&o.tty.stdout),g=f?"interactive":"headless",h=r.stored||p.storedPermissionFacts(r.storedOpts||{}),m=p.resolvePosture({rules:void 0!==r.rules?r.rules:h.rules,gate:void 0!==r.gate?r.gate:h.confirmationsOn,permissionMode:void 0!==r.permissionMode?r.permissionMode:h.permissionMode,flag:-1!==l,env:o.env,interactive:f,childKind:g});m.warning&&write(s,`aegis: ${m.warning}`),m.skip&&m.skipFromFlag&&write(s,p.skipReport(m));const w=-1===l?d.args:d.args.filter((e=>e!==(p.SKIP_FLAG||"--dangerously-skip-permissions"))),v=m.skipFromFlag?{AEGISONE_SKIP_PERMISSIONS:"1"}:{};if("1"===(o.env||{}).AEGISONE_PRINT_DECISION&&write(s,"aegis: decision "+JSON.stringify({face:d.face,kind:d.kind,reason:d.reason,args:w,skip:m.skip})),null===d.face)return write(s,`aegis: ${d.error}`),d.hint&&write(s,`aegis: ${d.hint}`),d.code||EXIT_USAGE;d.notice&&write(s,`aegis: ${d.notice} — running the terminal face.`);const
|
|
4
|
+
"use strict";const fs=require("node:fs"),path=require("node:path"),{spawnSync:spawnSync,spawn:spawn}=require("node:child_process"),{decide:decide,FACE:FACE}=require("../src/dispatch.js"),WIN=require("../src/iface/window.js"),probes=require("../src/probes.js"),release=require("../src/release.js"),productHelp=require("../src/producthelp.js"),productUpdate=require("../src/productupdate.js"),EXIT_USAGE=2,PRODUCT=require("../package.json");function faceManifestPaths(e,t){const r=t||__dirname;return[path.join(r,"..","vendor",e.dir,"package.json"),path.join(r,"..","..",e.dir,"package.json")]}function readFaceVersions(e){return release.FACE_LINES.map((t=>{for(const r of faceManifestPaths(t,e))try{return{package:t.package,version:JSON.parse(fs.readFileSync(r,"utf8")).version,source:r}}catch{}return{package:t.package,version:null,source:null}}))}function write(e,t){try{e.write(t.endsWith("\n")?t:t+"\n")}catch{}}function runUpdate(e,t,r){const s=t||{},{stdout:n,stderr:i,input:o}=r,a=void 0!==s.installed?s.installed:isInstalledLayout(s.binDir),c=s.updatePlan?s.updatePlan():productUpdate.plan({installed:a,env:o&&o.env||{}});if(!c.ok)return write(i,`aegis: ${c.msg}`),EXIT_USAGE;const u=s.fetchLatest||defaultFetchLatest(s.binDir);return productUpdate.check({current:PRODUCT.version,action:e.action},{fetchImpl:u}).then((t=>{for(const e of t.lines)write(n,e);if("apply"!==e.action)return!0===t.upToDate?0:1;const r=productUpdate.apply(c,t,{runImpl:s.runInstall||defaultRunInstall});if(r.ok){write(n,r.lines?r.lines[0]:"Installed.");for(const e of String(r.output||"").split("\n").slice(-6))e.trim()&&write(n,` ${e}`);return 0}return r.skipped?(write(n,` ${r.msg}`),!0===t.upToDate?0:1):(write(i,`aegis: ${r.msg||"the install failed"}`),r.error&&write(i,`aegis: ${r.error}`),r.command&&write(i,`aegis: run it yourself: ${r.command}`),3)}))}function isInstalledLayout(e){const t=e||__dirname,r=path.join(t,"..");try{return!fs.existsSync(path.join(r,"..","one","package.json"))}catch{return!0}}function defaultFetchLatest(e){const t=e||__dirname,r=path.join(t,".."),s=[path.join(r,"client","update.js"),path.join(r,"vendor","cli","vendor","client","update.js")];for(const e of s)try{const t=require(e);if("function"==typeof t.fetchLatestDetailed)return e=>t.fetchLatestDetailed({...e||{},pkg:productUpdate.PRODUCT_PKG});if("function"==typeof t.fetchLatest)return e=>t.fetchLatest({...e||{},pkg:productUpdate.PRODUCT_PKG})}catch{}return null}function defaultRunInstall(e){try{const t=spawnSync(e.command,e.args,{encoding:"utf8",timeout:18e4,stdio:["ignore","pipe","pipe"],shell:!0===e.shell,windowsHide:!0});return t.error?{ok:!1,error:String(t.error.message||t.error)}:0!==t.status?{ok:!1,error:String((t.stderr||t.stdout||"").trim()||`exited ${t.status}`)}:{ok:!0,output:String(t.stdout||"")}}catch(e){return{ok:!1,error:String(e&&e.message||e)}}}function statusOf(e){return"number"==typeof e.status?e.status:"SIGINT"===e.signal?130:"SIGTERM"===e.signal?143:1}function run(e,t){const r=t||{},s=r.stderr||process.stderr,n=r.stdout||process.stdout,i=r.input||probes.collect({argv:e}),o=Array.isArray(e)?{...i,argv:e}:i,a=release.versionRequest(o.argv);if(a){const e=a.verbose?r.readFaceVersions?r.readFaceVersions():readFaceVersions(r.binDir):null;return write(n,release.renderVersion({product:{name:PRODUCT.name,version:PRODUCT.version},faces:e})),0}if((r.helpRequest||productHelp.helpRequest)(o.argv))return write(n,productHelp.renderHelp({version:PRODUCT.version})),0;const c=(r.updateRequest||productUpdate.updateRequest)(o.argv);if(c&&"help"===c.action)return write(n,productUpdate.renderUsage(PRODUCT.version)),0;if(c)return runUpdate(c,r,{stdout:n,stderr:s,input:o});const u=(o.argv||[]).indexOf("doctor");if(-1!==u&&!(o.argv||[]).slice(0,u).some((e=>!e.startsWith("-")))){const e=r.doctor||require("../src/doctor.js"),t=Object.assign({env:o.env,stdout:n,electron:o._electron||r.electron||null},r.doctorDeps||{}),s=e.main((o.argv||[]).slice(u+1),t);return"number"==typeof s?s:EXIT_USAGE}const d=decide(o),p=r.permissions||require("../src/permissions.js"),l=(o.argv||[]).indexOf(p.SKIP_FLAG||"--dangerously-skip-permissions"),f=Boolean(o.tty&&o.tty.stdin&&o.tty.stdout),g=f?"interactive":"headless",h=r.stored||p.storedPermissionFacts(r.storedOpts||{}),m=p.resolvePosture({rules:void 0!==r.rules?r.rules:h.rules,gate:void 0!==r.gate?r.gate:h.confirmationsOn,permissionMode:void 0!==r.permissionMode?r.permissionMode:h.permissionMode,flag:-1!==l,env:o.env,interactive:f,childKind:g});m.warning&&write(s,`aegis: ${m.warning}`),m.skip&&m.skipFromFlag&&write(s,p.skipReport(m));const w=-1===l?d.args:d.args.filter((e=>e!==(p.SKIP_FLAG||"--dangerously-skip-permissions"))),v=m.skipFromFlag?{AEGISONE_SKIP_PERMISSIONS:"1"}:{},I={AEGIS_INSTALL_METHOD:"npm"};if("1"===(o.env||{}).AEGISONE_PRINT_DECISION&&write(s,"aegis: decision "+JSON.stringify({face:d.face,kind:d.kind,reason:d.reason,args:w,skip:m.skip})),null===d.face)return write(s,`aegis: ${d.error}`),d.hint&&write(s,`aegis: ${d.hint}`),d.code||EXIT_USAGE;d.notice&&write(s,`aegis: ${d.notice} — running the terminal face.`);const S=r.spawnSync||spawnSync,E=r.spawn||spawn,_=Object.assign({},process.env,r.env||{});if(d.face===FACE.TUI){const e=o._cliBin||r.cliBin;return e?statusOf(S(process.execPath,[e,...w],{stdio:"inherit",env:Object.assign({},_,v,I),argv0:"aegiscode"})||{}):(write(s,"aegis: the terminal face is not installed beside aegisone."),write(s,"aegis: reinstall aegisone, or set AEGISONE_CLI_BIN to bin/aegiscode.js."),127)}const k=o._electron||r.electron,y=o._desktopMain||r.desktopMain,O=WIN.plan({decision:d,electron:Boolean(k),target:r.target||o.target});if(!O||!y)return write(s,"aegis: cannot open the window — Electron or the desktop entry point went missing after the check."),write(s,"aegis: Use --tui for the terminal face."),EXIT_USAGE;delete _.ELECTRON_RUN_AS_NODE;const U=WIN.open(O,{main:y,args:w,env:Object.assign({},_,v,I)},{openElectron:e=>E(process.execPath,[e.main,...e.args],{stdio:"inherit",env:e.env,detached:!1})});if(!U||!U.ok)return write(s,`aegis: cannot open the window — ${U&&U.msg||"no usable window plan"}.`),write(s,"aegis: Use --tui for the terminal face."),EXIT_USAGE;const j=U.handle;return new Promise((e=>{j.on("error",(t=>{write(s,`aegis: could not start the window: ${t&&t.message}`),e(1)})),j.on("exit",((t,r)=>e(statusOf({status:t,signal:r}))))}))}function main(e){const t=run(e);return"number"==typeof t?(process.exitCode=t,t):t.then((e=>(process.exitCode=e,e)))}if(module.exports={main:main,run:run,statusOf:statusOf,EXIT_USAGE:EXIT_USAGE,isInstalledLayout:isInstalledLayout,defaultFetchLatest:defaultFetchLatest},require.main===module){const e=main(process.argv.slice(2));e&&"function"==typeof e.then&&e.catch((e=>{write(process.stderr,`aegis: ${e&&e.stack||e}`),process.exitCode=1}))}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aegisone",
|
|
3
3
|
"productName": "AEGISONE",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.55",
|
|
5
5
|
"description": "AEGISONE — one product, two faces. `aegis` opens the window when there is nothing else to do and runs the terminal otherwise; `aegiscode` keeps behaving exactly as it always has.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "AEGIS Code",
|
package/vendor/cli/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aegiscode",
|
|
3
3
|
"productName": "AEGIS Code",
|
|
4
|
-
"version": "7.0.
|
|
4
|
+
"version": "7.0.47",
|
|
5
5
|
"description": "aegiscode — the command-line version of AEGIS One. The shared tool surface in your shell, over the same thin transport and tool registry as the MCP plugin and the desktop app. Ships transport + UI only; no brain.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "AEGIS Code",
|
|
@@ -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 = 'ddcc46761db6f3f1ae5c427cc59aaef440bc4949998dc0dfc7d5cf94296ed5db';
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
140
|
* Ask the question. Never throws — a check that can break the program it is
|
|
@@ -4257,6 +4257,59 @@ function describeRegistryFailure(reason, status, pkg) {
|
|
|
4257
4257
|
}
|
|
4258
4258
|
}
|
|
4259
4259
|
|
|
4260
|
+
/**
|
|
4261
|
+
* Who owns the copy that is actually running.
|
|
4262
|
+
*
|
|
4263
|
+
* WHY THIS IS NOT A CONSTANT
|
|
4264
|
+
*
|
|
4265
|
+
* This manager used to hardcode `PKG = 'aegis-desktop'`. That is correct for a
|
|
4266
|
+
* global `npm i -g aegis-desktop` and WRONG for the product install: `aegis`
|
|
4267
|
+
* launches `<aegisone>/vendor/desktop`, and `npm i -g aegis-desktop@latest`
|
|
4268
|
+
* never touches that path. The banner would announce the standalone package's
|
|
4269
|
+
* newer version and offer a command that installs a second copy beside the one
|
|
4270
|
+
* the user is looking at — the silent no-op the packaged branch already guards
|
|
4271
|
+
* against, one case over — while the `aegisone` update they actually have
|
|
4272
|
+
* pending went unmentioned.
|
|
4273
|
+
*
|
|
4274
|
+
* The tell is the path: a vendored launch lives at `<aegisone>/vendor/desktop`,
|
|
4275
|
+
* so the product manifest is two levels up. Everything else is a standalone
|
|
4276
|
+
* desktop install (global npm, checkout) and keeps naming `aegis-desktop`.
|
|
4277
|
+
*
|
|
4278
|
+
* The version that matters follows the owner. In a vendored launch it is the
|
|
4279
|
+
* PRODUCT's version, not this face's: the faces ship in lockstep inside
|
|
4280
|
+
* `aegisone` (derived from one product number at release time — see
|
|
4281
|
+
* `tools/release-npm.mjs` and `test/one-version.test.mjs`), so comparing the
|
|
4282
|
+
* vendored face against `aegis-desktop@latest` reports "available" for a
|
|
4283
|
+
* product that is already current, and offers a command that cannot satisfy it.
|
|
4284
|
+
*
|
|
4285
|
+
* Pure and injectable (`dir`, `readJson`) so both layouts are testable without
|
|
4286
|
+
* one of them existing on disk.
|
|
4287
|
+
*/
|
|
4288
|
+
function resolveUpdateOwner({
|
|
4289
|
+
dir = __dirname,
|
|
4290
|
+
readJson = (p) => JSON.parse(fs.readFileSync(p, 'utf8')),
|
|
4291
|
+
} = {}) {
|
|
4292
|
+
const marker = `${path.sep}vendor${path.sep}desktop`;
|
|
4293
|
+
const at = String(dir).lastIndexOf(marker);
|
|
4294
|
+
if (at > 0) {
|
|
4295
|
+
const productDir = String(dir).slice(0, at);
|
|
4296
|
+
try {
|
|
4297
|
+
const version = readJson(path.join(productDir, 'package.json')).version;
|
|
4298
|
+
if (version) return { pkg: 'aegisone', current: String(version), productDir };
|
|
4299
|
+
} catch {
|
|
4300
|
+
// No readable product manifest: fall through to the standalone identity
|
|
4301
|
+
// rather than claiming an owner we could not read a version for.
|
|
4302
|
+
}
|
|
4303
|
+
}
|
|
4304
|
+
try {
|
|
4305
|
+
const version = readJson(path.join(dir, 'package.json')).version;
|
|
4306
|
+
if (version) return { pkg: 'aegis-desktop', current: String(version), productDir: null };
|
|
4307
|
+
} catch {
|
|
4308
|
+
/* version is cosmetic here */
|
|
4309
|
+
}
|
|
4310
|
+
return { pkg: 'aegis-desktop', current: 'unknown', productDir: null };
|
|
4311
|
+
}
|
|
4312
|
+
|
|
4260
4313
|
function createNpmUpdateManager({
|
|
4261
4314
|
onStatus,
|
|
4262
4315
|
// A packaged build (AppImage/deb/NSIS/dmg) is NOT the npm copy. `npm i -g`
|
|
@@ -4274,14 +4327,13 @@ function createNpmUpdateManager({
|
|
|
4274
4327
|
// killing the test runner's own process.
|
|
4275
4328
|
runUpgrade,
|
|
4276
4329
|
relaunch,
|
|
4330
|
+
// Injectable so a test can assert both layouts. Defaults to asking the
|
|
4331
|
+
// filesystem which copy this is (see `resolveUpdateOwner`).
|
|
4332
|
+
owner: ownerOverride,
|
|
4277
4333
|
} = {}) {
|
|
4278
|
-
const
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
current = require('./package.json').version;
|
|
4282
|
-
} catch {
|
|
4283
|
-
/* version is cosmetic here */
|
|
4284
|
-
}
|
|
4334
|
+
const owner = ownerOverride || resolveUpdateOwner();
|
|
4335
|
+
const PKG = owner.pkg;
|
|
4336
|
+
let current = owner.current;
|
|
4285
4337
|
// `reason`/`transient`/`attempts`/`retryInMs`/`canDownload` are additive: the
|
|
4286
4338
|
// banner needs them to decide whether a failure deserves the user's
|
|
4287
4339
|
// attention at all, and whether there is a button worth offering.
|
|
@@ -6687,6 +6739,7 @@ module.exports = {
|
|
|
6687
6739
|
isSafeExternalUrl,
|
|
6688
6740
|
createUpdateManager,
|
|
6689
6741
|
createNpmUpdateManager,
|
|
6742
|
+
resolveUpdateOwner,
|
|
6690
6743
|
createUpdateDispatch,
|
|
6691
6744
|
describeRegistryFailure,
|
|
6692
6745
|
UPDATE_RETRY_BACKOFF_MS,
|
|
@@ -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 = 'ddcc46761db6f3f1ae5c427cc59aaef440bc4949998dc0dfc7d5cf94296ed5db';
|
|
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
|
@@ -4257,6 +4257,59 @@ function describeRegistryFailure(reason, status, pkg) {
|
|
|
4257
4257
|
}
|
|
4258
4258
|
}
|
|
4259
4259
|
|
|
4260
|
+
/**
|
|
4261
|
+
* Who owns the copy that is actually running.
|
|
4262
|
+
*
|
|
4263
|
+
* WHY THIS IS NOT A CONSTANT
|
|
4264
|
+
*
|
|
4265
|
+
* This manager used to hardcode `PKG = 'aegis-desktop'`. That is correct for a
|
|
4266
|
+
* global `npm i -g aegis-desktop` and WRONG for the product install: `aegis`
|
|
4267
|
+
* launches `<aegisone>/vendor/desktop`, and `npm i -g aegis-desktop@latest`
|
|
4268
|
+
* never touches that path. The banner would announce the standalone package's
|
|
4269
|
+
* newer version and offer a command that installs a second copy beside the one
|
|
4270
|
+
* the user is looking at — the silent no-op the packaged branch already guards
|
|
4271
|
+
* against, one case over — while the `aegisone` update they actually have
|
|
4272
|
+
* pending went unmentioned.
|
|
4273
|
+
*
|
|
4274
|
+
* The tell is the path: a vendored launch lives at `<aegisone>/vendor/desktop`,
|
|
4275
|
+
* so the product manifest is two levels up. Everything else is a standalone
|
|
4276
|
+
* desktop install (global npm, checkout) and keeps naming `aegis-desktop`.
|
|
4277
|
+
*
|
|
4278
|
+
* The version that matters follows the owner. In a vendored launch it is the
|
|
4279
|
+
* PRODUCT's version, not this face's: the faces ship in lockstep inside
|
|
4280
|
+
* `aegisone` (derived from one product number at release time — see
|
|
4281
|
+
* `tools/release-npm.mjs` and `test/one-version.test.mjs`), so comparing the
|
|
4282
|
+
* vendored face against `aegis-desktop@latest` reports "available" for a
|
|
4283
|
+
* product that is already current, and offers a command that cannot satisfy it.
|
|
4284
|
+
*
|
|
4285
|
+
* Pure and injectable (`dir`, `readJson`) so both layouts are testable without
|
|
4286
|
+
* one of them existing on disk.
|
|
4287
|
+
*/
|
|
4288
|
+
function resolveUpdateOwner({
|
|
4289
|
+
dir = __dirname,
|
|
4290
|
+
readJson = (p) => JSON.parse(fs.readFileSync(p, 'utf8')),
|
|
4291
|
+
} = {}) {
|
|
4292
|
+
const marker = `${path.sep}vendor${path.sep}desktop`;
|
|
4293
|
+
const at = String(dir).lastIndexOf(marker);
|
|
4294
|
+
if (at > 0) {
|
|
4295
|
+
const productDir = String(dir).slice(0, at);
|
|
4296
|
+
try {
|
|
4297
|
+
const version = readJson(path.join(productDir, 'package.json')).version;
|
|
4298
|
+
if (version) return { pkg: 'aegisone', current: String(version), productDir };
|
|
4299
|
+
} catch {
|
|
4300
|
+
// No readable product manifest: fall through to the standalone identity
|
|
4301
|
+
// rather than claiming an owner we could not read a version for.
|
|
4302
|
+
}
|
|
4303
|
+
}
|
|
4304
|
+
try {
|
|
4305
|
+
const version = readJson(path.join(dir, 'package.json')).version;
|
|
4306
|
+
if (version) return { pkg: 'aegis-desktop', current: String(version), productDir: null };
|
|
4307
|
+
} catch {
|
|
4308
|
+
/* version is cosmetic here */
|
|
4309
|
+
}
|
|
4310
|
+
return { pkg: 'aegis-desktop', current: 'unknown', productDir: null };
|
|
4311
|
+
}
|
|
4312
|
+
|
|
4260
4313
|
function createNpmUpdateManager({
|
|
4261
4314
|
onStatus,
|
|
4262
4315
|
// A packaged build (AppImage/deb/NSIS/dmg) is NOT the npm copy. `npm i -g`
|
|
@@ -4274,14 +4327,13 @@ function createNpmUpdateManager({
|
|
|
4274
4327
|
// killing the test runner's own process.
|
|
4275
4328
|
runUpgrade,
|
|
4276
4329
|
relaunch,
|
|
4330
|
+
// Injectable so a test can assert both layouts. Defaults to asking the
|
|
4331
|
+
// filesystem which copy this is (see `resolveUpdateOwner`).
|
|
4332
|
+
owner: ownerOverride,
|
|
4277
4333
|
} = {}) {
|
|
4278
|
-
const
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
current = require('./package.json').version;
|
|
4282
|
-
} catch {
|
|
4283
|
-
/* version is cosmetic here */
|
|
4284
|
-
}
|
|
4334
|
+
const owner = ownerOverride || resolveUpdateOwner();
|
|
4335
|
+
const PKG = owner.pkg;
|
|
4336
|
+
let current = owner.current;
|
|
4285
4337
|
// `reason`/`transient`/`attempts`/`retryInMs`/`canDownload` are additive: the
|
|
4286
4338
|
// banner needs them to decide whether a failure deserves the user's
|
|
4287
4339
|
// attention at all, and whether there is a button worth offering.
|
|
@@ -6687,6 +6739,7 @@ module.exports = {
|
|
|
6687
6739
|
isSafeExternalUrl,
|
|
6688
6740
|
createUpdateManager,
|
|
6689
6741
|
createNpmUpdateManager,
|
|
6742
|
+
resolveUpdateOwner,
|
|
6690
6743
|
createUpdateDispatch,
|
|
6691
6744
|
describeRegistryFailure,
|
|
6692
6745
|
UPDATE_RETRY_BACKOFF_MS,
|
|
@@ -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.47",
|
|
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",
|