@vellumai/assistant 0.10.3-dev.202606252237.df0fc92 → 0.10.3-dev.202606252335.0b45a57

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/assistant",
3
- "version": "0.10.3-dev.202606252237.df0fc92",
3
+ "version": "0.10.3-dev.202606252335.0b45a57",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1426,9 +1426,156 @@ describe("seedInferenceProfiles BYOK-mode managed profile labels", () => {
1426
1426
 
1427
1427
  expect(config.llm.profiles.balanced?.status).toBe("disabled");
1428
1428
  expect(config.llm.profiles["quality-optimized"]?.status).toBe("disabled");
1429
+ expect(config.llm.profiles.frontier?.status).toBe("disabled");
1429
1430
  expect(config.llm.profiles["cost-optimized"]?.status).toBe("disabled");
1430
1431
  });
1431
1432
 
1433
+ test("off-platform BYOK hatch defaults advisor to the personal quality profile", () => {
1434
+ const overlayPath = join(WORKSPACE_DIR, "hatch-overlay.json");
1435
+ writeFileSync(
1436
+ overlayPath,
1437
+ JSON.stringify({ llm: { default: { provider: "anthropic" } } }, null, 2) +
1438
+ "\n",
1439
+ );
1440
+ process.env.VELLUM_DEFAULT_WORKSPACE_CONFIG_PATH = overlayPath;
1441
+
1442
+ mergeDefaultConfigAndSeedInferenceProfiles();
1443
+ const config = loadConfig();
1444
+
1445
+ expect(config.llm.activeProfile).toBe("custom-balanced");
1446
+ expect(config.llm.advisorProfile).toBe("custom-quality-optimized");
1447
+ expect(config.llm.profiles["custom-quality-optimized"]?.provider).toBe(
1448
+ "anthropic",
1449
+ );
1450
+ expect(
1451
+ config.llm.profiles["custom-quality-optimized"]?.provider_connection,
1452
+ ).toBe("anthropic-personal");
1453
+ expect(config.llm.profiles.frontier?.status).toBe("disabled");
1454
+ });
1455
+
1456
+ test("off-platform boot repairs a disabled managed advisor to a personal profile when no active managed replacement exists", () => {
1457
+ writeConfig({
1458
+ llm: {
1459
+ advisorProfile: "frontier",
1460
+ profiles: {
1461
+ frontier: {
1462
+ source: "managed",
1463
+ provider: "anthropic",
1464
+ provider_connection: "anthropic-managed",
1465
+ model: "claude-opus-4-8",
1466
+ status: "disabled",
1467
+ },
1468
+ balanced: {
1469
+ source: "managed",
1470
+ provider: "together",
1471
+ provider_connection: "together-managed",
1472
+ model: "open-model",
1473
+ status: "disabled",
1474
+ },
1475
+ "quality-optimized": {
1476
+ source: "managed",
1477
+ provider: "fireworks",
1478
+ provider_connection: "fireworks-managed",
1479
+ model: "accounts/fireworks/models/glm-5p2",
1480
+ status: "disabled",
1481
+ },
1482
+ "cost-optimized": {
1483
+ source: "managed",
1484
+ provider: "fireworks",
1485
+ provider_connection: "fireworks-managed",
1486
+ model: "accounts/fireworks/models/deepseek-v4-flash",
1487
+ status: "disabled",
1488
+ },
1489
+ "custom-quality-optimized": {
1490
+ source: "user",
1491
+ provider: "anthropic",
1492
+ provider_connection: "anthropic-personal",
1493
+ model: "claude-opus-4-8",
1494
+ label: "Quality",
1495
+ },
1496
+ },
1497
+ },
1498
+ });
1499
+
1500
+ mergeDefaultConfigAndSeedInferenceProfiles();
1501
+ const config = loadConfig();
1502
+
1503
+ expect(config.llm.advisorProfile).toBe("custom-quality-optimized");
1504
+ });
1505
+
1506
+ test("platform boot repairs a disabled managed advisor to an active managed profile", () => {
1507
+ process.env.IS_PLATFORM = "true";
1508
+ writeConfig({
1509
+ llm: {
1510
+ advisorProfile: "frontier",
1511
+ profiles: {
1512
+ frontier: {
1513
+ source: "managed",
1514
+ provider: "anthropic",
1515
+ provider_connection: "anthropic-managed",
1516
+ model: "claude-opus-4-8",
1517
+ status: "disabled",
1518
+ },
1519
+ "custom-quality-optimized": {
1520
+ source: "user",
1521
+ provider: "anthropic",
1522
+ provider_connection: "anthropic-personal",
1523
+ model: "claude-opus-4-8",
1524
+ label: "Quality",
1525
+ },
1526
+ },
1527
+ },
1528
+ });
1529
+
1530
+ mergeDefaultConfigAndSeedInferenceProfiles();
1531
+ const config = loadConfig();
1532
+
1533
+ expect(config.llm.advisorProfile).toBe("quality-optimized");
1534
+ });
1535
+
1536
+ test("off-platform boot clears a disabled managed advisor when no active replacement exists", () => {
1537
+ writeConfig({
1538
+ llm: {
1539
+ advisorProfile: "frontier",
1540
+ profiles: {
1541
+ frontier: {
1542
+ source: "managed",
1543
+ provider: "anthropic",
1544
+ provider_connection: "anthropic-managed",
1545
+ model: "claude-opus-4-8",
1546
+ status: "disabled",
1547
+ },
1548
+ balanced: {
1549
+ source: "managed",
1550
+ provider: "together",
1551
+ provider_connection: "together-managed",
1552
+ model: "open-model",
1553
+ status: "disabled",
1554
+ },
1555
+ "quality-optimized": {
1556
+ source: "managed",
1557
+ provider: "fireworks",
1558
+ provider_connection: "fireworks-managed",
1559
+ model: "accounts/fireworks/models/glm-5p2",
1560
+ status: "disabled",
1561
+ },
1562
+ "cost-optimized": {
1563
+ source: "managed",
1564
+ provider: "fireworks",
1565
+ provider_connection: "fireworks-managed",
1566
+ model: "accounts/fireworks/models/deepseek-v4-flash",
1567
+ status: "disabled",
1568
+ },
1569
+ },
1570
+ },
1571
+ });
1572
+
1573
+ mergeDefaultConfigAndSeedInferenceProfiles();
1574
+ const config = loadConfig();
1575
+
1576
+ expect(config.llm.advisorProfile).toBeUndefined();
1577
+ });
1578
+
1432
1579
  test("off-platform managed-inference hatch keeps selected managed connection active", () => {
1433
1580
  const overlayPath = join(WORKSPACE_DIR, "hatch-overlay.json");
1434
1581
  writeFileSync(
@@ -1451,6 +1598,7 @@ describe("seedInferenceProfiles BYOK-mode managed profile labels", () => {
1451
1598
  const raw = JSON.parse(readFileSync(CONFIG_PATH, "utf-8"));
1452
1599
 
1453
1600
  expect(raw.llm.activeProfile).toBe("balanced");
1601
+ expect(raw.llm.advisorProfile).toBe("balanced");
1454
1602
  expect(raw.llm.profiles.balanced.provider_connection).toBe(
1455
1603
  "together-managed",
1456
1604
  );
@@ -426,19 +426,32 @@ export function seedInferenceProfiles(
426
426
  }
427
427
  }
428
428
 
429
- // Advisor profile: default to the strongest managed profile when unset, so
430
- // the advisor consults `frontier` (Anthropic Opus) out of the box, falling
431
- // back to `quality-optimized` if `frontier` is unavailable. The `frontier`
432
- // arm requires managed ownership: the seed loop above leaves a user-owned
433
- // profile named `frontier` in place, and pointing the advisor at that would
434
- // consult an arbitrary user model. Guarded on existence so it never names a
435
- // missing profile (superRefine rejects that); off-platform/BYOK installs can
436
- // repoint it at one of their own profiles.
437
- if (readString(llm.advisorProfile) === undefined) {
438
- if (readObject(profiles["frontier"])?.source === "managed") {
439
- llm.advisorProfile = "frontier";
440
- } else if (readObject(profiles["quality-optimized"]) !== null) {
441
- llm.advisorProfile = "quality-optimized";
429
+ // Advisor profile: BYOK hatches default to the strongest personal profile
430
+ // backed by the entered provider key. Managed-profile hatches and registered
431
+ // platform installs default to the strongest active managed profile.
432
+ const requestedAdvisorProfile = readString(llm.advisorProfile);
433
+ const requestedAdvisorEntry =
434
+ requestedAdvisorProfile !== undefined
435
+ ? readObject(profiles[requestedAdvisorProfile])
436
+ : null;
437
+ const requestedAdvisorIsDisabledManaged =
438
+ requestedAdvisorEntry?.source === "managed" &&
439
+ requestedAdvisorEntry.status === "disabled";
440
+ const preferPersonalAdvisor =
441
+ userConnectionName !== undefined &&
442
+ hatchSelectedManagedConnection === undefined;
443
+ if (
444
+ requestedAdvisorProfile === undefined ||
445
+ requestedAdvisorIsDisabledManaged
446
+ ) {
447
+ const defaultAdvisorProfile = selectDefaultAdvisorProfile(
448
+ profiles,
449
+ preferPersonalAdvisor,
450
+ );
451
+ if (defaultAdvisorProfile) {
452
+ llm.advisorProfile = defaultAdvisorProfile;
453
+ } else if (requestedAdvisorIsDisabledManaged) {
454
+ delete llm.advisorProfile;
442
455
  }
443
456
  }
444
457
 
@@ -578,6 +591,48 @@ function readString(value: unknown): string | undefined {
578
591
  return typeof value === "string" && value.length > 0 ? value : undefined;
579
592
  }
580
593
 
594
+ function selectDefaultAdvisorProfile(
595
+ profiles: Record<string, Record<string, unknown>>,
596
+ preferPersonalProfile: boolean,
597
+ ): string | undefined {
598
+ const personal = firstActiveProfile(profiles, [
599
+ "custom-quality-optimized",
600
+ "custom-balanced",
601
+ "custom-cost-optimized",
602
+ ]);
603
+ const managed = firstActiveManagedProfile(profiles, [
604
+ "frontier",
605
+ "quality-optimized",
606
+ "balanced",
607
+ "cost-optimized",
608
+ ]);
609
+ return preferPersonalProfile ? (personal ?? managed) : (managed ?? personal);
610
+ }
611
+
612
+ function firstActiveProfile(
613
+ profiles: Record<string, Record<string, unknown>>,
614
+ names: string[],
615
+ ): string | undefined {
616
+ for (const name of names) {
617
+ const profile = readObject(profiles[name]);
618
+ if (profile && profile.status !== "disabled") return name;
619
+ }
620
+ return undefined;
621
+ }
622
+
623
+ function firstActiveManagedProfile(
624
+ profiles: Record<string, Record<string, unknown>>,
625
+ names: string[],
626
+ ): string | undefined {
627
+ for (const name of names) {
628
+ const profile = readObject(profiles[name]);
629
+ if (profile?.source === "managed" && profile.status !== "disabled") {
630
+ return name;
631
+ }
632
+ }
633
+ return undefined;
634
+ }
635
+
581
636
  function getHatchSelectedManagedConnection(
582
637
  llm: Record<string, unknown>,
583
638
  profiles: Record<string, Record<string, unknown>>,