Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ gh attestation verify "${VMBRIDGE_INSTALL_DIR:-$HOME/.local/bin}/vmbridge" --rep

1. Run `vmbridge` and open one of the setup links it prints.
2. Choose a dashboard password, add a provider, sign in your agents and choose whether to bring your
skills and instructions. GitHub is under **Setup** in the dashboard.
3. Under **Devices**, create a pairing link and paste it into T3 Code as a remote environment.
skills and instructions. GitHub is under **Accounts** in the dashboard.
3. Under **Settings**, **Devices**, create a pairing link and paste it into T3 Code as a remote environment.

Start a thread in T3 Code and VM Bridge brings up a VM for it.

Expand Down
10 changes: 5 additions & 5 deletions apps/landing/app/docs/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ bun run compile # dist/vmbridge

<Section id="setup" title="Set up the dashboard">
<p>
Open <Code>/dashboard</Code> on any address VM Bridge printed and log in with your password. Setup has three tabs.
Open <Code>/dashboard</Code> on any address VM Bridge printed and log in with your password. Accounts has three tabs.
</p>
<List
items={[
Expand All @@ -316,13 +316,13 @@ bun run compile # dist/vmbridge

<Section id="pair" title="Pair T3 Code">
<p>
Under <strong>Devices</strong>, name the device and create a pairing link. In T3 Code, add a remote environment and paste the link.
Under <strong>Settings</strong>, <strong>Devices</strong>, name the device and create a pairing link. In T3 Code, add a remote environment and paste the link.
</p>
<List
items={[
"Each link works once and expires after 15 minutes.",
"Pairing swaps the link for a token that only that device holds. VM Bridge stores a hash of it.",
"Remove a device under Devices to sign it out right away.",
"Remove a device under Settings, Devices to sign it out right away.",
]}
/>
</Section>
Expand Down Expand Up @@ -437,7 +437,7 @@ bun run compile # dist/vmbridge

<Section id="sign-in" title="Agent sign-ins and GitHub">
<p>
Agents and git sign in only with what you add in Setup, never with sign-ins from the VM provider. Each agent sign-in is a profile saved, encrypted, in{" "}
Agents and git sign in only with what you add in Accounts, never with sign-ins from the VM provider. Each agent sign-in is a profile saved, encrypted, in{" "}
<Code>~/.vmbridge/main.db</Code>. Each agent uses one profile at a time, and VMs get it when they start.
</p>
<Table
Expand Down Expand Up @@ -668,7 +668,7 @@ bun run compile # dist/vmbridge
<Table
head={["What you see", "What to do"]}
rows={[
["An agent shows as signed out on a VM", "Add its sign-in under Setup, or in your provider's dashboard if it supplies them."],
["An agent shows as signed out on a VM", "Add its sign-in under Accounts, or in your provider's dashboard if it supplies them."],
["The pairing link does not work", "Links work once and expire after 15 minutes. Create a new one."],
["The T3 server on a VM did not answer", "The VM may be busy or the provider slow. Check the VM on the dashboard canvas, then retry."],
["Waking takes longer than usual", "Stopped VMs (Daytona, Boat) start T3 cold, which adds a few seconds over a paused VM."],
Expand Down
2 changes: 1 addition & 1 deletion apps/landing/components/Stage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const steps: Step[] = [
},
{
title: "Pair T3 Code",
body: "Create a link under Devices and paste it into T3 Code as a remote environment. Pair as many devices as you like.",
body: "Create a link under Settings, Devices and paste it into T3 Code as a remote environment. Pair as many devices as you like.",
links: [true, false],
paired: true,
vm: "none",
Expand Down
2 changes: 1 addition & 1 deletion apps/landing/lib/copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const copy = {
},
{
title: "Pair T3 Code",
body: "Create a single-use pairing link under Devices and paste it into T3 Code as a remote environment. Each device gets its own token.",
body: "Create a single-use pairing link under Settings, Devices and paste it into T3 Code as a remote environment. Each device gets its own token.",
},
{
title: "Open a project",
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ export class Admin {
if (!action && method === "DELETE") {
const remaining = settings.get("providers").filter((entry) => entry !== id);
settings.set("providers", remaining);
// Its base snapshots are billed until deleted, so a failure stays on the provider in Setup.
// Its base snapshots are billed until deleted, so a failure stays on the provider in Accounts.
void fleet.bases.drop(id).catch((error) =>
this.deps.traffic.record({ kind: "provider", operation: "remove provider", provider: id, status: "error", reason: message(error) }),
);
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const add = (a: Estimate, b: Estimate): Estimate => ({ amount: a.amount + b.amou

/**
* VM time, spend, lifecycle, turns and errors from `from` to `until` (which ends at `now` at the latest), by day in
* `timeZone` where it helps. Time and spend come from `usage`, so they match the Costs page.
* `timeZone` where it helps. Time and spend come from `usage`, so they match the Costs tab.
*/
export function analyticsReport(store: Store, usage: Usage, from: number, until: number, timeZone: string, now = Date.now()): AnalyticsReport {
const to = Math.min(until, now);
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/budget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const dollars = (amount: number) => `$${amount.toFixed(2)}`;
export class BudgetReached extends Error {}

/**
* One monthly budget for all providers, checked against the same estimate the Costs page shows. It never stops or
* One monthly budget for all providers, checked against the same estimate the Usage page's Costs tab shows. It never stops or
* deletes anything: at the limit, early wakes stop, and with `stopAtLimit` on, new VMs and wakes are refused too.
*/
export class Budget {
Expand Down Expand Up @@ -53,7 +53,7 @@ export class Budget {
refusal(now = Date.now()): string | null {
const status = this.status(now);
if (status.level !== "over" || !status.stopAtLimit || status.monthlyUsd === null) return null;
return `VM Bridge reached this month's budget of ${dollars(status.monthlyUsd)}, so it is not starting or waking VMs. Raise the budget on the Costs page of the VM Bridge dashboard.`;
return `VM Bridge reached this month's budget of ${dollars(status.monthlyUsd)}, so it is not starting or waking VMs. Raise the budget on the Usage page of the VM Bridge dashboard.`;
}

/** Early wakes are only a guess that a message follows, so they stop at the limit even without `stopAtLimit`. */
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/fleet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export class Fleet extends EventEmitter<FleetEvents> {
async create(choice: { provider?: ProviderId; size?: VmSize; discardOnError?: boolean } = {}): Promise<VmRow> {
this.refuse();
const provider = choice.provider ?? this.available();
if (!this.settings.get("providers").includes(provider)) throw new Error(`Add ${providers[provider].label} in Setup first.`);
if (!this.settings.get("providers").includes(provider)) throw new Error(`Add ${providers[provider].label} in Accounts first.`);
if (this.settingUp(provider)) throw new SettingUp(provider);
const driver = this.driver(provider);
const id = shortId();
Expand Down Expand Up @@ -942,7 +942,7 @@ fi`,
)
.finally(() => {
this.reconciling.delete(provider);
// The provider's flag in Setup comes with the overview.
// The provider's flag in Accounts comes with the overview.
this.emit("changed");
});
this.reconciling.set(provider, flight);
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface SettingValues {
onboarded: boolean;
/** The name T3 shows for this machine. */
machineName: string;
/** Providers added in Setup, in order. VMs on a removed provider keep running but get no new VMs beside them. */
/** Providers added in Accounts, in order. VMs on a removed provider keep running but get no new VMs beside them. */
providers: ProviderId[];
/** One of `providers`. New VMs go here unless a repository rule picks another. */
defaultProvider: ProviderId | null;
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/vm/bases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ const tookTooLong = `Setup took longer than ${baseSetupLimitMs / 60_000} minutes
/** Why a build failed, short enough to show next to a provider. */
function failureReason(provider: ProviderId, error: unknown) {
// A key that was rotated or revoked fails every build, and the provider's HTTP error does not say what to do.
if (error instanceof SandboxError && error.code === "auth") return `${providers[provider].label} refused the API key. Enter a new one in Setup.`;
if (error instanceof SandboxError && error.code === "auth") return `${providers[provider].label} refused the API key. Enter a new one in Accounts.`;
const line = (error instanceof Error ? error.message : String(error)).trim().split("\n")[0] ?? "";
if (!line) return "The build failed.";
return line.length > 200 ? `${line.slice(0, 197)}...` : line;
Expand Down
2 changes: 1 addition & 1 deletion apps/server/test/analytics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe("report", () => {
const boxd = pricing("boxd");
const boxdDay = (boxd.runningHourly.medium + 23 * boxd.asleepHourly.medium!) * eurUsd.rate;
expect(days[1]!.providers[1]!.estimate.amount).toBeCloseTo(boxdDay, 6);
// Matches what the Costs page totals, in US dollars.
// Matches what the Costs tab totals, in US dollars.
expect(total.amount).toBeCloseTo(4 * 0.036 + boxdDay, 6);
});

Expand Down
4 changes: 2 additions & 2 deletions apps/server/test/bases.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ describe("setting up a provider", () => {
fleet.prepareBase("boxd");
await fleet.bases.settled();
// A rotated or revoked key: the reason says what to do, not the HTTP error.
expect(fleet.setup("boxd")).toEqual({ state: "failed", reason: "boxd refused the API key. Enter a new one in Setup." });
expect(fleet.setup("boxd")).toEqual({ state: "failed", reason: "boxd refused the API key. Enter a new one in Accounts." });
driver.create = create;
fleet.prepareBase("boxd", true);
await fleet.bases.settled();
Expand All @@ -351,7 +351,7 @@ describe("setting up a provider", () => {
}
expect(logs).toEqual([
"[base boxd:medium] build started",
expect.stringMatching(/^\[base boxd:medium\] build failed after \d+ s: boxd refused the API key\. Enter a new one in Setup\.$/),
expect.stringMatching(/^\[base boxd:medium\] build failed after \d+ s: boxd refused the API key\. Enter a new one in Accounts\.$/),
"[base boxd:medium] build started",
expect.stringMatching(/^\[base boxd:medium\] ready in \d+ s$/),
]);
Expand Down
2 changes: 1 addition & 1 deletion apps/server/test/budget.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe("monthly budget", () => {
expect(setup(hoursFor(0.9), { monthlyUsd: 1, stopAtLimit: true }).budget.refusal(at)).toBeNull();
const refusal = setup(hoursFor(1.1), { monthlyUsd: 1, stopAtLimit: true }).budget.refusal(at);
expect(refusal).toContain("budget of $1.00");
expect(refusal).toContain("Costs page of the VM Bridge dashboard");
expect(refusal).toContain("Usage page of the VM Bridge dashboard");
});

test("early wakes stop at 100% even with the setting off", () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/test/placement.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe("where a new VM goes", () => {

test("a VM can only be created on an added provider", async () => {
const { fleet } = setup();
await expect(fleet.create({ provider: "daytona" })).rejects.toThrow("Add Daytona in Setup first.");
await expect(fleet.create({ provider: "daytona" })).rejects.toThrow("Add Daytona in Accounts first.");
});
});

Expand Down
8 changes: 4 additions & 4 deletions apps/web/src/Setup.tsx → apps/web/src/Accounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ import { CopyButton } from "./CopyButton.tsx";
import { Page, Section, type Tab } from "./Page.tsx";
import { Private } from "./Private.tsx";

type SetupTab = "provider" | "github" | "agents";
type AccountsTab = "provider" | "github" | "agents";

const sleepModes = { pause: "Pauses: memory and disk kept", stop: "Stops: disk kept", checkpoint: "Checkpoints: disk kept, new sandbox on wake" };


export function Setup({ overview }: { overview: Overview }) {
const tabs: Tab<SetupTab>[] = [
export function Accounts({ overview }: { overview: Overview }) {
const tabs: Tab<AccountsTab>[] = [
{ id: "provider", label: "Providers", icon: Plug01Icon, attention: !overview.setup.provider },
{ id: "github", label: "GitHub", icon: GithubIcon, attention: !overview.setup.github },
{ id: "agents", label: "Agent sign-in", icon: Robot01Icon, attention: !overview.setup.agents },
];
const [tab, setTab] = useQueryState("tab", parseAsStringLiteral(tabs.map((entry) => entry.id)).withDefault(overview.setup.provider ? "agents" : "provider"));
return (
<Page title="Setup" tabs={tabs} tab={tab} onTab={setTab}>
<Page title="Accounts" tabs={tabs} tab={tab} onTab={setTab}>
{tab === "provider" && <Providers overview={overview} />}
{tab === "github" && <GitHub account={overview.github} />}
{tab === "agents" && <Agents profiles={overview.agents} />}
Expand Down
25 changes: 5 additions & 20 deletions apps/web/src/Analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ import { useEffect, useState, type ReactNode } from "react";
import { HugeiconsIcon } from "@hugeicons/react";
import { Analytics01Icon } from "@hugeicons/core-free-icons";
import { agentKinds, providerIds, type AnalyticsDay, type AnalyticsReport, type Overview, type ProviderActivity, type ProviderId } from "@vmbridge/contracts";
import { Button } from "@/components/ui/button";
import { ButtonGroup } from "@/components/ui/button-group";
import { Empty, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty";
import { FieldError } from "@/components/ui/field";
import { cn } from "@/lib/utils";
import { api, useTick } from "./api.ts";
import { AgentLogo, ProviderLogo } from "./brand.tsx";
import { Bars, days, hours, money, rangeStart, ranges, Rows, Tile, type Range } from "./Costs.tsx";
import { Page, Section } from "./Page.tsx";
import { Bars, days, hours, money, rangeStart, Rows, Tile, type Range } from "./Costs.tsx";
import { Section } from "./Page.tsx";

/** One fixed color per provider, so a provider keeps its color in every chart and range. */
const providerColors: Record<ProviderId, string> = {
Expand All @@ -26,8 +24,7 @@ const providerColors: Record<ProviderId, string> = {
};
const otherColor = "#5c5c5c";

export function Analytics({ overview }: { overview: Overview }) {
const [range, setRange] = useState<Range>("month");
export function Analytics({ overview, range }: { overview: Overview; range: Range }) {
const [report, setReport] = useState<AnalyticsReport | null>(null);
const [error, setError] = useState<string | null>(null);
// Awake time adds up while the page is open, and a VM waking or sleeping changes it.
Expand All @@ -49,22 +46,10 @@ export function Analytics({ overview }: { overview: Overview }) {
const label = (id: ProviderId) => overview.providers.find((provider) => provider.id === id)?.label ?? id[0]!.toUpperCase() + id.slice(1);

return (
<Page
title="Analytics"
wide
actions={
<ButtonGroup>
{ranges.map((entry) => (
<Button key={entry.id} variant={range === entry.id ? "secondary" : "outline"} size="lg" className="h-9" onClick={() => setRange(entry.id)}>
{entry.label}
</Button>
))}
</ButtonGroup>
}
>
<>
{error && <FieldError>{error}</FieldError>}
{report && <Report report={report} label={label} />}
</Page>
</>
);
}

Expand Down
Loading