diff --git a/README.md b/README.md index 414e4b02c..e49150f13 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ development server after changes, or rebuild the frontend for deployment. | `VITE_BACKEND_API_URL` | For backend features | URL of your Tangle backend (e.g. `http://127.0.0.1:8000`). | | `TANGLE_UI_PORT` | No | Port for the local Vite dev server and Playwright base URL. Defaults to `3000`; set this in `.env`, `.env.local`, or your shell to use a different local port. | | `VITE_ENABLE_TANGENT` | For Tangent | Set to `true` to unlock the Tangent beta toggle in Settings → Beta Features. See [Projects and Tangent (beta)](#projects-and-tangent-beta). | +| `VITE_TANGENT_BUNDLE_ID` | No | Agent bundle that Tangent sessions started from the app use. Defaults to `tangle-oss`, the bundle the open-source Tangent shell ships. Set it when your Tangent shell installs a different one. | | `VITE_REMOTE_PIPELINES` | No | Opt in to remote pipeline storage with `true` on a backend that supports saved pipelines. Unset or `false` keeps new pipelines, imports, and copies in browser storage. Without a configured backend, storage stays local even when enabled. | | `VITE_ARTIFACT_RETENTION_DAYS` | No | Number of days artifacts are stored by your backend. When set, the UI shows artifact expiry dates and warns when artifacts may no longer be available. | | `VITE_BUGSNAG_API_KEY` | No | Bugsnag API key. Required alongside `VITE_TANGLE_ENV` to enable error reporting. | diff --git a/src/routes/v2/pages/Tangent/constants.test.ts b/src/routes/v2/pages/Tangent/constants.test.ts new file mode 100644 index 000000000..9b479357e --- /dev/null +++ b/src/routes/v2/pages/Tangent/constants.test.ts @@ -0,0 +1,25 @@ +import { afterEach, describe, expect, it, vi } from "vitest"; + +async function loadBundleId() { + vi.resetModules(); + const { TANGENT_BUNDLE_ID } = await import("./constants"); + return TANGENT_BUNDLE_ID; +} + +describe("TANGENT_BUNDLE_ID", () => { + afterEach(() => { + vi.unstubAllEnvs(); + }); + + it("uses the open-source tangle-oss bundle when the build sets none", async () => { + vi.stubEnv("VITE_TANGENT_BUNDLE_ID", ""); + + expect(await loadBundleId()).toBe("tangle-oss"); + }); + + it("uses the bundle the build names", async () => { + vi.stubEnv("VITE_TANGENT_BUNDLE_ID", " research "); + + expect(await loadBundleId()).toBe("research"); + }); +}); diff --git a/src/routes/v2/pages/Tangent/constants.ts b/src/routes/v2/pages/Tangent/constants.ts index 7e388b12e..3dc8d7c02 100644 --- a/src/routes/v2/pages/Tangent/constants.ts +++ b/src/routes/v2/pages/Tangent/constants.ts @@ -1,5 +1,8 @@ +const DEFAULT_TANGENT_BUNDLE_ID = "tangle-oss"; + /** Bundle that backs embedded Tangent sessions started from tangle-ui. */ -export const TANGENT_BUNDLE_ID = "tangle"; +export const TANGENT_BUNDLE_ID = + import.meta.env.VITE_TANGENT_BUNDLE_ID?.trim() || DEFAULT_TANGENT_BUNDLE_ID; /** * Only ever used by a dev build. A deployed origin that reached for loopback diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index dc059a615..d42106529 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -3,6 +3,7 @@ interface ImportMetaEnv { readonly VITE_REMOTE_PIPELINES?: string; readonly VITE_ENABLE_TANGENT?: string; + readonly VITE_TANGENT_BUNDLE_ID?: string; readonly VITE_TANGENT_REMOTE_ENV_TOKEN?: string; }