@vellumai/cli 0.4.56 → 0.4.57

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/src/lib/gcp.ts CHANGED
@@ -646,9 +646,7 @@ export async function hatchGcp(
646
646
  }
647
647
 
648
648
  try {
649
- const tokenData = await leaseGuardianToken(runtimeUrl, instanceName);
650
- gcpEntry.bearerToken = tokenData.accessToken;
651
- saveAssistantEntry(gcpEntry);
649
+ await leaseGuardianToken(runtimeUrl, instanceName);
652
650
  } catch (err) {
653
651
  console.warn(
654
652
  `\u26a0\ufe0f Could not lease guardian token: ${err instanceof Error ? err.message : err}`,
@@ -120,6 +120,23 @@ export function computeDeviceId(): string {
120
120
  return getOrCreatePersistedDeviceId();
121
121
  }
122
122
 
123
+ /**
124
+ * Read a previously persisted guardian token for the given assistant.
125
+ * Returns the parsed token data, or null if the file does not exist or is
126
+ * unreadable.
127
+ */
128
+ export function loadGuardianToken(
129
+ assistantId: string,
130
+ ): GuardianTokenData | null {
131
+ const tokenPath = getGuardianTokenPath(assistantId);
132
+ try {
133
+ const raw = readFileSync(tokenPath, "utf-8");
134
+ return JSON.parse(raw) as GuardianTokenData;
135
+ } catch {
136
+ return null;
137
+ }
138
+ }
139
+
123
140
  export function saveGuardianToken(
124
141
  assistantId: string,
125
142
  data: GuardianTokenData,
@@ -6,7 +6,7 @@ import { existsSync, readFileSync, unlinkSync } from "fs";
6
6
  * command line via `ps`. Prevents killing unrelated processes when a PID file
7
7
  * is stale and the OS has reused the PID.
8
8
  */
9
- function isVellumProcess(pid: number): boolean {
9
+ export function isVellumProcess(pid: number): boolean {
10
10
  try {
11
11
  const output = execFileSync("ps", ["-p", String(pid), "-o", "command="], {
12
12
  encoding: "utf-8",