@vellumai/cli 0.7.3 → 0.8.1
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/__tests__/orphan-detection.test.ts +287 -0
- package/src/__tests__/ps-platform-status.test.ts +182 -0
- package/src/__tests__/search-provider-env-var-parity.test.ts +48 -0
- package/src/__tests__/sync-events.test.ts +54 -0
- package/src/commands/client.ts +71 -9
- package/src/commands/events.ts +13 -1
- package/src/commands/login.ts +3 -2
- package/src/commands/ps.ts +28 -17
- package/src/components/DefaultMainScreen.tsx +8 -9
- package/src/lib/__tests__/docker.test.ts +11 -0
- package/src/lib/assistant-config.ts +65 -0
- package/src/lib/client-identity.ts +1 -0
- package/src/lib/local.ts +37 -0
- package/src/lib/orphan-detection.ts +66 -1
- package/src/lib/platform-client.ts +8 -7
- package/src/lib/statefulset.ts +12 -0
- package/src/lib/sync-cloud-assistants.ts +16 -9
- package/src/lib/upgrade-lifecycle.ts +9 -73
- package/src/shared/provider-env-vars.ts +12 -8
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
import { getStateDir } from "./environments/paths.js";
|
|
19
19
|
import { getCurrentEnvironment } from "./environments/resolve.js";
|
|
20
20
|
import { loadGuardianToken } from "./guardian-token.js";
|
|
21
|
-
import { getPlatformUrl } from "./platform-client.js";
|
|
22
21
|
import { resolveImageRefs } from "./platform-releases.js";
|
|
23
22
|
import { exec, execOutput } from "./step-runner.js";
|
|
24
23
|
import { compareVersions } from "./version-compat.js";
|
|
@@ -481,42 +480,6 @@ export async function performDockerRollback(
|
|
|
481
480
|
console.log("🔍 Resolving image references...");
|
|
482
481
|
const { imageTags: targetImageTags } = await resolveImageRefs(targetVersion);
|
|
483
482
|
|
|
484
|
-
// Fetch target migration ceiling from releases API
|
|
485
|
-
let targetMigrationCeiling: {
|
|
486
|
-
dbVersion?: number;
|
|
487
|
-
workspaceMigrationId?: string;
|
|
488
|
-
} = {};
|
|
489
|
-
try {
|
|
490
|
-
const platformUrl = getPlatformUrl();
|
|
491
|
-
const releasesResp = await fetch(
|
|
492
|
-
`${platformUrl}/v1/releases/?stable=true`,
|
|
493
|
-
{ signal: AbortSignal.timeout(10000) },
|
|
494
|
-
);
|
|
495
|
-
if (releasesResp.ok) {
|
|
496
|
-
const releases = (await releasesResp.json()) as Array<{
|
|
497
|
-
version: string;
|
|
498
|
-
db_migration_version?: number | null;
|
|
499
|
-
last_workspace_migration_id?: string;
|
|
500
|
-
}>;
|
|
501
|
-
const normalizedTag = targetVersion.replace(/^v/, "");
|
|
502
|
-
const targetRelease = releases.find(
|
|
503
|
-
(r) => r.version?.replace(/^v/, "") === normalizedTag,
|
|
504
|
-
);
|
|
505
|
-
if (
|
|
506
|
-
targetRelease?.db_migration_version != null ||
|
|
507
|
-
targetRelease?.last_workspace_migration_id
|
|
508
|
-
) {
|
|
509
|
-
targetMigrationCeiling = {
|
|
510
|
-
dbVersion: targetRelease.db_migration_version ?? undefined,
|
|
511
|
-
workspaceMigrationId:
|
|
512
|
-
targetRelease.last_workspace_migration_id || undefined,
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
} catch {
|
|
517
|
-
// Best-effort — fall back to rollbackToRegistryCeiling post-swap
|
|
518
|
-
}
|
|
519
|
-
|
|
520
483
|
// Capture current image digests for auto-rollback on failure
|
|
521
484
|
console.log("📸 Capturing current image references for rollback...");
|
|
522
485
|
const currentImageRefs = await captureImageRefs(res);
|
|
@@ -702,26 +665,6 @@ export async function performDockerRollback(
|
|
|
702
665
|
}
|
|
703
666
|
console.log("✅ Docker images pulled\n");
|
|
704
667
|
|
|
705
|
-
// Pre-swap migration rollback to target ceiling on the CURRENT (newer) daemon
|
|
706
|
-
let preSwapRollbackOk = true;
|
|
707
|
-
if (
|
|
708
|
-
targetMigrationCeiling.dbVersion !== undefined ||
|
|
709
|
-
targetMigrationCeiling.workspaceMigrationId !== undefined
|
|
710
|
-
) {
|
|
711
|
-
console.log("🔄 Reverting database changes...");
|
|
712
|
-
await broadcastUpgradeEvent(
|
|
713
|
-
entry.runtimeUrl,
|
|
714
|
-
entry.assistantId,
|
|
715
|
-
buildProgressEvent(UPGRADE_PROGRESS.REVERTING_MIGRATIONS),
|
|
716
|
-
);
|
|
717
|
-
preSwapRollbackOk = await rollbackMigrations(
|
|
718
|
-
entry.runtimeUrl,
|
|
719
|
-
entry.assistantId,
|
|
720
|
-
targetMigrationCeiling.dbVersion,
|
|
721
|
-
targetMigrationCeiling.workspaceMigrationId,
|
|
722
|
-
);
|
|
723
|
-
}
|
|
724
|
-
|
|
725
668
|
// Progress: switching version
|
|
726
669
|
await broadcastUpgradeEvent(
|
|
727
670
|
entry.runtimeUrl,
|
|
@@ -757,22 +700,15 @@ export async function performDockerRollback(
|
|
|
757
700
|
if (ready) {
|
|
758
701
|
// Success path
|
|
759
702
|
|
|
760
|
-
// Post-swap migration rollback
|
|
761
|
-
//
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
entry.runtimeUrl,
|
|
770
|
-
entry.assistantId,
|
|
771
|
-
undefined,
|
|
772
|
-
undefined,
|
|
773
|
-
true,
|
|
774
|
-
);
|
|
775
|
-
}
|
|
703
|
+
// Post-swap migration rollback: ask the now-running old daemon to roll
|
|
704
|
+
// back any migrations above its own registry ceiling.
|
|
705
|
+
await rollbackMigrations(
|
|
706
|
+
entry.runtimeUrl,
|
|
707
|
+
entry.assistantId,
|
|
708
|
+
undefined,
|
|
709
|
+
undefined,
|
|
710
|
+
true,
|
|
711
|
+
);
|
|
776
712
|
|
|
777
713
|
// Capture new digests from the rolled-back containers
|
|
778
714
|
const newDigests = await captureImageRefs(res);
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Provider API key environment variable names, keyed by provider ID.
|
|
3
3
|
*
|
|
4
|
-
* Two sources are merged into a single combined map
|
|
4
|
+
* Two sources are merged into a single combined map. Both are locally-
|
|
5
|
+
* maintained mirrors of canonical catalogs in `assistant/src/providers/`
|
|
6
|
+
* — the CLI does not import from `assistant/src/`, so drift is caught by
|
|
7
|
+
* dedicated parity tests:
|
|
5
8
|
*
|
|
6
|
-
* 1.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* 1. LLM-provider env vars — mirrors `PROVIDER_CATALOG` entries with an
|
|
10
|
+
* `envVar`. Drift guard: `cli/src/__tests__/llm-provider-env-var-parity.test.ts`.
|
|
11
|
+
* 2. Search-provider env vars — mirrors `SEARCH_PROVIDER_CATALOG`
|
|
12
|
+
* entries with an `envVar`. Drift guard:
|
|
13
|
+
* `cli/src/__tests__/search-provider-env-var-parity.test.ts`.
|
|
11
14
|
*
|
|
12
15
|
* The combined map is what cloud-infra code (docker.ts, aws.ts, gcp.ts)
|
|
13
16
|
* iterates to forward provider API keys from the caller's environment into
|
|
@@ -25,10 +28,11 @@ export const LLM_PROVIDER_ENV_VAR_NAMES: Record<string, string> = {
|
|
|
25
28
|
openrouter: "OPENROUTER_API_KEY",
|
|
26
29
|
};
|
|
27
30
|
|
|
28
|
-
/** Search-provider env var names. */
|
|
31
|
+
/** Search-provider env var names. Mirrors `SEARCH_PROVIDER_CATALOG` BYOK entries. */
|
|
29
32
|
export const SEARCH_PROVIDER_ENV_VAR_NAMES: Record<string, string> = {
|
|
30
|
-
brave: "BRAVE_API_KEY",
|
|
31
33
|
perplexity: "PERPLEXITY_API_KEY",
|
|
34
|
+
brave: "BRAVE_API_KEY",
|
|
35
|
+
tavily: "TAVILY_API_KEY",
|
|
32
36
|
};
|
|
33
37
|
|
|
34
38
|
/**
|