@hybridlabor-api/aos 4.6.1 → 4.6.2
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/installer.js +95 -5
- package/package.json +1 -1
package/installer.js
CHANGED
|
@@ -2002,8 +2002,27 @@ async function installOpenWikiVisualizer() {
|
|
|
2002
2002
|
return;
|
|
2003
2003
|
}
|
|
2004
2004
|
if (!hasExecutable('openwiki')) {
|
|
2005
|
-
|
|
2006
|
-
|
|
2005
|
+
// Fresh machines always land here -- skipping leaves :4321 dead with
|
|
2006
|
+
// only a warn line. Offer the global install instead.
|
|
2007
|
+
let installCli = isAutoYes;
|
|
2008
|
+
if (!isAutoYes) {
|
|
2009
|
+
const answer = await askConfirm({
|
|
2010
|
+
message: 'OpenWiki CLI not found. Install it globally (npm install -g openwiki@latest) so the :4321 visualizer daemon can run?',
|
|
2011
|
+
initialValue: true,
|
|
2012
|
+
});
|
|
2013
|
+
installCli = !isCancel(answer) && !!answer;
|
|
2014
|
+
}
|
|
2015
|
+
if (installCli) {
|
|
2016
|
+
try {
|
|
2017
|
+
log.step('Installing OpenWiki CLI globally (npm install -g openwiki@latest)...');
|
|
2018
|
+
execSync('npm install -g openwiki@latest', { stdio: 'ignore' });
|
|
2019
|
+
} catch (e) { logDebug(e, 'openwiki cli install'); }
|
|
2020
|
+
}
|
|
2021
|
+
if (!hasExecutable('openwiki')) {
|
|
2022
|
+
log.warn('Skipping OpenWiki Visualizer setup: the openwiki CLI is not on PATH. Install it with: npm install -g openwiki@latest');
|
|
2023
|
+
return;
|
|
2024
|
+
}
|
|
2025
|
+
log.ok('OpenWiki CLI installed.');
|
|
2007
2026
|
}
|
|
2008
2027
|
// launchd starts agents with a minimal PATH that never includes npm's global
|
|
2009
2028
|
// bin dir, so resolve the absolute binary path now instead of relying on PATH at boot.
|
|
@@ -2013,6 +2032,79 @@ async function installOpenWikiVisualizer() {
|
|
|
2013
2032
|
openwikiBin = execSync(lookup, { encoding: 'utf8' }).split(/\r?\n/)[0].trim() || 'openwiki';
|
|
2014
2033
|
} catch (e) { logDebug(e, 'openwiki path lookup'); }
|
|
2015
2034
|
|
|
2035
|
+
// The openwiki CLI is a Node script (#!/usr/bin/env node shebang). Under
|
|
2036
|
+
// launchd's minimal PATH there is no node either, so the agent died with
|
|
2037
|
+
// "env: node: No such file or directory" (exit 127) on every boot until
|
|
2038
|
+
// the interpreter itself is baked in as an absolute path.
|
|
2039
|
+
let nodeBin = 'node';
|
|
2040
|
+
try {
|
|
2041
|
+
const lookup = process.platform === 'win32' ? 'where node' : 'command -v node';
|
|
2042
|
+
nodeBin = execSync(lookup, { encoding: 'utf8' }).split(/\r?\n/)[0].trim() || 'node';
|
|
2043
|
+
} catch (e) { logDebug(e, 'node path lookup'); }
|
|
2044
|
+
|
|
2045
|
+
// Which wiki :4321 serves is per-machine setup configuration, not a
|
|
2046
|
+
// hardcoded path: every computer tracks different projects, and bare
|
|
2047
|
+
// `openwiki visualize` only serves ~/openwiki, which never exists (the
|
|
2048
|
+
// agent then exits 1 with "Wiki directory not found"). The choice is
|
|
2049
|
+
// persisted in ~/.openwiki/visualizer.json so Quick Update reuses it
|
|
2050
|
+
// without asking again; the bundled ecosystem aggregate is only the
|
|
2051
|
+
// first-run default.
|
|
2052
|
+
const visualizerConfigPath = path.join(homeDir, '.openwiki', 'visualizer.json');
|
|
2053
|
+
const looksLikeWiki = (dir) => fs.existsSync(path.join(dir, 'index.md'))
|
|
2054
|
+
|| fs.existsSync(path.join(dir, 'openwiki'))
|
|
2055
|
+
|| fs.existsSync(path.join(dir, '.openwiki'));
|
|
2056
|
+
const readVisualizerConfig = () => {
|
|
2057
|
+
try {
|
|
2058
|
+
const raw = JSON.parse(fs.readFileSync(visualizerConfigPath, 'utf8'));
|
|
2059
|
+
if (raw && typeof raw.wikiPath === 'string' && fs.existsSync(raw.wikiPath)) return raw.wikiPath;
|
|
2060
|
+
} catch (e) { logDebug(e, 'visualizer config read'); }
|
|
2061
|
+
return null;
|
|
2062
|
+
};
|
|
2063
|
+
const writeVisualizerConfig = (wikiPath) => {
|
|
2064
|
+
try {
|
|
2065
|
+
fs.mkdirSync(path.dirname(visualizerConfigPath), { recursive: true });
|
|
2066
|
+
fs.writeFileSync(visualizerConfigPath, JSON.stringify({ wikiPath, updatedAt: new Date().toISOString() }, null, 2));
|
|
2067
|
+
} catch (e) { logDebug(e, 'visualizer config write'); }
|
|
2068
|
+
};
|
|
2069
|
+
let wikiPath = readVisualizerConfig();
|
|
2070
|
+
const ecosystemWiki = path.join(homeDir, '.openwiki', 'ecosystem-wiki');
|
|
2071
|
+
const syncScript = path.join(srcDir, 'skills', 'global_config', 'openwiki-skill', 'scripts', 'sync_ecosystem_wiki.py');
|
|
2072
|
+
if (!wikiPath) {
|
|
2073
|
+
if (looksLikeWiki(ecosystemWiki)) {
|
|
2074
|
+
wikiPath = ecosystemWiki;
|
|
2075
|
+
} else if (fs.existsSync(syncScript) && hasExecutable('python3')) {
|
|
2076
|
+
try {
|
|
2077
|
+
execSync(`python3 "${syncScript}"`, { stdio: 'ignore' });
|
|
2078
|
+
if (looksLikeWiki(ecosystemWiki)) wikiPath = ecosystemWiki;
|
|
2079
|
+
} catch (e) { logDebug(e, 'ecosystem wiki sync'); }
|
|
2080
|
+
}
|
|
2081
|
+
if (!wikiPath && !isAutoYes) {
|
|
2082
|
+
const answer = await text({
|
|
2083
|
+
message: `Which wiki should the :4321 visualizer serve? (directory) [default: ${ecosystemWiki}]`,
|
|
2084
|
+
placeholder: ecosystemWiki,
|
|
2085
|
+
});
|
|
2086
|
+
if (!isCancel(answer) && answer && answer.trim()) {
|
|
2087
|
+
const candidate = answer.trim().replace(/^~(?=$|\/|\\)/, homeDir);
|
|
2088
|
+
if (fs.existsSync(candidate) && fs.statSync(candidate).isDirectory()) {
|
|
2089
|
+
wikiPath = candidate;
|
|
2090
|
+
if (!looksLikeWiki(candidate)) {
|
|
2091
|
+
log.warn(`No wiki markers found in ${candidate} — the daemon may exit until a wiki is generated there.`);
|
|
2092
|
+
}
|
|
2093
|
+
} else {
|
|
2094
|
+
log.warn(`Directory not found: ${candidate} — continuing without a visualizer path.`);
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
if (wikiPath) {
|
|
2100
|
+
writeVisualizerConfig(wikiPath);
|
|
2101
|
+
} else {
|
|
2102
|
+
log.warn('OpenWiki Visualizer: no servable wiki configured — registering without a path, the daemon will exit until a wiki exists.');
|
|
2103
|
+
}
|
|
2104
|
+
const visualizeArgs = wikiPath
|
|
2105
|
+
? `<string>${nodeBin}</string>\n <string>${openwikiBin}</string>\n <string>visualize</string>\n <string>${wikiPath}</string>\n <string>--port</string>`
|
|
2106
|
+
: `<string>${nodeBin}</string>\n <string>${openwikiBin}</string>\n <string>visualize</string>\n <string>--port</string>`;
|
|
2107
|
+
|
|
2016
2108
|
if (process.platform === 'darwin') {
|
|
2017
2109
|
const plistPath = path.join(homeDir, 'Library', 'LaunchAgents', 'com.bdb.openwiki-visualize.plist');
|
|
2018
2110
|
const plistContent = `<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -2023,9 +2115,7 @@ async function installOpenWikiVisualizer() {
|
|
|
2023
2115
|
<string>com.bdb.openwiki-visualize</string>
|
|
2024
2116
|
<key>ProgramArguments</key>
|
|
2025
2117
|
<array>
|
|
2026
|
-
|
|
2027
|
-
<string>visualize</string>
|
|
2028
|
-
<string>--port</string>
|
|
2118
|
+
${visualizeArgs}
|
|
2029
2119
|
<string>4321</string>
|
|
2030
2120
|
<string>--no-open</string>
|
|
2031
2121
|
</array>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hybridlabor-api/aos",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.2",
|
|
4
4
|
"description": "AOS — A Curated AI AGENT OS. Optimized agent skills and add-ons like memB, OpenWiki, Heimdall Token Saver, and Godmode architectures.",
|
|
5
5
|
"main": "installer.js",
|
|
6
6
|
"engines": {
|