@vellumai/cli 0.4.30 → 0.4.31
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/package.json +1 -1
- package/src/commands/contacts.ts +2 -8
- package/src/commands/hatch.ts +0 -3
- package/src/commands/ps.ts +0 -8
- package/src/commands/retire.ts +0 -4
- package/src/commands/sleep.ts +1 -12
- package/src/commands/wake.ts +1 -17
- package/src/lib/local.ts +3 -152
package/package.json
CHANGED
package/src/commands/contacts.ts
CHANGED
|
@@ -82,10 +82,7 @@ interface ContactChannel {
|
|
|
82
82
|
interface Contact {
|
|
83
83
|
id: string;
|
|
84
84
|
displayName: string;
|
|
85
|
-
|
|
86
|
-
importance: number;
|
|
87
|
-
responseExpectation: string | null;
|
|
88
|
-
preferredTone: string | null;
|
|
85
|
+
notes: string | null;
|
|
89
86
|
lastInteraction: number | null;
|
|
90
87
|
interactionCount: number;
|
|
91
88
|
channels: ContactChannel[];
|
|
@@ -109,10 +106,7 @@ function formatContact(c: Contact): string {
|
|
|
109
106
|
const lines = [
|
|
110
107
|
` ID: ${c.id}`,
|
|
111
108
|
` Name: ${c.displayName}`,
|
|
112
|
-
`
|
|
113
|
-
` Importance: ${c.importance.toFixed(2)}`,
|
|
114
|
-
` Response: ${c.responseExpectation ?? "(none)"}`,
|
|
115
|
-
` Tone: ${c.preferredTone ?? "(none)"}`,
|
|
109
|
+
` Notes: ${c.notes ?? "(none)"}`,
|
|
116
110
|
` Interactions: ${c.interactionCount}`,
|
|
117
111
|
];
|
|
118
112
|
if (c.lastInteraction) {
|
package/src/commands/hatch.ts
CHANGED
|
@@ -39,7 +39,6 @@ import type { PollResult, WatchHatchingResult } from "../lib/gcp";
|
|
|
39
39
|
import {
|
|
40
40
|
startLocalDaemon,
|
|
41
41
|
startGateway,
|
|
42
|
-
startOutboundProxy,
|
|
43
42
|
stopLocalProcesses,
|
|
44
43
|
} from "../lib/local";
|
|
45
44
|
import { probePort } from "../lib/port-probe";
|
|
@@ -757,8 +756,6 @@ async function hatchLocal(
|
|
|
757
756
|
throw error;
|
|
758
757
|
}
|
|
759
758
|
|
|
760
|
-
await startOutboundProxy(watch);
|
|
761
|
-
|
|
762
759
|
// Read the bearer token written by the daemon so the client can authenticate
|
|
763
760
|
// with the gateway (which requires auth by default).
|
|
764
761
|
let bearerToken: string | undefined;
|
package/src/commands/ps.ts
CHANGED
|
@@ -220,8 +220,6 @@ function formatDetectionInfo(proc: DetectedProcess): string {
|
|
|
220
220
|
async function getLocalProcesses(entry: AssistantEntry): Promise<TableRow[]> {
|
|
221
221
|
const vellumDir = entry.baseDataDir ?? join(homedir(), ".vellum");
|
|
222
222
|
|
|
223
|
-
const PROXY_PORT = Number(process.env.PROXY_PORT) || 7829;
|
|
224
|
-
|
|
225
223
|
const specs: ProcessSpec[] = [
|
|
226
224
|
{
|
|
227
225
|
name: "assistant",
|
|
@@ -241,12 +239,6 @@ async function getLocalProcesses(entry: AssistantEntry): Promise<TableRow[]> {
|
|
|
241
239
|
port: GATEWAY_PORT,
|
|
242
240
|
pidFile: join(vellumDir, "gateway.pid"),
|
|
243
241
|
},
|
|
244
|
-
{
|
|
245
|
-
name: "outbound-proxy",
|
|
246
|
-
pgrepName: "outbound-proxy",
|
|
247
|
-
port: PROXY_PORT,
|
|
248
|
-
pidFile: join(vellumDir, "outbound-proxy.pid"),
|
|
249
|
-
},
|
|
250
242
|
{
|
|
251
243
|
name: "embed-worker",
|
|
252
244
|
pgrepName: "embed-worker",
|
package/src/commands/retire.ts
CHANGED
|
@@ -60,10 +60,6 @@ async function retireLocal(name: string, entry: AssistantEntry): Promise<void> {
|
|
|
60
60
|
const gatewayPidFile = join(vellumDir, "gateway.pid");
|
|
61
61
|
await stopProcessByPidFile(gatewayPidFile, "gateway");
|
|
62
62
|
|
|
63
|
-
// Stop outbound proxy via PID file
|
|
64
|
-
const outboundProxyPidFile = join(vellumDir, "outbound-proxy.pid");
|
|
65
|
-
await stopProcessByPidFile(outboundProxyPidFile, "outbound-proxy");
|
|
66
|
-
|
|
67
63
|
// If the PID file didn't track a running daemon, scan for orphaned
|
|
68
64
|
// daemon processes that may have been started without writing a PID.
|
|
69
65
|
if (!daemonStopped) {
|
package/src/commands/sleep.ts
CHANGED
|
@@ -8,7 +8,7 @@ export async function sleep(): Promise<void> {
|
|
|
8
8
|
if (args.includes("--help") || args.includes("-h")) {
|
|
9
9
|
console.log("Usage: vellum sleep");
|
|
10
10
|
console.log("");
|
|
11
|
-
console.log("Stop the assistant
|
|
11
|
+
console.log("Stop the assistant and gateway processes.");
|
|
12
12
|
process.exit(0);
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -16,7 +16,6 @@ export async function sleep(): Promise<void> {
|
|
|
16
16
|
const daemonPidFile = join(vellumDir, "vellum.pid");
|
|
17
17
|
const socketFile = join(vellumDir, "vellum.sock");
|
|
18
18
|
const gatewayPidFile = join(vellumDir, "gateway.pid");
|
|
19
|
-
const outboundProxyPidFile = join(vellumDir, "outbound-proxy.pid");
|
|
20
19
|
|
|
21
20
|
// Stop daemon
|
|
22
21
|
const daemonStopped = await stopProcessByPidFile(daemonPidFile, "daemon", [
|
|
@@ -36,14 +35,4 @@ export async function sleep(): Promise<void> {
|
|
|
36
35
|
console.log("Gateway stopped.");
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
// Stop outbound proxy
|
|
40
|
-
const outboundProxyStopped = await stopProcessByPidFile(
|
|
41
|
-
outboundProxyPidFile,
|
|
42
|
-
"outbound-proxy",
|
|
43
|
-
);
|
|
44
|
-
if (!outboundProxyStopped) {
|
|
45
|
-
console.log("Outbound proxy is not running.");
|
|
46
|
-
} else {
|
|
47
|
-
console.log("Outbound proxy stopped.");
|
|
48
|
-
}
|
|
49
38
|
}
|
package/src/commands/wake.ts
CHANGED
|
@@ -4,11 +4,7 @@ import { join } from "path";
|
|
|
4
4
|
|
|
5
5
|
import { loadAllAssistants } from "../lib/assistant-config";
|
|
6
6
|
import { isProcessAlive, stopProcessByPidFile } from "../lib/process";
|
|
7
|
-
import {
|
|
8
|
-
startLocalDaemon,
|
|
9
|
-
startGateway,
|
|
10
|
-
startOutboundProxy,
|
|
11
|
-
} from "../lib/local";
|
|
7
|
+
import { startLocalDaemon, startGateway } from "../lib/local";
|
|
12
8
|
|
|
13
9
|
export async function wake(): Promise<void> {
|
|
14
10
|
const args = process.argv.slice(3);
|
|
@@ -88,17 +84,5 @@ export async function wake(): Promise<void> {
|
|
|
88
84
|
}
|
|
89
85
|
}
|
|
90
86
|
|
|
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
|
-
|
|
103
87
|
console.log("✅ Wake complete.");
|
|
104
88
|
}
|
package/src/lib/local.ts
CHANGED
|
@@ -79,18 +79,6 @@ function findGatewaySourceFromCwd(): string | undefined {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
function isOutboundProxySourceDir(dir: string): boolean {
|
|
83
|
-
const pkgPath = join(dir, "package.json");
|
|
84
|
-
if (!existsSync(pkgPath) || !existsSync(join(dir, "src", "main.ts")))
|
|
85
|
-
return false;
|
|
86
|
-
try {
|
|
87
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
88
|
-
return pkg.name === "@vellumai/outbound-proxy";
|
|
89
|
-
} catch {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
82
|
function resolveAssistantIndexPath(): string | undefined {
|
|
95
83
|
// Source tree layout: cli/src/lib/ -> ../../.. -> repo root -> assistant/src/index.ts
|
|
96
84
|
const sourceTreeIndex = join(
|
|
@@ -354,21 +342,6 @@ function resolveGatewayDir(): string {
|
|
|
354
342
|
}
|
|
355
343
|
}
|
|
356
344
|
|
|
357
|
-
function resolveOutboundProxyDir(): string | undefined {
|
|
358
|
-
// Compiled binary: outbound-proxy/ bundled adjacent to the CLI executable.
|
|
359
|
-
const binProxy = join(dirname(process.execPath), "outbound-proxy");
|
|
360
|
-
if (isOutboundProxySourceDir(binProxy)) {
|
|
361
|
-
return binProxy;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
try {
|
|
365
|
-
const pkgPath = _require.resolve("@vellumai/outbound-proxy/package.json");
|
|
366
|
-
return dirname(pkgPath);
|
|
367
|
-
} catch {
|
|
368
|
-
return undefined;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
|
|
372
345
|
function normalizeIngressUrl(value: unknown): string | undefined {
|
|
373
346
|
if (typeof value !== "string") return undefined;
|
|
374
347
|
const normalized = value.trim().replace(/\/+$/, "");
|
|
@@ -949,130 +922,10 @@ export async function startGateway(
|
|
|
949
922
|
return gatewayUrl;
|
|
950
923
|
}
|
|
951
924
|
|
|
952
|
-
export async function startOutboundProxy(
|
|
953
|
-
watch: boolean = false,
|
|
954
|
-
): Promise<void> {
|
|
955
|
-
const proxyDir = resolveOutboundProxyDir();
|
|
956
|
-
if (!proxyDir) {
|
|
957
|
-
console.log(" ⚠️ Outbound proxy not found — skipping");
|
|
958
|
-
return;
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
console.log("🔒 Starting outbound proxy...");
|
|
962
|
-
|
|
963
|
-
const vellumDir = join(homedir(), ".vellum");
|
|
964
|
-
mkdirSync(vellumDir, { recursive: true });
|
|
965
|
-
|
|
966
|
-
const pidFile = join(vellumDir, "outbound-proxy.pid");
|
|
967
|
-
|
|
968
|
-
// Check if already running
|
|
969
|
-
if (existsSync(pidFile)) {
|
|
970
|
-
try {
|
|
971
|
-
const pid = parseInt(readFileSync(pidFile, "utf-8").trim(), 10);
|
|
972
|
-
if (!isNaN(pid)) {
|
|
973
|
-
try {
|
|
974
|
-
process.kill(pid, 0);
|
|
975
|
-
console.log(` Outbound proxy already running (pid ${pid})\n`);
|
|
976
|
-
return;
|
|
977
|
-
} catch {
|
|
978
|
-
try {
|
|
979
|
-
unlinkSync(pidFile);
|
|
980
|
-
} catch {}
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
} catch {}
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
const proxyEnv: Record<string, string> = {
|
|
987
|
-
...(process.env as Record<string, string>),
|
|
988
|
-
PROXY_PORT: process.env.PROXY_PORT || "7829",
|
|
989
|
-
PROXY_HEALTH_PORT: process.env.PROXY_HEALTH_PORT || "7828",
|
|
990
|
-
};
|
|
991
|
-
|
|
992
|
-
const proxyLogFd = openLogFile("hatch.log");
|
|
993
|
-
|
|
994
|
-
let proxy;
|
|
995
|
-
if (process.env.VELLUM_DESKTOP_APP && !watch) {
|
|
996
|
-
const proxyBinary = join(
|
|
997
|
-
dirname(process.execPath),
|
|
998
|
-
"vellum-outbound-proxy",
|
|
999
|
-
);
|
|
1000
|
-
if (!existsSync(proxyBinary)) {
|
|
1001
|
-
console.log(
|
|
1002
|
-
" ⚠️ Outbound proxy binary not found — falling back to source",
|
|
1003
|
-
);
|
|
1004
|
-
const bunArgs = watch
|
|
1005
|
-
? ["--watch", "run", "src/main.ts"]
|
|
1006
|
-
: ["run", "src/main.ts"];
|
|
1007
|
-
proxy = spawn("bun", bunArgs, {
|
|
1008
|
-
cwd: proxyDir,
|
|
1009
|
-
detached: true,
|
|
1010
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
1011
|
-
env: proxyEnv,
|
|
1012
|
-
});
|
|
1013
|
-
} else {
|
|
1014
|
-
proxy = spawn(proxyBinary, [], {
|
|
1015
|
-
detached: true,
|
|
1016
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
1017
|
-
env: proxyEnv,
|
|
1018
|
-
});
|
|
1019
|
-
}
|
|
1020
|
-
} else {
|
|
1021
|
-
const bunArgs = watch
|
|
1022
|
-
? ["--watch", "run", "src/main.ts"]
|
|
1023
|
-
: ["run", "src/main.ts"];
|
|
1024
|
-
proxy = spawn("bun", bunArgs, {
|
|
1025
|
-
cwd: proxyDir,
|
|
1026
|
-
detached: true,
|
|
1027
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
1028
|
-
env: proxyEnv,
|
|
1029
|
-
});
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
pipeToLogFile(proxy, proxyLogFd, "outbound-proxy");
|
|
1033
|
-
proxy.unref();
|
|
1034
|
-
|
|
1035
|
-
if (proxy.pid) {
|
|
1036
|
-
writeFileSync(pidFile, String(proxy.pid), "utf-8");
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
if (watch) {
|
|
1040
|
-
console.log(" Outbound proxy started in watch mode (bun --watch)");
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
// Wait for the health endpoint to respond
|
|
1044
|
-
const healthPort = Number(process.env.PROXY_HEALTH_PORT) || 7828;
|
|
1045
|
-
const start = Date.now();
|
|
1046
|
-
const timeoutMs = 15000;
|
|
1047
|
-
let ready = false;
|
|
1048
|
-
while (Date.now() - start < timeoutMs) {
|
|
1049
|
-
try {
|
|
1050
|
-
const res = await fetch(`http://localhost:${healthPort}/healthz`, {
|
|
1051
|
-
signal: AbortSignal.timeout(2000),
|
|
1052
|
-
});
|
|
1053
|
-
if (res.ok) {
|
|
1054
|
-
ready = true;
|
|
1055
|
-
break;
|
|
1056
|
-
}
|
|
1057
|
-
} catch {
|
|
1058
|
-
// Not ready yet
|
|
1059
|
-
}
|
|
1060
|
-
await new Promise((r) => setTimeout(r, 250));
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
if (!ready) {
|
|
1064
|
-
console.warn(
|
|
1065
|
-
" ⚠️ Outbound proxy started but health check did not respond within 15s",
|
|
1066
|
-
);
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
console.log("✅ Outbound proxy started\n");
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
925
|
/**
|
|
1073
|
-
* Stop any locally-running daemon
|
|
1074
|
-
*
|
|
1075
|
-
*
|
|
926
|
+
* Stop any locally-running daemon and gateway processes and clean up
|
|
927
|
+
* PID/socket files. Called when hatch fails partway through so we don't
|
|
928
|
+
* leave orphaned processes with no lock file entry.
|
|
1076
929
|
*/
|
|
1077
930
|
export async function stopLocalProcesses(): Promise<void> {
|
|
1078
931
|
const vellumDir = join(homedir(), ".vellum");
|
|
@@ -1083,6 +936,4 @@ export async function stopLocalProcesses(): Promise<void> {
|
|
|
1083
936
|
const gatewayPidFile = join(vellumDir, "gateway.pid");
|
|
1084
937
|
await stopProcessByPidFile(gatewayPidFile, "gateway");
|
|
1085
938
|
|
|
1086
|
-
const outboundProxyPidFile = join(vellumDir, "outbound-proxy.pid");
|
|
1087
|
-
await stopProcessByPidFile(outboundProxyPidFile, "outbound-proxy");
|
|
1088
939
|
}
|