zor-ai 1.0.43 → 1.0.44
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/install.js +30 -0
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -224,6 +224,16 @@ function getRuntimeGuidelinesDir(platform, env) {
|
|
|
224
224
|
return pathModule.join(getRuntimeZoraiRoot(platform, env), "guidelines");
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
+
function getBundledPluginsDir(platform, env) {
|
|
228
|
+
var sourceEnv = env || process.env;
|
|
229
|
+
if (sourceEnv.ZORAI_BUNDLED_PLUGINS_DIR) {
|
|
230
|
+
return sourceEnv.ZORAI_BUNDLED_PLUGINS_DIR;
|
|
231
|
+
}
|
|
232
|
+
var pathModule = platform === "win32" ? path.win32 : path.posix;
|
|
233
|
+
var home = platform === "win32" ? sourceEnv.USERPROFILE || sourceEnv.HOME || "" : sourceEnv.HOME || "";
|
|
234
|
+
return pathModule.join(home, ".zorai", "bundled-plugins");
|
|
235
|
+
}
|
|
236
|
+
|
|
227
237
|
function getRuntimeCustomAuthPath(platform, env) {
|
|
228
238
|
var pathModule = platform === "win32" ? path.win32 : path.posix;
|
|
229
239
|
return pathModule.join(getRuntimeZoraiRoot(platform, env), "custom-auth.yaml");
|
|
@@ -278,6 +288,7 @@ function getReleaseAssetInfo(platform, arch, version) {
|
|
|
278
288
|
requiredAssets: target.requiredAssets.slice(),
|
|
279
289
|
skillsArchiveRoot: "skills",
|
|
280
290
|
guidelinesArchiveRoot: "guidelines",
|
|
291
|
+
pluginsArchiveRoot: "plugins",
|
|
281
292
|
};
|
|
282
293
|
}
|
|
283
294
|
|
|
@@ -539,6 +550,20 @@ function extractBundledGuidelines(archiveData, releaseInfo, guidelinesDir) {
|
|
|
539
550
|
extractBundledTree(archiveData, releaseInfo.guidelinesArchiveRoot, guidelinesDir, true);
|
|
540
551
|
}
|
|
541
552
|
|
|
553
|
+
function stageBundledPlugins(archiveData, releaseInfo, bundledPluginsDir) {
|
|
554
|
+
var AdmZip = require("adm-zip");
|
|
555
|
+
var root = releaseInfo.pluginsArchiveRoot + "/";
|
|
556
|
+
var hasPlugins = new AdmZip(archiveData).getEntries().some(function (entry) {
|
|
557
|
+
return entry.entryName.startsWith(root) && !entry.isDirectory;
|
|
558
|
+
});
|
|
559
|
+
if (!hasPlugins) {
|
|
560
|
+
return false;
|
|
561
|
+
}
|
|
562
|
+
fs.rmSync(bundledPluginsDir, { recursive: true, force: true });
|
|
563
|
+
extractBundledTree(archiveData, releaseInfo.pluginsArchiveRoot, bundledPluginsDir, false);
|
|
564
|
+
return true;
|
|
565
|
+
}
|
|
566
|
+
|
|
542
567
|
function installMacosDesktopApp(platform, binDir, deps) {
|
|
543
568
|
if (platform !== "darwin") {
|
|
544
569
|
return;
|
|
@@ -692,6 +717,9 @@ async function main() {
|
|
|
692
717
|
installMacosDesktopApp(os.platform(), BIN_DIR);
|
|
693
718
|
extractBundledSkills(archiveData, releaseInfo, runtimeSkillsDir);
|
|
694
719
|
extractBundledGuidelines(archiveData, releaseInfo, runtimeGuidelinesDir);
|
|
720
|
+
if (stageBundledPlugins(archiveData, releaseInfo, getBundledPluginsDir(os.platform(), process.env))) {
|
|
721
|
+
console.log("zorai: staged bundled plugins; new ones are installed disabled on the next start");
|
|
722
|
+
}
|
|
695
723
|
console.log(
|
|
696
724
|
"zorai: custom provider template ready at " +
|
|
697
725
|
ensureCustomAuthTemplate(os.platform(), process.env)
|
|
@@ -738,6 +766,8 @@ module.exports.getRuntimeCustomAuthPath = getRuntimeCustomAuthPath;
|
|
|
738
766
|
module.exports.getRuntimeZoraiRoot = getRuntimeZoraiRoot;
|
|
739
767
|
module.exports.ensureCustomAuthTemplate = ensureCustomAuthTemplate;
|
|
740
768
|
module.exports.extractBundledGuidelines = extractBundledGuidelines;
|
|
769
|
+
module.exports.stageBundledPlugins = stageBundledPlugins;
|
|
770
|
+
module.exports.getBundledPluginsDir = getBundledPluginsDir;
|
|
741
771
|
module.exports.getLegacyTamuxRoot = getLegacyTamuxRoot;
|
|
742
772
|
module.exports.installMacosDesktopApp = installMacosDesktopApp;
|
|
743
773
|
module.exports.migrateLegacyTamuxRoot = migrateLegacyTamuxRoot;
|