fix(cli): 自动拉起 daemon 走 boot.js(带 BrowserManager),修复 open/list/get 全 not found;daemon 增 visionl-daemon bin + start 指向 boot;docs 同步当前 CLI(无 daemon/page 子命令,Bing 易反爬请用百度等国内源)

This commit is contained in:
AskaEth committed 2026-09-06 11:11:56 +08:00
1 parent 36780493a5
commit c3a7f74b1f
4 files changed
+50 -14

No files matched your search

+4 -1
View File
@@ -3,10 +3,13 @@
"version": "0.1.0",
"private": true,
"main": "./dist/index.js",
"bin": {
"visionl-daemon": "./dist/boot.js"
},
"scripts": {
"typecheck": "tsc -b",
"build": "tsc -b",
"start": "node ./dist/index.js"
"start": "node ./dist/boot.js"
},
"dependencies": {
"@visionl/core": "*",
+27
View File
@@ -0,0 +1,27 @@
import { startServer } from './server.js';
import { BrowserManager } from './browser-manager.js';
/**
* boot is the browser-enabled daemon entry: it initializes a persistent
* BrowserManager (anti-detection Chromium) and starts the HTTP+WS server with
* it. Startup via the CLI must go through this entry so page/content/action
* routes are actually registered (spawning server.js alone skips them).
*/
export async function boot(port: number, profile = 'desktop-chrome') {
const bm = new BrowserManager(profile);
await bm.init();
console.log('[daemon] Browser initialized');
const server = await startServer(port, bm);
console.log('[daemon] Ready on port', port);
return { bm, server };
}
// Direct start when run as a script — the correct browser-enabled daemon entry.
if (process.argv[1] && (process.argv[1].endsWith('boot.js') || process.argv[1].endsWith('boot.ts'))) {
const port = parseInt(process.env.VISIONL_PORT || '9527', 10);
const profile = process.env.VISIONL_PROFILE || 'desktop-chrome';
boot(port, profile).catch((err) => {
console.error('[daemon] Fatal:', err);
process.exit(1);
});
}