@vellumai/cli 0.10.0-dev.202606221405.2fda286 → 0.10.0-dev.202606222007.e9d01e2
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.
|
@@ -189,4 +189,34 @@ describe("parseLockfile", () => {
|
|
|
189
189
|
});
|
|
190
190
|
expect(assistant?.resources).toBeUndefined();
|
|
191
191
|
});
|
|
192
|
+
|
|
193
|
+
test("resolves cloud from legacy remote markers when the field is absent", () => {
|
|
194
|
+
// Pre-`cloud` remote entries encode topology in `project` (gcp) / `sshUser`
|
|
195
|
+
// (custom). The parser resolves these so a cloudless remote entry is never
|
|
196
|
+
// mistaken for a local one downstream; a cloudless entry with no markers
|
|
197
|
+
// stays cloudless (local). The raw markers are not carried through.
|
|
198
|
+
const raw = {
|
|
199
|
+
assistants: [
|
|
200
|
+
{ assistantId: "gcp_1", project: "my-proj", runtimeUrl: "https://a" },
|
|
201
|
+
{ assistantId: "ssh_1", sshUser: "deploy", runtimeUrl: "https://b" },
|
|
202
|
+
{ assistantId: "local_1", runtimeUrl: "http://localhost:7830" },
|
|
203
|
+
],
|
|
204
|
+
activeAssistant: null,
|
|
205
|
+
};
|
|
206
|
+
expect(parseLockfile(raw).assistants).toEqual([
|
|
207
|
+
{ assistantId: "gcp_1", cloud: "gcp", runtimeUrl: "https://a" },
|
|
208
|
+
{ assistantId: "ssh_1", cloud: "custom", runtimeUrl: "https://b" },
|
|
209
|
+
{ assistantId: "local_1", runtimeUrl: "http://localhost:7830" },
|
|
210
|
+
]);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
test("prefers an explicit cloud over legacy remote markers", () => {
|
|
214
|
+
const raw = {
|
|
215
|
+
assistants: [{ assistantId: "a", cloud: "local", project: "stale-proj" }],
|
|
216
|
+
activeAssistant: null,
|
|
217
|
+
};
|
|
218
|
+
expect(parseLockfile(raw).assistants).toEqual([
|
|
219
|
+
{ assistantId: "a", cloud: "local" },
|
|
220
|
+
]);
|
|
221
|
+
});
|
|
192
222
|
});
|
|
@@ -92,7 +92,18 @@ function parseAssistant(value: unknown): LockfileAssistant | null {
|
|
|
92
92
|
|
|
93
93
|
const assistant: LockfileAssistant = { assistantId: value.assistantId };
|
|
94
94
|
if (typeof value.name === "string") assistant.name = value.name;
|
|
95
|
-
|
|
95
|
+
// Normalize `cloud`. A pre-`cloud` remote entry encodes its topology in legacy
|
|
96
|
+
// markers (`project` => "gcp", `sshUser` => "custom") that aren't modeled
|
|
97
|
+
// fields; resolve them here — mirroring the CLI's `resolveCloud` — so a
|
|
98
|
+
// cloudless remote entry isn't indistinguishable from a local one downstream.
|
|
99
|
+
// A cloudless entry with no markers stays cloudless (i.e. local).
|
|
100
|
+
if (typeof value.cloud === "string") {
|
|
101
|
+
assistant.cloud = value.cloud;
|
|
102
|
+
} else if (typeof value.project === "string" && value.project) {
|
|
103
|
+
assistant.cloud = "gcp";
|
|
104
|
+
} else if (typeof value.sshUser === "string" && value.sshUser) {
|
|
105
|
+
assistant.cloud = "custom";
|
|
106
|
+
}
|
|
96
107
|
if (typeof value.runtimeUrl === "string") assistant.runtimeUrl = value.runtimeUrl;
|
|
97
108
|
if (typeof value.species === "string") assistant.species = value.species;
|
|
98
109
|
if (typeof value.hatchedAt === "string") assistant.hatchedAt = value.hatchedAt;
|