@vellumai/cli 0.5.2 → 0.5.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellumai/cli",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "CLI tools for vellum-assistant",
5
5
  "type": "module",
6
6
  "exports": {
@@ -3,6 +3,7 @@ import { join } from "path";
3
3
 
4
4
  import { resolveTargetAssistant } from "../lib/assistant-config.js";
5
5
  import type { AssistantEntry } from "../lib/assistant-config.js";
6
+ import { dockerResourceNames, sleepContainers } from "../lib/docker.js";
6
7
  import { isProcessAlive, stopProcessByPidFile } from "../lib/process";
7
8
 
8
9
  const ACTIVE_CALL_LEASES_FILE = "active-call-leases.json";
@@ -64,9 +65,16 @@ export async function sleep(): Promise<void> {
64
65
  const nameArg = args.find((a) => !a.startsWith("-"));
65
66
  const entry = resolveTargetAssistant(nameArg);
66
67
 
68
+ if (entry.cloud === "docker") {
69
+ const res = dockerResourceNames(entry.assistantId);
70
+ await sleepContainers(res);
71
+ console.log("Docker containers stopped.");
72
+ return;
73
+ }
74
+
67
75
  if (entry.cloud && entry.cloud !== "local") {
68
76
  console.error(
69
- `Error: 'vellum sleep' only works with local assistants. '${entry.assistantId}' is a ${entry.cloud} instance.`,
77
+ `Error: 'vellum sleep' only works with local and docker assistants. '${entry.assistantId}' is a ${entry.cloud} instance.`,
70
78
  );
71
79
  process.exit(1);
72
80
  }
@@ -5,6 +5,7 @@ import {
5
5
  loadLatestAssistant,
6
6
  } from "../lib/assistant-config";
7
7
  import type { AssistantEntry } from "../lib/assistant-config";
8
+ import { dockerResourceNames } from "../lib/docker";
8
9
 
9
10
  const SSH_OPTS = [
10
11
  "-o",
@@ -82,7 +83,16 @@ export async function ssh(): Promise<void> {
82
83
 
83
84
  let child;
84
85
 
85
- if (cloud === "gcp") {
86
+ if (cloud === "docker") {
87
+ const res = dockerResourceNames(entry.assistantId);
88
+ console.log(`🔗 Connecting to ${entry.assistantId} via docker exec...\n`);
89
+
90
+ child = spawn(
91
+ "docker",
92
+ ["exec", "-it", res.assistantContainer, "/bin/sh"],
93
+ { stdio: "inherit" },
94
+ );
95
+ } else if (cloud === "gcp") {
86
96
  const project = entry.project;
87
97
  const zone = entry.zone;
88
98
  if (!project || !zone) {
@@ -2,6 +2,7 @@ import { existsSync, readFileSync, writeFileSync } from "fs";
2
2
  import { join } from "path";
3
3
 
4
4
  import { resolveTargetAssistant } from "../lib/assistant-config.js";
5
+ import { dockerResourceNames, wakeContainers } from "../lib/docker.js";
5
6
  import { isProcessAlive, stopProcessByPidFile } from "../lib/process";
6
7
  import {
7
8
  isAssistantWatchModeAvailable,
@@ -38,9 +39,17 @@ export async function wake(): Promise<void> {
38
39
  const nameArg = args.find((a) => !a.startsWith("-"));
39
40
  const entry = resolveTargetAssistant(nameArg);
40
41
 
42
+ if (entry.cloud === "docker") {
43
+ const res = dockerResourceNames(entry.assistantId);
44
+ await wakeContainers(res);
45
+ console.log("Docker containers started.");
46
+ console.log("Wake complete.");
47
+ return;
48
+ }
49
+
41
50
  if (entry.cloud && entry.cloud !== "local") {
42
51
  console.error(
43
- `Error: 'vellum wake' only works with local assistants. '${entry.assistantId}' is a ${entry.cloud} instance.`,
52
+ `Error: 'vellum wake' only works with local and docker assistants. '${entry.assistantId}' is a ${entry.cloud} instance.`,
44
53
  );
45
54
  process.exit(1);
46
55
  }
package/src/lib/docker.ts CHANGED
@@ -569,6 +569,28 @@ export async function stopContainers(
569
569
  await removeContainer(res.assistantContainer);
570
570
  }
571
571
 
572
+ /** Stop containers without removing them (preserves state for `docker start`). */
573
+ export async function sleepContainers(
574
+ res: ReturnType<typeof dockerResourceNames>,
575
+ ): Promise<void> {
576
+ for (const container of [res.cesContainer, res.gatewayContainer, res.assistantContainer]) {
577
+ try {
578
+ await exec("docker", ["stop", container]);
579
+ } catch {
580
+ // container may not exist or already stopped
581
+ }
582
+ }
583
+ }
584
+
585
+ /** Start existing stopped containers. */
586
+ export async function wakeContainers(
587
+ res: ReturnType<typeof dockerResourceNames>,
588
+ ): Promise<void> {
589
+ for (const container of [res.assistantContainer, res.gatewayContainer, res.cesContainer]) {
590
+ await exec("docker", ["start", container]);
591
+ }
592
+ }
593
+
572
594
  /**
573
595
  * Capture the current image references for running service containers.
574
596
  * Returns a complete record of service → immutable image ID (sha256 digest)