@bivy/bivy 0.3.0-staging.44 → 0.3.0-staging.45

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.
Files changed (2) hide show
  1. package/dist/server.js +15 -0
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -3600,6 +3600,14 @@ async function syncModelAuthFromControlPlane() {
3600
3600
  vaultKeyB64 = pairingStore.unwrapFromNodePublicKey(data.wrappedKey.wrappedByPublicKey, data.wrappedKey.wrappedKey);
3601
3601
  writeLocalModelAuthVaultKey(vaultKeyB64);
3602
3602
  }
3603
+ // Node-less inheritance: a lone HOSTED ephemeral (no peer to wrap the key)
3604
+ // adopts the vault key the control plane escrowed for this hosted account, so
3605
+ // it can decrypt the synced vault (incl. subscription OAuth) on cold start. The
3606
+ // control plane serves `hostedKey` only for hosted-provisioning accounts.
3607
+ if (!vaultKeyB64 && data.hostedKey && Buffer.from(data.hostedKey, "base64").length === 32) {
3608
+ vaultKeyB64 = data.hostedKey;
3609
+ writeLocalModelAuthVaultKey(vaultKeyB64);
3610
+ }
3603
3611
  if (data.vault?.ciphertext && vaultKeyB64) {
3604
3612
  const { providers, localModels } = decryptModelAuthEnvelope(data.vault.ciphertext, vaultKeyB64);
3605
3613
  await importProviderAuth(credsDir, providers);
@@ -3666,6 +3674,13 @@ async function pushModelAuthToControlPlane() {
3666
3674
  method: "PUT",
3667
3675
  body: JSON.stringify({ targetNodeId: identity.nodeId, wrappedByPublicKey: pairingStore.nodePublicKeyB64(), wrappedKey: pairingStore.wrapForNodePublicKey(pairingStore.nodePublicKeyB64(), vaultKeyB64) }),
3668
3676
  });
3677
+ // Node-less inheritance: a HOSTED node also escrows the vault key to the control
3678
+ // plane (sealed at rest, hosted-only) so the account's NEXT hosted ephemeral —
3679
+ // possibly the only node — can decrypt this vault without a peer to wrap the key.
3680
+ // Gated to hosted nodes; the CP double-checks the account is hosted. Best effort.
3681
+ if (process.env.BIVY_GITHUB_HOSTED_TASKS) {
3682
+ await modelAuthFetch("/node/model-auth-key/hosted-escrow", { method: "PUT", body: JSON.stringify({ vaultKeyB64 }) }).catch(() => { });
3683
+ }
3669
3684
  lastPushedModelAuthCiphertext = ciphertext;
3670
3685
  }
3671
3686
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bivy/bivy",
3
- "version": "0.3.0-staging.44",
3
+ "version": "0.3.0-staging.45",
4
4
  "type": "module",
5
5
  "license": "FSL-1.1-ALv2",
6
6
  "description": "Run coding agents on machines you own. Source-available, self-hostable agent workspace.",