@vellumai/cli 0.4.26 → 0.4.30

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.
@@ -3,27 +3,41 @@ import { homedir } from "os";
3
3
  import { join } from "path";
4
4
 
5
5
  import { loadAllAssistants } from "../lib/assistant-config";
6
- import { isProcessAlive } from "../lib/process";
7
- import { startLocalDaemon, startGateway } from "../lib/local";
6
+ import { isProcessAlive, stopProcessByPidFile } from "../lib/process";
7
+ import {
8
+ startLocalDaemon,
9
+ startGateway,
10
+ startOutboundProxy,
11
+ } from "../lib/local";
8
12
 
9
13
  export async function wake(): Promise<void> {
10
14
  const args = process.argv.slice(3);
11
15
  if (args.includes("--help") || args.includes("-h")) {
12
- console.log("Usage: vellum wake");
16
+ console.log("Usage: vellum wake [options]");
13
17
  console.log("");
14
- console.log("Start the daemon and gateway processes.");
18
+ console.log("Start the assistant and gateway processes.");
19
+ console.log("");
20
+ console.log("Options:");
21
+ console.log(
22
+ " --watch Run assistant and gateway in watch mode (hot reload on source changes)",
23
+ );
15
24
  process.exit(0);
16
25
  }
17
26
 
27
+ const watch = args.includes("--watch");
28
+
18
29
  const assistants = loadAllAssistants();
19
30
  const hasLocal = assistants.some((a) => a.cloud === "local");
20
31
  if (!hasLocal) {
21
- console.error("Error: No local assistant found in lock file. Run 'vellum hatch local' first.");
32
+ console.error(
33
+ "Error: No local assistant found in lock file. Run 'vellum hatch local' first.",
34
+ );
22
35
  process.exit(1);
23
36
  }
24
37
 
25
38
  const vellumDir = join(homedir(), ".vellum");
26
39
  const pidFile = join(vellumDir, "vellum.pid");
40
+ const socketFile = join(vellumDir, "vellum.sock");
27
41
 
28
42
  // Check if daemon is already running
29
43
  let daemonRunning = false;
@@ -34,7 +48,16 @@ export async function wake(): Promise<void> {
34
48
  try {
35
49
  process.kill(pid, 0);
36
50
  daemonRunning = true;
37
- console.log(`Daemon already running (pid ${pid}).`);
51
+ if (watch) {
52
+ // Restart in watch mode
53
+ console.log(
54
+ `Assistant running (pid ${pid}) — restarting in watch mode...`,
55
+ );
56
+ await stopProcessByPidFile(pidFile, "assistant", [socketFile]);
57
+ daemonRunning = false;
58
+ } else {
59
+ console.log(`Assistant already running (pid ${pid}).`);
60
+ }
38
61
  } catch {
39
62
  // Process not alive, will start below
40
63
  }
@@ -42,7 +65,7 @@ export async function wake(): Promise<void> {
42
65
  }
43
66
 
44
67
  if (!daemonRunning) {
45
- await startLocalDaemon();
68
+ await startLocalDaemon(watch);
46
69
  }
47
70
 
48
71
  // Start gateway (non-desktop only)
@@ -50,11 +73,32 @@ export async function wake(): Promise<void> {
50
73
  const gatewayPidFile = join(vellumDir, "gateway.pid");
51
74
  const { alive, pid } = isProcessAlive(gatewayPidFile);
52
75
  if (alive) {
53
- console.log(`Gateway already running (pid ${pid}).`);
76
+ if (watch) {
77
+ // Restart in watch mode
78
+ console.log(
79
+ `Gateway running (pid ${pid}) — restarting in watch mode...`,
80
+ );
81
+ await stopProcessByPidFile(gatewayPidFile, "gateway");
82
+ await startGateway(undefined, watch);
83
+ } else {
84
+ console.log(`Gateway already running (pid ${pid}).`);
85
+ }
54
86
  } else {
55
- await startGateway();
87
+ await startGateway(undefined, watch);
56
88
  }
57
89
  }
58
90
 
91
+ // Start outbound proxy
92
+ const outboundProxyPidFile = join(vellumDir, "outbound-proxy.pid");
93
+ const outboundProxyStatus = isProcessAlive(outboundProxyPidFile);
94
+ if (outboundProxyStatus.alive && watch) {
95
+ // Restart in watch mode
96
+ console.log(
97
+ `Outbound proxy running (pid ${outboundProxyStatus.pid}) — restarting in watch mode...`,
98
+ );
99
+ await stopProcessByPidFile(outboundProxyPidFile, "outbound-proxy");
100
+ }
101
+ await startOutboundProxy(watch);
102
+
59
103
  console.log("✅ Wake complete.");
60
104
  }