@lasso-ai/cli 1.3.6 → 1.3.8
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/dist/cli/host/daemon.js
CHANGED
|
@@ -17,6 +17,8 @@ const runtime_1 = require("./runtime");
|
|
|
17
17
|
const dns_1 = require("./dns");
|
|
18
18
|
const paths_1 = require("./paths");
|
|
19
19
|
const certificates_1 = require("./certificates");
|
|
20
|
+
const package_json_1 = __importDefault(require("../../../package.json"));
|
|
21
|
+
const CURRENT_VERSION = package_json_1.default.version;
|
|
20
22
|
exports.SERVICE_NAME = "lasso-host";
|
|
21
23
|
function writeJson(res, status, body) {
|
|
22
24
|
res.writeHead(status, { "content-type": "application/json" });
|
|
@@ -247,7 +249,9 @@ class LassoHost {
|
|
|
247
249
|
writeJson(res, 200, {
|
|
248
250
|
ok: true,
|
|
249
251
|
service: exports.SERVICE_NAME,
|
|
250
|
-
version: this.opts.version ||
|
|
252
|
+
version: this.opts.version || CURRENT_VERSION,
|
|
253
|
+
installedVersion: CURRENT_VERSION,
|
|
254
|
+
versionMismatch: (this.opts.version || CURRENT_VERSION) !== CURRENT_VERSION,
|
|
251
255
|
pid: process.pid,
|
|
252
256
|
dnsPort: this.dnsHandle?.port ?? null,
|
|
253
257
|
proxyPort: this.opts.proxyPort,
|
|
@@ -5,6 +5,7 @@ export declare function spawnDaemon(env: Record<string, string>): Promise<{
|
|
|
5
5
|
alreadyRunning?: boolean;
|
|
6
6
|
pid?: number;
|
|
7
7
|
error?: string;
|
|
8
|
+
restarted?: boolean;
|
|
8
9
|
}>;
|
|
9
10
|
export declare function isAutoStartInstalled(): boolean;
|
|
10
11
|
export declare function enableAutoStart(): Promise<{
|
package/dist/cli/host/install.js
CHANGED
|
@@ -17,9 +17,12 @@ const node_os_1 = __importDefault(require("node:os"));
|
|
|
17
17
|
const node_path_1 = __importDefault(require("node:path"));
|
|
18
18
|
const node_readline_1 = __importDefault(require("node:readline"));
|
|
19
19
|
const node_child_process_1 = require("node:child_process");
|
|
20
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
20
21
|
const client_1 = require("./client");
|
|
21
22
|
const dns_1 = require("./dns");
|
|
22
23
|
const paths_1 = require("./paths");
|
|
24
|
+
const package_json_1 = __importDefault(require("../../../package.json"));
|
|
25
|
+
const CURRENT_VERSION = package_json_1.default.version;
|
|
23
26
|
const AGENT_LABEL = "com.lasso.host";
|
|
24
27
|
const LAUNCH_AGENT_FILE = node_path_1.default.join(node_os_1.default.homedir(), "Library", "LaunchAgents", `${AGENT_LABEL}.plist`);
|
|
25
28
|
function cliEntry() {
|
|
@@ -31,8 +34,18 @@ function spawnDaemon(env) {
|
|
|
31
34
|
const dnsPort = (0, paths_1.hostDnsPort)(env);
|
|
32
35
|
const httpsPort = (0, paths_1.hostHttpsPort)(env);
|
|
33
36
|
return (0, client_1.hostAlive)(port).then(async (health) => {
|
|
34
|
-
if (health)
|
|
35
|
-
|
|
37
|
+
if (health) {
|
|
38
|
+
// Check if the running daemon has a different version
|
|
39
|
+
if (health.version && health.version !== CURRENT_VERSION) {
|
|
40
|
+
console.log(chalk_1.default.yellow(`!`) + ` Lasso Host is running version ${health.version} but installed version is ${CURRENT_VERSION}. Restarting...`);
|
|
41
|
+
await stopDaemon(env);
|
|
42
|
+
// Wait a moment for the daemon to stop
|
|
43
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return { ok: true, alreadyRunning: true };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
36
49
|
const entry = cliEntry();
|
|
37
50
|
if (!entry)
|
|
38
51
|
return { ok: false, error: "Could not resolve the Lasso CLI entry point. Run this from the installed CLI." };
|
|
@@ -46,7 +59,7 @@ function spawnDaemon(env) {
|
|
|
46
59
|
child.unref();
|
|
47
60
|
await new Promise((resolve) => setTimeout(resolve, 1800));
|
|
48
61
|
if (await (0, client_1.hostAlive)(port))
|
|
49
|
-
return { ok: true, pid };
|
|
62
|
+
return { ok: true, pid, restarted: Boolean(health && health.version !== CURRENT_VERSION) };
|
|
50
63
|
return { ok: false, error: `Lasso Host did not come up on port ${port}. Check ${paths_1.LOG_FILE}.` };
|
|
51
64
|
});
|
|
52
65
|
}
|
package/dist/cli/server/next.js
CHANGED
|
@@ -13,10 +13,24 @@ const node_child_process_1 = require("node:child_process");
|
|
|
13
13
|
const PUBLIC_PORT = 3000; // what the user opens in the browser
|
|
14
14
|
const INTERNAL_PORT = 3055; // where the real `next dev` actually runs
|
|
15
15
|
function serveOverlayBundle(res, cwd) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
// Try multiple possible paths for the overlay bundle
|
|
17
|
+
const possiblePaths = [
|
|
18
|
+
(0, node_path_1.resolve)(cwd, "node_modules/@lasso-ai/cli/dist/overlay.js"),
|
|
19
|
+
(0, node_path_1.resolve)(cwd, "node_modules/lasso/dist/overlay.js"),
|
|
20
|
+
(0, node_path_1.resolve)(__dirname, "../../overlay.js"), // When running from Lasso repo
|
|
21
|
+
];
|
|
22
|
+
let bundlePath;
|
|
23
|
+
for (const path of possiblePaths) {
|
|
24
|
+
if ((0, node_fs_1.existsSync)(path)) {
|
|
25
|
+
bundlePath = path;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (!bundlePath) {
|
|
30
|
+
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
31
|
+
res.end("Lasso overlay bundle not found. Make sure @lasso-ai/cli is installed.");
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
20
34
|
res.setHeader("Content-Type", "application/javascript");
|
|
21
35
|
res.end((0, node_fs_1.readFileSync)(bundlePath, "utf-8"));
|
|
22
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lasso-ai/cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"description": "Select any part of your running app, describe a change, and let AI edit the real source code.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "dist/cli/index.js",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"start": "node dist/cli/index.js",
|
|
32
32
|
"prepublishOnly": "npm run build",
|
|
33
33
|
"format": "prettier --write .",
|
|
34
|
+
"deploy": "pnpm build && npm publish --access public",
|
|
34
35
|
"format:check": "prettier --check .",
|
|
35
36
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
36
37
|
},
|