@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
|
-
//
|
|
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
|
-
//
|
|
6
|
-
//
|
|
7
|
-
// that legitimately comes from Pi
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import {
|
|
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
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
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
|
|
19
|
-
const
|
|
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 —
|
|
26
|
-
|
|
27
|
-
//
|
|
28
|
-
export { listProviders
|
|
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,
|
|
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