@bivy/bivy 0.10.1-staging.185 → 0.10.1-staging.186

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.
@@ -1,22 +1,26 @@
1
1
  // SPDX-License-Identifier: AGPL-3.0-only
2
2
  // Copyright (c) 2026 Petter André Sjulstad
3
- // Model-provider auth surface for the daemon (the "Models & providers" screen).
3
+ // The daemon credential API — Bivy's OWN model-provider auth surface (the
4
+ // "Models & providers" screen). This is the one entry every mutation flows
5
+ // through, so the CLI and PWA can't drift.
4
6
  //
5
- // Storage is Bivy's own (credential-store.ts): set / remove / export / import all
6
- // operate directly on the encrypted vault with no Pi involvement. The one thing
7
- // that legitimately comes from Pi is the model-provider *catalog* — the list of
8
- // providers and their display names / OAuth capability — which the isolated
9
- // pi-oauth bridge supplies (Bivy has no model catalog of its own).
10
- import { createCredentialVault } from "./credential-store.js";
11
- import { listPiProviders } from "./pi-oauth.js";
12
- import { inferReferenceBackend, normalizeLabel, defaultSyncFor, DEFAULT_LABEL, } from "../credentials/records.js";
7
+ // Deliberately Pi-FREE: every function here operates on Bivy's own encrypted
8
+ // vault (credential-store.ts) with zero Pi involvement, so the service compiles
9
+ // and tests without Pi. The one thing that legitimately comes from Pi — the
10
+ // model-provider *catalog* (Bivy has none of its own) — is INJECTED:
11
+ // `joinProviderCatalog` takes the catalog as a parameter, and the thin
12
+ // `runtime/provider-catalog.ts` bridge supplies Pi's. See
13
+ // docs/credentials-service-plan.md §3.1.
14
+ import { createCredentialVault } from "../runtime/credential-store.js";
15
+ import { inferReferenceBackend, normalizeLabel, defaultSyncFor, DEFAULT_LABEL, } from "./records.js";
13
16
  /**
14
- * Enumerate model providers with their current auth status. The catalog + status
15
- * come from Pi's provider list (joined with our injected store); the stored
16
- * credential `kind` comes from Bivy's vault.
17
+ * Join a provider catalog with the vault's stored auth status → the "Models &
18
+ * providers" rows. Pure w.r.t. Pi: the catalog is passed in (see
19
+ * `runtime/provider-catalog.ts`, which supplies Pi's). The stored credential
20
+ * `kind`/`expiresAt` come from Bivy's own vault.
17
21
  */
18
- export async function listProviders(credsDir, piDir) {
19
- const [catalog, stored] = await Promise.all([listPiProviders(credsDir, piDir), createCredentialVault(credsDir).list()]);
22
+ export async function joinProviderCatalog(credsDir, catalog) {
23
+ const stored = await createCredentialVault(credsDir).list();
20
24
  const infoById = new Map(stored.map((info) => [info.providerId, info]));
21
25
  return catalog.map((provider) => ({
22
26
  id: provider.id,
@@ -22,7 +22,7 @@ export { parsePresets, loadPresets, defaultPresetsPath, PRESETS_FILENAME, parseI
22
22
  export { createCredentialVault, migrateVaultDir, preferIncomingCredential, tombstoneWins, BivyCredentialStore, } from "../runtime/credential-store.js";
23
23
  // --- The node resolver + agent env representation ---------------------------
24
24
  export { createCredentialStore, buildAgentCredentialEnv, apiKeyEnvVar, NodeCredentialResolver, } from "../runtime/credentials.js";
25
- // --- The daemon credential API (ours — currently named pi-auth.ts) ----------
26
- // Phase 5 renames the file to `src/credentials/api.ts`; the facade keeps the
27
- // import path stable so call sites don't churn when it moves.
28
- export { listProviders, exportProviderAuth, exportProviderAuthTombstones, importProviderAuth, setProviderApiKey, setProviderCredential, setProviderReference, removeProvider, listCredentialRecords, setProviderApiKeyLabeled, setProviderReferenceLabeled, removeProviderCredential, } from "../runtime/pi-auth.js";
25
+ // --- The daemon credential API (ours — Pi-free) -----------------------------
26
+ export { exportProviderAuth, exportProviderAuthTombstones, importProviderAuth, setProviderApiKey, setProviderCredential, setProviderReference, removeProvider, listCredentialRecords, setProviderApiKeyLabeled, setProviderReferenceLabeled, removeProviderCredential, joinProviderCatalog, } from "./api.js";
27
+ // --- The Pi-catalog bridge (the one Pi-coupled provider listing) ------------
28
+ export { listProviders } from "../runtime/provider-catalog.js";
@@ -0,0 +1,15 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Copyright (c) 2026 Petter André Sjulstad
3
+ // The Pi-catalog bridge: the single place the credential API's provider listing
4
+ // is joined with Pi's model-provider catalog.
5
+ //
6
+ // The credential API (src/credentials/api.ts) is deliberately Pi-free and takes
7
+ // the catalog as data (`joinProviderCatalog`). This thin module is the injection
8
+ // point — it fetches Pi's catalog and hands it in. Swapping Pi for a Bivy-owned
9
+ // catalog later is a change here and nowhere else.
10
+ import { listPiProviders } from "./pi-oauth.js";
11
+ import { joinProviderCatalog } from "../credentials/api.js";
12
+ /** Enumerate model providers with their current auth status (catalog from Pi). */
13
+ export async function listProviders(credsDir, piDir) {
14
+ return joinProviderCatalog(credsDir, await listPiProviders(credsDir, piDir));
15
+ }
package/dist/server.js CHANGED
@@ -35,7 +35,8 @@ import { decideOAuthLoginSweep } from "./runtime/oauth/oauth-login-sweep.js";
35
35
  import { listCodexSessions, loadCodexTranscript } from "./runtime/codex-sessions.js";
36
36
  import { dedupeSessionSummaries } from "./session-identity.js";
37
37
  import { deriveSessionState } from "./session/session-state.js";
38
- import { exportProviderAuth, exportProviderAuthTombstones, importProviderAuth, listProviders, removeProvider, setProviderApiKey, setProviderCredential } from "./runtime/pi-auth.js";
38
+ import { exportProviderAuth, exportProviderAuthTombstones, importProviderAuth, removeProvider, setProviderApiKey, setProviderCredential } from "./credentials/api.js";
39
+ import { listProviders } from "./runtime/provider-catalog.js";
39
40
  import { loadLocalModels, upsertLocalProvider, removeLocalProviderEntry, listLocalProviderSummaries, exportLocalModels, importLocalModels, toPiModelsConfig, normalizeProviderId, } from "./runtime/local-model-store.js";
40
41
  import { execEphemeralRequest } from "./ephemeral-exec.js";
41
42
  import { ApprovalManager } from "./approval.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bivy/bivy",
3
- "version": "0.10.1-staging.185",
3
+ "version": "0.10.1-staging.186",
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.",