@bivy/bivy 0.16.25-staging.19 → 0.16.25-staging.20

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.
@@ -0,0 +1,30 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (c) 2026 Petter André Sjulstad
3
+ // One pure policy decision: does THIS daemon hold only control-plane-custodied
4
+ // credentials (the separately escrowed unattended snapshot), or is it a normal
5
+ // personal node that owns its vault?
6
+ //
7
+ // The distinction matters everywhere model-auth sync branches: a custody node
8
+ // never pushes/pulls the account vault, never publishes the unattended escrow,
9
+ // and treats the control plane's filtered snapshot as an authoritative set
10
+ // (reconcile deletes what a newer snapshot omits). Getting this wrong on a
11
+ // personal node silently breaks credential sync AND makes the unattended-runs
12
+ // toggle a no-op — the "Allowed — encrypted cloud copy enabled" UI then lies,
13
+ // and every Bivy Cloud session fails with "credential didn't reach Bivy Cloud".
14
+ /**
15
+ * True when this daemon must run with hosted-custody semantics:
16
+ * - `BIVY_HOSTED_CREDENTIAL_CUSTODY` — the dedicated flag the provisioner sets
17
+ * on managed (Bivy Cloud) machines; always authoritative.
18
+ * - `BIVY_GITHUB_HOSTED_TASKS` + `BIVY_EPHEMERAL` — back-compat for
19
+ * provisioned user-owned queue runners that predate the dedicated flag.
20
+ *
21
+ * `BIVY_GITHUB_HOSTED_TASKS` ALONE is not custody: it is persisted onto any
22
+ * long-lived personal node when a GitHub App is connected (it only means "poll
23
+ * the hosted task queue"). Such a node owns its own logins and must keep full
24
+ * personal-vault semantics — account sync, escrow publishing, loud toggles.
25
+ */
26
+ export function hostedCustodyNode(env = process.env) {
27
+ if (env.BIVY_HOSTED_CREDENTIAL_CUSTODY)
28
+ return true;
29
+ return Boolean(env.BIVY_GITHUB_HOSTED_TASKS && env.BIVY_EPHEMERAL);
30
+ }
package/dist/server.js CHANGED
@@ -80,6 +80,7 @@ import { forceAbortTurn } from "./session/abort-recovery.js";
80
80
  import { runRequiredAutomationChecks } from "./automation-checks.js";
81
81
  import { configToLegacySettings, mergeLegacyIntoNodeConfig, readNodeConfig, writeNodeConfig } from "./node-config.js";
82
82
  import { loadProjectPolicy, resolveProjectSafety } from "./project-policy.js";
83
+ import { hostedCustodyNode } from "./hosted-custody.js";
83
84
  import { PolicyEngine } from "./policy/policy-engine.js";
84
85
  import { SessionAllowRules } from "./policy/session-allow.js";
85
86
  import { TerminalManager } from "./terminal.js";
@@ -3079,7 +3080,11 @@ const hostedImportedRecordsPath = path.join(appDir, "model-auth-hosted-records.j
3079
3080
  let lastPushedModelAuthCiphertext = "";
3080
3081
  let lastPushedHostedModelAuthCiphertext = "";
3081
3082
  let lastPushedHostedModelAuthRevision = -1;
3082
- const isHostedCustodyNode = () => Boolean(process.env.BIVY_HOSTED_CREDENTIAL_CUSTODY || process.env.BIVY_GITHUB_HOSTED_TASKS);
3083
+ // Custody semantics are keyed on the dedicated flag (plus an ephemeral
3084
+ // back-compat case) — see src/hosted-custody.ts. A persistent personal node
3085
+ // that polls the hosted GitHub queue is NOT a custody guest: it owns its
3086
+ // logins and must keep account sync and unattended-escrow publishing.
3087
+ const isHostedCustodyNode = () => hostedCustodyNode();
3083
3088
  function readLocalModelAuthVaultKey() {
3084
3089
  try {
3085
3090
  const parsed = JSON.parse(fs.readFileSync(modelAuthVaultKeyPath, "utf8"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bivy/bivy",
3
- "version": "0.16.25-staging.19",
3
+ "version": "0.16.25-staging.20",
4
4
  "type": "module",
5
5
  "license": "AGPL-3.0-only",
6
6
  "description": "Run coding agents on machines you own. Open-source, self-hostable agent workspace.",