@bivy/bivy 0.19.4-staging.5 → 0.19.4-staging.7
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.
- package/README.md +133 -105
- package/bin/bivy.mjs +114 -16
- package/bin/cli-commands.mjs +5 -1
- package/bin/guides/automate.md +28 -4
- package/dist/agent-instructions.js +2 -0
- package/dist/approval.js +1 -1
- package/dist/apps/styles.css +1 -1
- package/dist/auth.js +20 -1
- package/dist/automation-cli.js +23 -1
- package/dist/certification/agent-ux.js +50 -0
- package/dist/harness/mcp-config.js +4 -1
- package/dist/harness/mcp-serve-cli.js +6 -5
- package/dist/runtime/session-env.js +9 -1
- package/dist/server.js +77 -1
- package/dist/session/automation-proposals.js +87 -0
- package/dist/session/session-tokens.js +76 -0
- package/package.json +2 -2
package/dist/apps/styles.css
CHANGED
|
@@ -727,7 +727,7 @@ input, textarea, select { font-family: inherit; font-size: 16px; }
|
|
|
727
727
|
}
|
|
728
728
|
.approval-fields { display: grid; gap: 6px; margin-bottom: 8px; }
|
|
729
729
|
.approval-field-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
|
|
730
|
-
.approval-field-value { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; overflow-wrap: anywhere; word-break: break-word; }
|
|
730
|
+
.approval-field-value { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; overflow-wrap: anywhere; word-break: break-word; white-space: pre-line; }
|
|
731
731
|
.approval-raw-toggle { border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 0; margin-bottom: 8px; text-decoration: underline; }
|
|
732
732
|
.approval-raw-toggle:hover { color: var(--ink); }
|
|
733
733
|
.approval-summary { margin: 0 0 10px; background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; overflow-x: auto; font-size: 12px; }
|
package/dist/auth.js
CHANGED
|
@@ -251,12 +251,31 @@ export function requestOriginAllowed(req) {
|
|
|
251
251
|
return true;
|
|
252
252
|
}
|
|
253
253
|
/** Express middleware enforcing auth on /api routes. */
|
|
254
|
-
export function authMiddleware(identity) {
|
|
254
|
+
export function authMiddleware(identity, sessionTokens) {
|
|
255
255
|
return (req, res, next) => {
|
|
256
256
|
if (!requestOriginAllowed(req)) {
|
|
257
257
|
res.status(403).json({ error: "Forbidden origin" });
|
|
258
258
|
return;
|
|
259
259
|
}
|
|
260
|
+
// An agent session's token: only that session's own routes, even over
|
|
261
|
+
// loopback, so a token-carrying request is never more than its session.
|
|
262
|
+
const token = tokenFromRequest(req);
|
|
263
|
+
if (sessionTokens?.claims(token)) {
|
|
264
|
+
const sessionId = sessionTokens.verify(token);
|
|
265
|
+
if (!sessionId) {
|
|
266
|
+
res.status(401).json({ error: "Unknown or expired session token" });
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
const call = { method: req.method, path: req.baseUrl + req.path, body: req.body };
|
|
270
|
+
if (!sessionTokens.allows(sessionId, call)) {
|
|
271
|
+
res.status(403).json({ error: `A session token can only reach its own session's routes, not ${call.method} ${call.path}.` });
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
sessionTokens.used?.(sessionId, call);
|
|
275
|
+
req.auth = { deviceId: null, loopback: isLoopbackAddress(req.socket?.remoteAddress), sessionId };
|
|
276
|
+
next();
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
260
279
|
const ctx = resolveAuth(identity, req);
|
|
261
280
|
if (!isAuthorized(ctx)) {
|
|
262
281
|
res.status(401).json({ error: "Unauthorized" });
|
package/dist/automation-cli.js
CHANGED
|
@@ -32,7 +32,8 @@ Commands:
|
|
|
32
32
|
plan [path] [--json] Show triggers, routing, and effective safety
|
|
33
33
|
test [path] --event <file> Simulate an event and explain the first match
|
|
34
34
|
test-filter [path] --id <key> --event <json> Execute a trusted filter locally
|
|
35
|
-
apply [path] [--prune]
|
|
35
|
+
apply [path] [--prune] [--dry-run] Encrypt instructions and reconcile the control plane
|
|
36
|
+
(inside an agent session: proposed to the user first)
|
|
36
37
|
|
|
37
38
|
Run commands (normally invoked as 'bivy runs ...'):
|
|
38
39
|
start <instructions> Queue definition-free unattended work
|
|
@@ -482,6 +483,27 @@ async function main() {
|
|
|
482
483
|
const pairing = PairingStore.load(appDir, relay.e2eKey);
|
|
483
484
|
const current = await request(relay, "/node/automation-config");
|
|
484
485
|
const wanted = new Set(config.automations.map((a) => a.id));
|
|
486
|
+
// --dry-run: what apply would change, and nothing more. The node shows this
|
|
487
|
+
// on the approval card when an agent proposes automations.
|
|
488
|
+
if (args.includes("--dry-run")) {
|
|
489
|
+
const changes = [
|
|
490
|
+
...config.automations.map((entry) => {
|
|
491
|
+
const safety = effectiveSafety(entry, file);
|
|
492
|
+
return {
|
|
493
|
+
id: entry.id, action: current.automations.some((a) => a.configKey === entry.id) ? "update" : "create", name: entry.name, enabled: entry.enabled, trigger: entry.trigger,
|
|
494
|
+
schedule: entry.schedule, workspace: entry.repo ?? (entry.repos?.length ? entry.repos.join(", ") : undefined),
|
|
495
|
+
agent: entry.routing.agent ?? "node default", sandbox: safety.sandbox, approval: safety.approval,
|
|
496
|
+
};
|
|
497
|
+
}),
|
|
498
|
+
...(args.includes("--prune") ? current.automations.filter((a) => a.configKey && !wanted.has(a.configKey)).map((a) => ({ id: a.configKey, action: "remove" })) : []),
|
|
499
|
+
];
|
|
500
|
+
if (args.includes("--json"))
|
|
501
|
+
console.log(JSON.stringify({ version: 1, changes }, null, 2));
|
|
502
|
+
else
|
|
503
|
+
for (const change of changes)
|
|
504
|
+
console.log(`${change.action === "create" ? "+" : change.action === "remove" ? "-" : "~"} ${change.id}`);
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
485
507
|
let created = 0, updated = 0, removed = 0;
|
|
486
508
|
for (const [configOrder, entry] of config.automations.entries()) {
|
|
487
509
|
const exists = current.automations.some((a) => a.configKey === entry.id);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright (c) 2026 Petter André Sjulstad
|
|
3
|
+
/**
|
|
4
|
+
* Scoring for the agent-UX eval (certification/agent-ux.json, run by
|
|
5
|
+
* scripts/agent-ux-eval.ts): given what a real agent did in a session, did it
|
|
6
|
+
* use Bivy the way the task needed? Pure, so the rules are testable without an
|
|
7
|
+
* agent or a model.
|
|
8
|
+
*/
|
|
9
|
+
function globToRegExp(glob) {
|
|
10
|
+
return new RegExp(`^${glob.split("*").map((part) => part.replace(/[.+?^${}()|[\]\\]/g, "\\$&")).join("[^/]*")}$`);
|
|
11
|
+
}
|
|
12
|
+
/** Every expectation of a task, checked against an observation. `vars` fills {name} placeholders. */
|
|
13
|
+
export function scoreAgentUx(expect, seen, vars = {}) {
|
|
14
|
+
const fill = (text) => text.replace(/\{(\w+)\}/g, (whole, name) => vars[name] ?? whole);
|
|
15
|
+
return expect.map((rule) => {
|
|
16
|
+
if ("block" in rule) {
|
|
17
|
+
const min = rule.min ?? 1;
|
|
18
|
+
return { expectation: `${min}+ ${rule.block}`, passed: (seen.blocks[rule.block] ?? 0) >= min };
|
|
19
|
+
}
|
|
20
|
+
if ("asked" in rule)
|
|
21
|
+
return { expectation: "asked a question", passed: seen.asked };
|
|
22
|
+
if ("approval" in rule)
|
|
23
|
+
return { expectation: `asked to approve ${rule.approval}`, passed: seen.approvals.includes(rule.approval) };
|
|
24
|
+
if ("reply" in rule) {
|
|
25
|
+
const text = fill(rule.reply);
|
|
26
|
+
return { expectation: `reply mentions "${text}"`, passed: seen.reply.toLowerCase().includes(text.toLowerCase()) };
|
|
27
|
+
}
|
|
28
|
+
const pattern = globToRegExp(rule.file);
|
|
29
|
+
return { expectation: `file ${rule.file}`, passed: seen.files.some((file) => pattern.test(file)) };
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/** Count `bivy_*` chat card blocks anywhere in a history payload's messages. */
|
|
33
|
+
export function countCardBlocks(messages) {
|
|
34
|
+
const counts = {};
|
|
35
|
+
const walk = (value) => {
|
|
36
|
+
if (Array.isArray(value)) {
|
|
37
|
+
for (const item of value)
|
|
38
|
+
walk(item);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (!value || typeof value !== "object")
|
|
42
|
+
return;
|
|
43
|
+
const type = value.type;
|
|
44
|
+
if (typeof type === "string" && type.startsWith("bivy_"))
|
|
45
|
+
counts[type] = (counts[type] ?? 0) + 1;
|
|
46
|
+
walk(value.content);
|
|
47
|
+
};
|
|
48
|
+
walk(messages);
|
|
49
|
+
return counts;
|
|
50
|
+
}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
// the fs inject/restore step (mcp-inject.ts) reads/writes; the transform itself
|
|
17
17
|
// is shared.
|
|
18
18
|
import nodePath from "node:path";
|
|
19
|
+
import { bivySessionEnv } from "../runtime/session-env.js";
|
|
19
20
|
/** Marker arg the proxy CLI recognizes, so a config can be detected as already routed. */
|
|
20
21
|
export const PROXY_MARKER = "--bivy-mcp";
|
|
21
22
|
/** True when a server spec already launches through the Bivy proxy. */
|
|
@@ -94,7 +95,9 @@ export function parseProxiedArgs(args) {
|
|
|
94
95
|
// back to the right session.
|
|
95
96
|
/** The server spec that launches `bivy mcp-serve` for a session. */
|
|
96
97
|
export function bivyToolsServerSpec(opts) {
|
|
97
|
-
|
|
98
|
+
// Some agents start MCP servers with a trimmed environment, so the session's
|
|
99
|
+
// token travels in the spec rather than being inherited.
|
|
100
|
+
const env = { ...bivySessionEnv(opts.sessionId) };
|
|
98
101
|
if (opts.endpoint)
|
|
99
102
|
env.BIVY_MCP_ENDPOINT = opts.endpoint;
|
|
100
103
|
// The user's account-wide instructions, advertised as the server's MCP
|
|
@@ -94,11 +94,12 @@ export async function runAttachToChat(endpoint, sessionId, args, fetchImpl, toke
|
|
|
94
94
|
const name = body?.name || filePath;
|
|
95
95
|
return { isError: false, text: `Attached ${name} to the chat as ${body?.kind === "image" ? "an inline image" : "a downloadable file"}. The user can see it now.` };
|
|
96
96
|
}
|
|
97
|
-
/** Run this install's `bivy` (bin/bivy.mjs, two levels up from src/ or dist/)
|
|
98
|
-
|
|
97
|
+
/** Run this install's `bivy` (bin/bivy.mjs, two levels up from src/ or dist/),
|
|
98
|
+
* against the node that injected this server. */
|
|
99
|
+
function defaultRunBivy(sessionId, endpoint) {
|
|
99
100
|
const cli = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../bin/bivy.mjs");
|
|
100
101
|
return (args) => new Promise((resolve) => {
|
|
101
|
-
const child = spawn(process.execPath, [cli, ...args], { env: { ...process.env, BIVY_SESSION_ID: sessionId, NO_COLOR: "1" }, stdio: ["ignore", "pipe", "pipe"] });
|
|
102
|
+
const child = spawn(process.execPath, [cli, ...args], { env: { ...process.env, BIVY_SESSION_ID: sessionId, BIVY_NODE_URL: endpoint, NO_COLOR: "1" }, stdio: ["ignore", "pipe", "pipe"] });
|
|
102
103
|
let stdout = "";
|
|
103
104
|
let stderr = "";
|
|
104
105
|
child.stdout.on("data", (chunk) => { stdout += chunk; });
|
|
@@ -133,10 +134,10 @@ function readInstructions(file) {
|
|
|
133
134
|
export function createBivyMcpServer(deps = {}) {
|
|
134
135
|
const endpoint = deps.endpoint ?? process.env.BIVY_MCP_ENDPOINT ?? DEFAULT_ENDPOINT;
|
|
135
136
|
const sessionId = deps.sessionId ?? process.env.BIVY_SESSION_ID ?? process.env.BIVY_MCP_SESSION ?? "";
|
|
136
|
-
const token = deps.token ?? process.env.BIVY_MCP_TOKEN ?? undefined;
|
|
137
|
+
const token = deps.token ?? process.env.BIVY_MCP_TOKEN ?? process.env.BIVY_SESSION_TOKEN ?? undefined;
|
|
137
138
|
const fetchImpl = deps.fetchImpl ?? globalThis.fetch;
|
|
138
139
|
const instructions = readInstructions(deps.instructionsFile ?? process.env.BIVY_AGENT_INSTRUCTIONS_FILE);
|
|
139
|
-
const runBivy = deps.runBivy ?? defaultRunBivy(sessionId);
|
|
140
|
+
const runBivy = deps.runBivy ?? defaultRunBivy(sessionId, endpoint);
|
|
140
141
|
let tools;
|
|
141
142
|
const generated = () => (tools ??= cliTools(runBivy));
|
|
142
143
|
const server = new Server({ name: "bivy", version: "1.0.0" }, { capabilities: { tools: {}, resources: {} }, ...(instructions ? { instructions } : {}) });
|
|
@@ -15,8 +15,16 @@
|
|
|
15
15
|
// has no hook to inject this into its bash tool's env the same way — see the
|
|
16
16
|
// comment on PiSession.interactiveTuiCommand and bin/attach-session-id.mjs for
|
|
17
17
|
// how that gap is closed instead.
|
|
18
|
+
//
|
|
19
|
+
// With a signer registered (the daemon does at startup), the env also carries
|
|
20
|
+
// BIVY_SESSION_TOKEN: a credential for that session's own routes only (see
|
|
21
|
+
// src/session/session-tokens.ts), which the `bivy` CLI and MCP tools prefer.
|
|
22
|
+
let signSessionToken;
|
|
23
|
+
export function setSessionTokenSigner(sign) {
|
|
24
|
+
signSessionToken = sign;
|
|
25
|
+
}
|
|
18
26
|
export function bivySessionEnv(sessionId) {
|
|
19
|
-
return { BIVY_SESSION_ID: sessionId };
|
|
27
|
+
return { BIVY_SESSION_ID: sessionId, ...(signSessionToken ? { BIVY_SESSION_TOKEN: signSessionToken(sessionId) } : {}) };
|
|
20
28
|
}
|
|
21
29
|
/**
|
|
22
30
|
* Apply a profile's instructions env template (AgentProfile.instructions) for one
|
package/dist/server.js
CHANGED
|
@@ -128,6 +128,9 @@ import { createArtifactCommands } from "./controllers/artifact-commands.js";
|
|
|
128
128
|
import { PresenceBook, deviceFrom } from "./session/presence.js";
|
|
129
129
|
import { buildAgentContext } from "./session/agent-context.js";
|
|
130
130
|
import { AgentQuestions, askQuestionsFrom } from "./session/agent-questions.js";
|
|
131
|
+
import { AutomationProposals, describeChange } from "./session/automation-proposals.js";
|
|
132
|
+
import { createSessionTokenCodec, isSessionToken, sessionTokenAllows } from "./session/session-tokens.js";
|
|
133
|
+
import { setSessionTokenSigner } from "./runtime/session-env.js";
|
|
131
134
|
import { MAX_NOTICE_TEXT, isAgentNotice, noticePush } from "./session/notices.js";
|
|
132
135
|
import { createForkCommands } from "./controllers/fork-commands.js";
|
|
133
136
|
import { createGithubCommands } from "./controllers/github-commands.js";
|
|
@@ -169,6 +172,12 @@ import { TERMINAL_DELEGATION, isDelegatedFrom } from "./session/delegations.js";
|
|
|
169
172
|
import { ControlPlaneTaskPoller, resolveControlPlaneTaskConfig, } from "./control-plane-tasks.js";
|
|
170
173
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
171
174
|
const repoRoot = path.resolve(__dirname, "..");
|
|
175
|
+
// Agents inherit this: the `bivy` on their PATH (another install, or an older
|
|
176
|
+
// version) hands their commands to this node's own CLI, so the commands the
|
|
177
|
+
// agent note names always exist. Agent shells that rebuild PATH from the
|
|
178
|
+
// user's rc files keep ordinary variables like this one.
|
|
179
|
+
if (!process.env.BIVY_NODE_CLI && fs.existsSync(path.join(repoRoot, "bin", "bivy.mjs")))
|
|
180
|
+
process.env.BIVY_NODE_CLI = path.join(repoRoot, "bin", "bivy.mjs");
|
|
172
181
|
// Asset root holds read-only bundled files (public/, helper scripts); data dir
|
|
173
182
|
// holds writable per-install state (.bivy). Both default to the repo when
|
|
174
183
|
// running from source. Packaged/release builds may override them (BIVY_ASSET_ROOT,
|
|
@@ -395,12 +404,55 @@ const sessionAllowRules = new SessionAllowRules();
|
|
|
395
404
|
// `bivy audit --verify` can prove it — the basis of an attested Receipt (2A).
|
|
396
405
|
const auditKey = loadOrCreateAuditKey(path.join(appDir, "audit"));
|
|
397
406
|
const auditLog = createAuditLog(path.join(appDir, "audit"), { signer: auditKey.signer });
|
|
407
|
+
// Agent sessions get a token for their own routes in their env (BIVY_SESSION_TOKEN).
|
|
408
|
+
const sessionTokens = createSessionTokenCodec();
|
|
409
|
+
setSessionTokenSigner(sessionTokens.sign);
|
|
398
410
|
// Bivy owns the AskUserQuestion → question-card feature at the guardian layer,
|
|
399
411
|
// runtime-agnostically (see src/question.ts). The manager holds every pending
|
|
400
412
|
// clarifying question across sessions; the guardian interceptor below raises
|
|
401
413
|
// them, and session.question(.resolved) is broadcast from its listeners.
|
|
402
414
|
const questionManager = new QuestionManager();
|
|
403
415
|
const agentQuestions = new AgentQuestions(questionManager);
|
|
416
|
+
// `bivy automation apply` from an agent: an approval request like any other, so
|
|
417
|
+
// the node's approval mode decides whether the user is asked ("never" applies
|
|
418
|
+
// at once; autonomous asks, as for deploys). Either way the result lands in the
|
|
419
|
+
// chat, and pushes when nobody was asked.
|
|
420
|
+
const automationProposals = new AutomationProposals({
|
|
421
|
+
runCli: (args, cwd) => new Promise((resolve) => {
|
|
422
|
+
const cli = process.env.BIVY_NODE_CLI ?? path.join(repoRoot, "bin", "bivy.mjs");
|
|
423
|
+
const child = spawn(process.execPath, [cli, ...args], { cwd, env: { ...process.env, BIVY_DATA_DIR: appDir, BIVY_AUTOMATION_DIRECT: "1", NO_COLOR: "1" }, stdio: ["ignore", "pipe", "pipe"] });
|
|
424
|
+
let stdout = "";
|
|
425
|
+
let stderr = "";
|
|
426
|
+
child.stdout.on("data", (chunk) => { stdout += chunk; });
|
|
427
|
+
child.stderr.on("data", (chunk) => { stderr += chunk; });
|
|
428
|
+
child.on("error", (error) => resolve({ code: 1, stdout, stderr: error.message }));
|
|
429
|
+
child.on("close", (code) => resolve({ code: code ?? 1, stdout, stderr }));
|
|
430
|
+
}),
|
|
431
|
+
requestApproval: async ({ id, sessionId, file, changes, prune }) => {
|
|
432
|
+
const approved = await approvals.request({
|
|
433
|
+
id, sessionId, toolName: "apply_automations", timeoutMs: 30 * 60_000,
|
|
434
|
+
toolInput: { file, prune, changes: changes.map(describeChange) },
|
|
435
|
+
reason: "Automations run on their own, on your machines, until you turn them off.",
|
|
436
|
+
});
|
|
437
|
+
if (approved)
|
|
438
|
+
return "approved";
|
|
439
|
+
return approvals.list().find((request) => request.id === id)?.status === "expired" ? "expired" : "rejected";
|
|
440
|
+
},
|
|
441
|
+
applied: (proposal) => {
|
|
442
|
+
const record = openSessions.get(proposal.sessionId);
|
|
443
|
+
if (!record)
|
|
444
|
+
return;
|
|
445
|
+
const lines = proposal.changes.map(describeChange);
|
|
446
|
+
const text = `Applied automations from ${proposal.file}:\n${lines.join("\n")}`.slice(0, MAX_NOTICE_TEXT);
|
|
447
|
+
const notice = { id: `notice-${randomBytes(8).toString("hex")}`, text };
|
|
448
|
+
eventLog.appendNotice(record.id, { afterMessageCount: record.session.getMessages().length, notice });
|
|
449
|
+
broadcast(stampSessionEvent({ type: "session.event", sessionId: record.id, event: { type: "notice", id: notice.id, notice } }));
|
|
450
|
+
// Nobody was asked: make sure the user hears about it.
|
|
451
|
+
if (approvalMode === "never") {
|
|
452
|
+
void sendNotificationHint({ kind: "agent_notice", sessionId: record.id, targetSessionId: record.id, title: sessionNotifyLabel(record), body: `Changed ${lines.length} automation${lines.length === 1 ? "" : "s"} on your account — tap to see what.` });
|
|
453
|
+
}
|
|
454
|
+
},
|
|
455
|
+
});
|
|
404
456
|
questionManager.onRequest((request) => {
|
|
405
457
|
scheduleAdvertise();
|
|
406
458
|
broadcast({ type: "session.question", sessionId: request.sessionId, requestId: request.id, questions: request.questions, createdAt: request.createdAt });
|
|
@@ -9397,7 +9449,14 @@ app.post("/api/auth/bootstrap", sensitiveRateLimiter, (req, res) => {
|
|
|
9397
9449
|
});
|
|
9398
9450
|
// All other /api routes require auth (loopback may bypass, per config and host
|
|
9399
9451
|
// — see loopbackAllowed()/isMultiUserHost() in src/auth.ts).
|
|
9400
|
-
app.use("/api", authMiddleware(identity
|
|
9452
|
+
app.use("/api", authMiddleware(identity, {
|
|
9453
|
+
verify: sessionTokens.verify,
|
|
9454
|
+
claims: isSessionToken,
|
|
9455
|
+
allows: sessionTokenAllows,
|
|
9456
|
+
// What an agent did through Bivy, per session (`bivy audit --session <id>`).
|
|
9457
|
+
used: (sessionId, call) => { if (call.method !== "GET")
|
|
9458
|
+
auditLog.record({ kind: "agent.call", session: sessionId, tool: `${call.method} ${call.path}` }); },
|
|
9459
|
+
}));
|
|
9401
9460
|
// Reload relay.json without forcing the user to restart the whole node. This is
|
|
9402
9461
|
// used by `bivy relay:setup` after it enrolls the node.
|
|
9403
9462
|
app.post("/api/relay/reload", (_req, res) => {
|
|
@@ -11589,6 +11648,23 @@ app.post("/api/session/:id/ask/:askId/wait", async (req, res) => {
|
|
|
11589
11648
|
return res.status(404).json({ error: "Question not found" });
|
|
11590
11649
|
res.json(result);
|
|
11591
11650
|
});
|
|
11651
|
+
// `bivy automation apply` inside a session: propose, and follow the proposal.
|
|
11652
|
+
app.post("/api/session/:id/automations/apply", async (req, res) => {
|
|
11653
|
+
const record = openSessions.get(String(req.params.id));
|
|
11654
|
+
if (!record)
|
|
11655
|
+
return res.status(404).json({ error: "Session not found" });
|
|
11656
|
+
const file = typeof req.body?.file === "string" && req.body.file.trim() ? req.body.file.trim() : ".bivy/automations.yaml";
|
|
11657
|
+
const result = await automationProposals.propose(record.id, harnessDirFor(record), file, req.body?.prune === true);
|
|
11658
|
+
if ("error" in result)
|
|
11659
|
+
return res.status(400).json({ error: result.error });
|
|
11660
|
+
res.status(201).json(result);
|
|
11661
|
+
});
|
|
11662
|
+
app.get("/api/session/:id/automations/apply/:proposalId", (req, res) => {
|
|
11663
|
+
const proposal = automationProposals.get(String(req.params.id), String(req.params.proposalId));
|
|
11664
|
+
if (!proposal)
|
|
11665
|
+
return res.status(404).json({ error: "Proposal not found" });
|
|
11666
|
+
res.json(proposal);
|
|
11667
|
+
});
|
|
11592
11668
|
// `bivy suggest "<task>"`: the agent proposes a task the user can start in one
|
|
11593
11669
|
// tap, here or in a parallel session (see packages/web SuggestionCard).
|
|
11594
11670
|
app.post("/api/session/:id/suggest", (req, res) => {
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright (c) 2026 Petter André Sjulstad
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { randomUUID } from "node:crypto";
|
|
6
|
+
/** One line per change, for the card and the CLI. */
|
|
7
|
+
export function describeChange(change) {
|
|
8
|
+
if (change.action === "remove")
|
|
9
|
+
return `Remove ${change.id}`;
|
|
10
|
+
const when = change.schedule?.kind === "cron" ? `${change.schedule.expression} (${change.schedule.timezone})` : change.schedule?.kind === "once" ? `once at ${change.schedule.at}` : change.trigger ?? "";
|
|
11
|
+
const verb = change.action === "create" ? "Add" : "Update";
|
|
12
|
+
return `${verb} ${change.name ?? change.id}${change.enabled === false ? " (off)" : ""}: ${when}${change.workspace ? ` in ${change.workspace}` : ""}, ${change.agent}, ${change.sandbox}, approvals ${change.approval}`;
|
|
13
|
+
}
|
|
14
|
+
/** `file` resolved inside `workspace`, or an error: an agent can only propose its own workspace's files. */
|
|
15
|
+
export function confinedFile(workspace, file) {
|
|
16
|
+
let root;
|
|
17
|
+
let abs;
|
|
18
|
+
try {
|
|
19
|
+
root = fs.realpathSync(workspace);
|
|
20
|
+
abs = fs.realpathSync(path.resolve(workspace, file));
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return { error: `No such file: ${file}` };
|
|
24
|
+
}
|
|
25
|
+
const rel = path.relative(root, abs);
|
|
26
|
+
if (!rel || rel.startsWith("..") || path.isAbsolute(rel))
|
|
27
|
+
return { error: "The automations file must be inside the session workspace." };
|
|
28
|
+
return { abs, rel };
|
|
29
|
+
}
|
|
30
|
+
const KEEP_MS = 24 * 60 * 60 * 1000;
|
|
31
|
+
export class AutomationProposals {
|
|
32
|
+
deps;
|
|
33
|
+
now;
|
|
34
|
+
proposals = new Map();
|
|
35
|
+
constructor(deps, now = Date.now) {
|
|
36
|
+
this.deps = deps;
|
|
37
|
+
this.now = now;
|
|
38
|
+
}
|
|
39
|
+
/** Check the file, work out the changes, and put the card in front of the user. */
|
|
40
|
+
async propose(sessionId, workspace, file, prune) {
|
|
41
|
+
this.prune();
|
|
42
|
+
const target = confinedFile(workspace, file);
|
|
43
|
+
if ("error" in target)
|
|
44
|
+
return target;
|
|
45
|
+
const dry = await this.deps.runCli(["automation", "apply", target.abs, "--dry-run", "--json", ...(prune ? ["--prune"] : [])], workspace);
|
|
46
|
+
if (dry.code !== 0)
|
|
47
|
+
return { error: (dry.stderr || dry.stdout).trim().replace(/^Automation error: /, "") || "The automations file could not be checked." };
|
|
48
|
+
let changes;
|
|
49
|
+
try {
|
|
50
|
+
changes = JSON.parse(dry.stdout).changes;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return { error: "Unexpected output from automation apply --dry-run." };
|
|
54
|
+
}
|
|
55
|
+
if (!changes.length)
|
|
56
|
+
return { error: "The file has no automations to apply." };
|
|
57
|
+
const proposal = { id: randomUUID(), sessionId, status: "pending", file: target.rel, changes };
|
|
58
|
+
this.proposals.set(proposal.id, proposal);
|
|
59
|
+
void this.deps.requestApproval({ id: proposal.id, sessionId, file: target.rel, changes, prune }).then(async (decision) => {
|
|
60
|
+
if (decision === "approved") {
|
|
61
|
+
const run = await this.deps.runCli(["automation", "apply", target.abs, ...(prune ? ["--prune"] : [])], workspace);
|
|
62
|
+
proposal.status = run.code === 0 ? "applied" : "failed";
|
|
63
|
+
proposal.output = run.stdout.trim();
|
|
64
|
+
if (run.code !== 0)
|
|
65
|
+
proposal.error = run.stderr.trim().replace(/^Automation error: /, "");
|
|
66
|
+
else
|
|
67
|
+
this.deps.applied?.(this.view(proposal));
|
|
68
|
+
}
|
|
69
|
+
else
|
|
70
|
+
proposal.status = decision;
|
|
71
|
+
proposal.settledAt = this.now();
|
|
72
|
+
});
|
|
73
|
+
return this.view(proposal);
|
|
74
|
+
}
|
|
75
|
+
get(sessionId, id) {
|
|
76
|
+
const proposal = this.proposals.get(id);
|
|
77
|
+
return proposal && proposal.sessionId === sessionId ? this.view(proposal) : undefined;
|
|
78
|
+
}
|
|
79
|
+
view({ settledAt: _settledAt, ...proposal }) {
|
|
80
|
+
return structuredClone(proposal);
|
|
81
|
+
}
|
|
82
|
+
prune() {
|
|
83
|
+
for (const [id, proposal] of this.proposals)
|
|
84
|
+
if (proposal.settledAt !== undefined && this.now() - proposal.settledAt > KEEP_MS)
|
|
85
|
+
this.proposals.delete(id);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright (c) 2026 Petter André Sjulstad
|
|
3
|
+
import { createHmac, randomBytes, timingSafeEqual } from "node:crypto";
|
|
4
|
+
/**
|
|
5
|
+
* Session tokens: a credential each agent session gets in its environment
|
|
6
|
+
* ($BIVY_SESSION_TOKEN, via bivySessionEnv) that reaches only that session's
|
|
7
|
+
* own routes. They let `bivy attach`, `notify`, `ask`, `app` and the MCP tools
|
|
8
|
+
* work where the loopback bypass doesn't apply (multi-user hosts,
|
|
9
|
+
* BIVY_REQUIRE_LOCAL_AUTH) and where the agent can't read the node's data dir to
|
|
10
|
+
* mint a device token (sandboxed agents), without handing it the node.
|
|
11
|
+
*
|
|
12
|
+
* A token is `bst_<session id, base64url>.<HMAC-SHA256>` under a key that lives
|
|
13
|
+
* only in the daemon's memory, so it needs no storage and stops working when
|
|
14
|
+
* the daemon restarts (along with the agent processes that held it).
|
|
15
|
+
*/
|
|
16
|
+
const PREFIX = "bst_";
|
|
17
|
+
export function isSessionToken(token) {
|
|
18
|
+
return typeof token === "string" && token.startsWith(PREFIX);
|
|
19
|
+
}
|
|
20
|
+
export function createSessionTokenCodec(key = randomBytes(32)) {
|
|
21
|
+
const mac = (id) => createHmac("sha256", key).update(`bivy-session-token:${id}`).digest("base64url");
|
|
22
|
+
return {
|
|
23
|
+
sign(sessionId) {
|
|
24
|
+
return `${PREFIX}${Buffer.from(sessionId).toString("base64url")}.${mac(sessionId)}`;
|
|
25
|
+
},
|
|
26
|
+
verify(token) {
|
|
27
|
+
if (!isSessionToken(token))
|
|
28
|
+
return undefined;
|
|
29
|
+
const [encoded, signature] = token.slice(PREFIX.length).split(".");
|
|
30
|
+
if (!encoded || !signature)
|
|
31
|
+
return undefined;
|
|
32
|
+
const sessionId = Buffer.from(encoded, "base64url").toString();
|
|
33
|
+
const expected = Buffer.from(mac(sessionId));
|
|
34
|
+
const given = Buffer.from(signature);
|
|
35
|
+
return sessionId && given.length === expected.length && timingSafeEqual(given, expected) ? sessionId : undefined;
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* What a session token may call: its own session's agent-facing routes, and
|
|
41
|
+
* the read-only machine list `bivy delegate machines` needs. `session` says
|
|
42
|
+
* where the request names its session (a path segment or body.sessionId); it
|
|
43
|
+
* must be the token's own. Adding a route is adding a row.
|
|
44
|
+
*/
|
|
45
|
+
export const SESSION_TOKEN_ROUTES = [
|
|
46
|
+
{ method: "GET", path: /^\/api\/session\/([^/]+)\/context$/, session: "path" },
|
|
47
|
+
{ method: "POST", path: /^\/api\/session\/([^/]+)\/(attach|suggest|notify)$/, session: "path" },
|
|
48
|
+
{ method: "POST", path: /^\/api\/session\/([^/]+)\/ask$/, session: "path" },
|
|
49
|
+
{ method: "GET", path: /^\/api\/session\/([^/]+)\/ask\/[^/]+$/, session: "path" },
|
|
50
|
+
{ method: "POST", path: /^\/api\/session\/([^/]+)\/ask\/[^/]+\/wait$/, session: "path" },
|
|
51
|
+
{ method: "POST", path: /^\/api\/session\/([^/]+)\/delegated-runs$/, session: "path" },
|
|
52
|
+
{ method: "GET", path: /^\/api\/session\/([^/]+)\/delegated-runs\/[^/]+$/, session: "path" },
|
|
53
|
+
{ method: "POST", path: /^\/api\/session\/([^/]+)\/delegated-runs\/[^/]+\/wait$/, session: "path" },
|
|
54
|
+
{ method: "POST", path: /^\/api\/session\/([^/]+)\/automations\/apply$/, session: "path" },
|
|
55
|
+
{ method: "GET", path: /^\/api\/session\/([^/]+)\/automations\/apply\/[^/]+$/, session: "path" },
|
|
56
|
+
{ method: "POST", path: /^\/api\/apps\/[a-zA-Z]+$/, session: "body" },
|
|
57
|
+
{ method: "POST", path: /^\/api\/session\/fork$/, session: "body" },
|
|
58
|
+
{ method: "GET", path: /^\/api\/machines$/, session: "none" },
|
|
59
|
+
];
|
|
60
|
+
/** Whether a request made with `sessionId`'s token is one it may make. */
|
|
61
|
+
export function sessionTokenAllows(sessionId, req) {
|
|
62
|
+
for (const route of SESSION_TOKEN_ROUTES) {
|
|
63
|
+
if (route.method !== req.method)
|
|
64
|
+
continue;
|
|
65
|
+
const match = route.path.exec(req.path);
|
|
66
|
+
if (!match)
|
|
67
|
+
continue;
|
|
68
|
+
if (route.session === "none")
|
|
69
|
+
return true;
|
|
70
|
+
const named = route.session === "path"
|
|
71
|
+
? decodeURIComponent(match[1] ?? "")
|
|
72
|
+
: req.body?.sessionId;
|
|
73
|
+
return named === sessionId;
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bivy/bivy",
|
|
3
|
-
"version": "0.19.4-staging.
|
|
3
|
+
"version": "0.19.4-staging.7",
|
|
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.",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"lodash-es": "4.18.1",
|
|
66
66
|
"undici": "8.11.2"
|
|
67
67
|
},
|
|
68
|
-
"readme": "# Bivy\n\n[](https://www.npmjs.com/package/@bivy/bivy)\n[](LICENSE)\n[](https://nodejs.org)\n\n**Build, try, and review apps from your phone. Your coding agent and dev\nenvironment stay on your own machines.**\n\nBivy is an open-source remote development environment built around coding\nagents. Ask for a change, try the running app, and point to or draw on what\nneeds fixing. Send that feedback to the agent and try again—all in the same\nsession, without going back to your computer.\n\nLive previews bring your app to your phone or browser without deploying it to\nRender, building a Docker image, or setting up a separate preview server.\nShare a preview link so someone else can try it and leave notes, too.\n\nKeep Claude Code, Codex, Pi, OpenCode, or another supported agent. Keep your\nrepos, tools, databases, and development environment. Bivy connects them to\nchat, a terminal, app previews, and code review wherever you are. Start work\nyourself, or let an issue, CI failure, message, schedule, or webhook start it.\n\n**[Start free on Bivy Cloud](https://app.bivy.sh)** ·\n**[Quickstart](docs/quickstart.md)** ·\n**[Documentation](docs/README.md)** ·\n**[Self-host](docs/deploy-images.md)** ·\n**[Website](https://bivy.sh)**\n\n**Recommended:** sign in at [app.bivy.sh](https://app.bivy.sh), then copy your\npersonalized **Connect a Machine** command into a terminal on your Mac or Linux\ncomputer. It installs and enrolls the machine without another Bivy login. The\nbrowser connects automatically; choose a repository and send your first task\nright there.\n\nPrefer starting from the terminal?\n\n```bash\ncurl -fsSL https://bivy.sh/install.sh | bash # install + guided setup\ncd your-repo\nbivy run claude # or codex, pi, opencode\nbivy open # continue in the web app (needs remote setup)\n```\n\nBivy Cloud hosts the app, control plane, and relay—not the machines running your\nagents. Connect a Mac, Linux computer, or existing server and bring your own\nagent subscription, model API key, or local model. You can also self-host the\nentire remote-access stack.\n\n> **Bivy is 0.x software.** Claude Code, Codex, Pi, and OpenCode are the\n> release-tested paths. Credential sync, resume, handoffs, approvals, and\n> sandboxing depend on the runtime. See the\n> [runtime support matrix](docs/runtime-support-matrix.md).\n\n## Build → preview → mark up → iterate\n\nRemote chat lets you ask an agent for a change. Bivy also lets you **use what\nit built and show it what to fix**, without a separate deployment step.\n\n1. **Ask for a change.** The agent works in your repo with your existing tools\n and local services.\n2. **Try the app.** Open a live preview from the session. Use the running app,\n not just a screenshot of what the agent says it finished. Bivy can discover\n dev servers running in the session workspace; tap **Preview** to open one.\n3. **Mark up what needs work.** Point at an element or circle and draw on the\n preview. Add a note, then send the draft to the agent with the element and\n page context. Marked-up screenshots and before/after comparison are available\n when agent screenshots are enabled.\n4. **Iterate and review.** Try the next version, inspect the diff, review checks,\n and decide when the work is ready—not just when the agent stops.\n5. **Bring someone else into the review.** Copy a public preview link so they\n can use the app without a Bivy account and leave notes on specific elements.\n Bring their notes into the session when you're ready to act on them.\n\nOn Bivy Cloud, preview delivery is built in: no per-app domains, certificates,\npublic ports, or tunnels to configure. Self-hosters configure preview delivery\nonce for their Bivy deployment, not for every app. The app still needs its normal\nbuild or dev-server setup, and **the machine serving it must stay awake and\nonline**. These are development previews, not production hosting.\n\n**Share deliberately:** anyone with a preview link can use that app, including\nits live backend. Links expire after 24 hours and can be revoked sooner.\nReviewer notes aren't sent to the agent automatically; you send them or explicitly\nallow agent access. Preview traffic uses HTTPS through the preview relay, not\nsession end-to-end encryption; the relay operator can see it.\n\n[App previews, visual feedback, and sharing →](docs/apps.md)\n\n## Your agents and machines, one workspace\n\n| Capability | What it means for you |\n|---|---|\n| **One workspace, multiple agents** | Use different agents and models for different tasks without maintaining a separate workflow for each. |\n| **Your machines and environment** | Work beside your existing repos, dev servers, databases, private networks, toolchains, and GPUs. |\n| **Automations and triggers** | Let issues, failed CI, messages, schedules, and webhooks start work instead of copying requests into a chat. |\n| **Encrypted key and OAuth sync** | Reuse Bivy-managed provider credentials across enrolled machines and compatible runtimes, with less repeated setup. |\n| **Live sessions from anywhere** | Build and review from your phone, browser, or terminal; answer questions and approve supported actions in the same session. |\n| **Live app previews** | Try the running app without deploying it to a separate hosting service. |\n| **Visual feedback and sharing** | Point, draw, and send specific feedback to the agent; share a preview link for outside review. |\n| **Reviewable results** | Inspect the app, changes, declared checks, artifacts, and pull requests—not just an agent's claim that it finished. |\n| **Hosted convenience or self-hosting** | Use Bivy Cloud for managed remote access, or run the same open-source core yourself. |\n\n## One workflow, from trigger to review\n\n```text\nPrompt · GitHub issue · CI failure · Linear · Slack · Schedule · Webhook\n │\n ▼\n Choose machine + agent + model\n + supported credentials\n │\n ▼\n Live agent session\n Join · steer · approve · stop\n │\n ▼\n Try app · inspect changes · checks\n │\n ▼\n Mark up · send feedback · iterate\n │\n ▼\n Share preview · review PR\n```\n\nA **Machine** is a computer or server you connect. A **Session** is live agent\nwork on that machine. A **Run** is delegated background work that creates a\nsession and tracks its outcome. An **Automation** is a reusable definition that\ncreates runs when an event matches.\n\nManual and automated work use the same kind of live session. You can join a run\nwhen it needs help rather than wait for a black-box job to finish.\n\n### Work in the environment you already have\n\nA clean cloud sandbox isn't always enough. Your agent may need the database\nrunning on localhost, an uncommitted change, an internal API behind your VPN,\nor a model running on your GPU. Bivy runs the agent where those things already\nexist, subject to that machine's permissions and the runtime's protection.\n\nConnect several machines to the same account: a laptop for interactive work,\na Linux server for background jobs, or a GPU box for local inference. Choose\nthe machine for each session or pin it in an automation. Repository runs can\nuse isolated Git worktrees without rebuilding the whole development environment.\n\n**The execution machine must stay awake and online.** To close your laptop and\nleave work running, run the agent on a different, always-on machine.\n\n[Environment and multi-machine recipes →](docs/capability-recipes.md)\n\n### Use multiple agents, not multiple disconnected workflows\n\nRun Claude Code for one task, Codex for another, and Pi or OpenCode where they\nfit. Bivy supplies the shared session, remote-access, automation, and review\nsurfaces; your chosen agent still does the coding and uses your model provider.\n\n- Choose an agent and, where supported, a model for each session or run.\n- Import existing Claude Code and Codex sessions.\n- Fork or move work to another agent or machine when a different setup fits\n better. Continuation fidelity varies: some paths preserve native history,\n while others replay portable turns or seed the destination with context.\n- Use agent-native logins, Bivy-managed credentials, or local inference.\n Bivy's custom OpenAI-compatible endpoint registry currently feeds Pi;\n other agents may need their own provider configuration.\n- Register your own ACP or headless process agent with `bivy agent add`.\n\nBivy does not replace your agent, provide model inference, or make every agent's\nfeatures identical. Consult the [support matrix](docs/runtime-support-matrix.md)\nand [handoff recipes](docs/capability-recipes.md#fork-or-move-a-session).\n\n### Less signing in. Less copying secrets.\n\nBivy syncs **Bivy-managed API keys and supported OAuth credentials** across\nenrolled machines for compatible runtimes. Connect supported credentials once\nand reuse them where you run work, rather than manually distributing keys to\neach machine.\n\nFor ordinary account sync, credentials are encrypted on the node before upload.\nThe control plane stores ciphertext and wrapped-key metadata; enrolled nodes\nshare access by wrapping the vault key to one another. Bivy Cloud does not\nreceive plaintext credentials through this sync path.\n\nYou can also keep credentials local, use labeled keys and project presets, or\nreference environment variables and 1Password instead of embedding secrets in\nconfiguration:\n\n```bash\nbivy provider login\nbivy credentials add anthropic work\nbivy secrets ref github.repo-token op://Bivy/GitHub/repo-token\n```\n\n**Not every CLI login syncs.** Native agent logins may still be per-machine;\nGitHub App private-key sync is separately opt-in. If you lose every node and\ndevice able to unwrap a vault, you must sign in to providers again. Explicit\nhosted-provisioning custody grants are separate from ordinary encrypted sync.\n\n[Credential sync and runtime coverage →](docs/credential-sync.md) ·\n[Credentials guide →](docs/credentials-guide.md) ·\n[Key storage →](docs/key-management.md)\n\n### Let events start the work\n\nAutomations turn recurring or incoming work into sessions you can join,\nsupervise, and review. Choose the repository, machine, agent, model, approval\nmode, sandbox setting, and maximum attempts.\n\n| Trigger | Example workflow |\n|---|---|\n| **GitHub issues and mentions** | Label an issue `bivy` or `bivy/<machine>`, or mention your Bivy GitHub App, to work toward a pull request. |\n| **Failed CI** | Match a failed workflow, ask the agent to reproduce it, make a fix, and run the affected checks. |\n| **Linear** | Label an issue to start work without copying its description into an agent. |\n| **Slack** | Send a request from the conversation where the work came up. |\n| **Schedules** | Run a weekly dependency review, recurring maintenance, or a one-time task. |\n| **Signed webhooks** | Connect alerts, internal tools, or your own event sources. |\n\nConfigure automations in the app or version them with your repository in\n`.bivy/automations.yaml`:\n\n```bash\nbivy automation init\n# Edit the generated definition for your repository and workflow.\nbivy automation validate\nbivy automation test --event .bivy/events/failed-ci.yaml # supply a local event fixture\nbivy automation apply\n```\n\nOr delegate a one-off job without creating an automation:\n\n```bash\nbivy runs start \"Review outdated dependencies and propose a small, tested update.\"\nbivy runs wait <id>\n```\n\nRuns keep routing and lifecycle evidence, check results, and output references\nin a reviewable Receipt. For unattended issue work, Bivy runs declared repository\nchecks after the agent's turn; failed required checks fail the run even if the\nagent reports success. A completed process alone is not proof that the task\nsucceeded.\n\n[Automation recipes →](docs/capability-recipes.md#let-events-start-runs) ·\n[Automations as code →](docs/automations-as-code.md) ·\n[Run outcomes and reliability limits →](docs/automation-runs.md)\n\n### Start at your desk. Continue anywhere.\n\nOpen the same session in the browser, phone PWA, or terminal. Watch work live,\nanswer questions, approve supported tool calls, or stop the agent.\n\n- Send screenshots, images, logs, and other files from your phone.\n- Download reports and artifacts the agent creates.\n- Open [session apps](docs/apps.md) from chat or the **Apps** menu: live web\n previews, desktop app views, and CLI/TUI tools. Agents can publish views with\n `bivy app publish bivy.app.json` and create share links with `bivy app share`.\n- Use voice input and read-aloud where supported; provider-backed voice may\n send audio or text to the selected provider.\n- Keep a native terminal workflow or use structured chat, depending on the agent.\n\n```bash\nbivy run claude --no-follow # start without attaching\nbivy open # open the web app\nbivy resume # return to the session in your terminal\nbivy link # pair a device directly via QR\n```\n\nNo phone app installation is required. Open [app.bivy.sh](https://app.bivy.sh)\nin your browser; adding it to your home screen is optional.\n\n[Remote access →](docs/remote-access.md) ·\n[Voice, files, and terminal recipes →](docs/capability-recipes.md)\n\n## Get started\n\n### Install\n\nBivy supports **macOS and Linux with Node.js 20+**. The installer installs the\n`@bivy/bivy` package, runs guided setup, and starts a launchd or systemd service:\n\n```bash\ncurl -fsSL https://bivy.sh/install.sh | bash\n```\n\nSetup helps you choose an agent and configure remote access. Existing agents\nkeep their command, login, and configuration. The installer may use `sudo` to\ninstall a missing Node.js, but never for `npm install`. To inspect it first,\ndownload it with `curl -fsSL https://bivy.sh/install.sh -o install.sh`.\n\nAlready have Node.js and want to avoid sudo?\n\n```bash\nnpm install -g @bivy/bivy\nbivy setup\n```\n\nThen try one small task:\n\n```bash\ncd your-repo\nbivy run claude\n# Ask: \"Explain this repo and make one small, safe improvement. Run the relevant checks.\"\nbivy open\n```\n\nOpen that same session on your phone while it runs. For a web app, ask the agent\nto start its dev server, then open **Apps → Running in this workspace → Preview**.\nTry a page, point to something you'd change, and send the feedback back to the\nagent. No separate preview deployment needed.\n\nOnce that works, share a preview for review, connect another machine, or add\nyour first automation.\n\n**Local-only works too.** `bivy run`, `bivy resume`, and `bivy sessions` need no\naccount or server. Choose **local only for now** during setup; use `bivy login`\nlater. Browser and phone access need a hosted or self-hosted control plane;\nthe node itself does not serve a web UI.\n\n[Full quickstart →](docs/quickstart.md) ·\n[Installer options, service management, and uninstall →](docs/install.md)\n\n### Choose hosted or self-hosted\n\n| Option | What you get |\n|---|---|\n| **Free Cloud — $0** | Every launch feature, including automations; 10 new remote sessions per rolling seven days. No credit card required. |\n| **Cloud — $15/month** | The same features with unlimited remote sessions. |\n| **Self-hosted Core** | Operate the app, control plane, and relay yourself, with no Bivy usage limits. |\n\nManual and automated sessions share the Cloud allowance. Resuming existing\nsessions and viewing history do not consume it. Agent subscriptions and model\nprovider charges are separate. See [current pricing](https://bivy.sh#pricing).\n\n**Self-host anywhere:** deploy the public control-plane (including the web app)\nand relay images with Postgres and [a small set of environment variables](docs/deploy-images.md).\nYour server or container platform handles HTTPS. Set up owner access in the\nbrowser—no SSH, external authentication provider, or Bivy Cloud account required.\nFor a bare VPS, the [Compose installer](docs/self-host-quickstart.md) automates the\nsame stack. These onboarding features require a release containing them.\n\nStart on Cloud and self-host later if you prefer. Deploy the stack, reconnect\nmachines with `bivy relay:setup`, and pair devices to your server. This is not a\none-click migration of your Cloud account; your local repos and agent\nconfiguration stay in place.\n\n```bash\nbivy relay:setup \\\n --control-plane https://bivy.example.com \\\n --relay wss://relay.example.com\n```\n\nSelf-hosting is community-supported: you own TLS, backups, upgrades, and\nhardening. Public multi-architecture images are available as\n`ghcr.io/bivysh/bivy-control-plane` and `ghcr.io/bivysh/bivy-relay`; pin a release\nversion or full commit SHA.\n\n[Deploy the images anywhere →](docs/deploy-images.md) ·\n[Optional VPS installer →](docs/self-host-quickstart.md) ·\n[Operations reference →](docs/self-host.md)\n\n## Architecture\n\nYour environment, with clear security boundaries:\n\n```text\nYour machine Hosted or self-hosted\n┌──────────────────────┐ ┌──────────────────────┐\n│ Node daemon │──outbound──▶│ Relay │\n│ Agents, repos, tools │ │ Encrypted frames │\n│ Local credentials │ └──────────┬───────────┘\n└──────────────────────┘ │\n Browser / phone\n + control plane\n (app, accounts, metadata)\n```\n\n- **Execution stays on your machine.** Bivy Cloud does not run your agents.\n Your model provider still sees whatever the agent sends it.\n- **Interactive session traffic is end-to-end encrypted** between the node and\n paired devices. The relay forwards opaque session frames; your node dials out,\n so no inbound public port is required.\n- **App previews have a separate security boundary.** Preview traffic uses HTTPS\n and an outbound tunnel, not session E2E encryption. The preview ingress/relay\n operator can see it. Public preview links grant anyone holding them access to\n that view and its live backend until expiry or revocation. See\n [preview security and sharing](docs/apps.md#runtime-and-security-boundaries).\n- **Ordinary credential sync uploads ciphertext, not plaintext keys.**\n Supported credentials and recovery limits are documented separately.\n- **Encryption is not universal across integrations.** Slack commands and\n generic webhook instructions reach the control plane in plaintext. Do not\n put secrets in them. Routing and bounded run metadata are also visible there.\n- **Device authorization matters.** QR pairing authorizes a device directly\n through the node. Hosted account pairing trusts the control plane to authorize\n devices and serve the web app that holds client keys.\n- **Bivy is not an OS-level sandbox.** The default approval mode is\n `autonomous`; protection depends on the runtime. Some agents enforce sandbox\n tiers, while process agents may run with your full user permissions.\n Heuristic tool checks help prevent accidents but are not isolation.\n\nReview the runtime's Protection label and configure approval/sandbox settings\nfor the task, especially before enabling unattended work.\n\n[Security model and known limitations →](docs/security-model.md) ·\n[Runtime protection matrix →](docs/runtime-support-matrix.md) ·\n[Configuration →](docs/configuration.md)\n\n## Agents and everyday commands\n\n**Claude Code, Codex, Pi, and OpenCode are release-tested.** Additional adapters\ninclude Gemini CLI, Qwen Code, Goose, Aider, Cline, Crush, Cursor, GitHub Copilot,\nGrok, Amp, Auggie, Droid, Continue, Kilo Code, and Rovo Dev. Installation,\nresume, model selection, and tool protection vary—see the\n[support matrix](docs/runtime-support-matrix.md) and [agent guides](docs/agents/README.md).\n\nRun an arbitrary command with `bivy run -- ./your-agent --flags`, register a\nreusable entry with `bivy agent add`, or package a declarative integration with\nexperimental [plugins](docs/plugins.md).\n\n```bash\nbivy run claude # launch a durable session; also codex, pi, opencode\nbivy sessions # list live and saved sessions\nbivy resume # resume the most recent session\nbivy open # open the web app (requires remote setup)\nbivy nodes # list connected account machines\nbivy runs list # inspect delegated work\nbivy automation init # scaffold repo-owned automations\nbivy provider login # connect supported model credentials\nbivy agent add # register an ACP or process agent\nbivy doctor # check installation and connectivity\nbivy logs -f # follow node logs\nbivy update # update and restart the service\n```\n\n`bivy update` uses your original installation method and waits for an active\nturn to finish before restarting. Use `--force` to skip that wait.\n\n[CLI reference →](docs/cli-reference.md) ·\n[Node and project configuration →](docs/config-as-code.md) ·\n[GitHub setup →](docs/github-setup.md) ·\n[Linear setup →](docs/linear-work-queue.md)\n\n## Development and contributions\n\n```bash\npnpm install\npnpm run dev # node daemon on http://localhost:4317\npnpm run dev:web # web client dev server\n```\n\n| Directory | Contents |\n|---|---|\n| `src/`, `bin/` | Node daemon, CLI, runtime adapters, sessions, approvals, secrets |\n| `packages/core/` | Shared protocol, pairing, and wire format |\n| `packages/web/`, `packages/ui/` | React PWA and shared design system |\n| `services/relay/` | Self-hostable encrypted relay |\n| `services/control-plane/` | Self-hostable control plane |\n| `deploy/` | Deployment examples |\n\n```bash\npnpm run typecheck\npnpm run typecheck:web\npnpm run lint\npnpm run test:unit\npnpm run test:core\npnpm run check:licenses\npnpm run check:secrets\n```\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for the development workflow. Releases\nare published from CI with provenance attestations; see\n[release verification](docs/releasing.md).\n\n**Found a security issue?** Use\n[GitHub private vulnerability reporting](https://github.com/bivysh/bivy/security/advisories/new),\nnot a public issue. See [SECURITY.md](SECURITY.md).\n\n### In development—not available at launch\n\nAutomatically provisioned, short-lived **ephemeral machines** are in development\nfor hosted and bring-your-own-cloud deployments. Neither path is ready or\nsupported for this launch. Use an existing computer or server you operate.\nExperimental provisioning has different credential-custody and encryption\nboundaries; see the [provisioning trust model](docs/hosted-provisioning-trust-model.md).\n\n## License\n\nEverything in this repository—node, CLI, web/PWA, relay, and control plane—is\nfree and open-source **AGPL-3.0-only Core**, with no Bivy usage limits. You may\nuse, modify, and self-host it under that license. If users interact with your\nmodified version over a network, section 13 requires you to offer its\ncorresponding source. See [LICENSE](LICENSE).\n\nBivy Cloud is the hosted operation of that stack plus billing and plans, in a\nseparate private repository. Contributions use the\n[DCO](CONTRIBUTING.md#certificate-of-origin); there is no CLA.\n",
|
|
68
|
+
"readme": "# Bivy\n\n[](https://www.npmjs.com/package/@bivy/bivy)\n[](LICENSE)\n[](https://nodejs.org)\n\n**Local coding agents that show their work. Anywhere.**\n\nBivy is the open-source workspace for coding agents. It runs Claude Code, Codex,\nPi, OpenCode and other agents on your own machine. Reach them from a browser or\nyour phone, with the live session, its terminal, its approvals, and the app\nthey're building right in the chat. Try it, mark what's wrong, and send it back.\n\nBivy is not another coding agent and not a cloud development machine. The agent\nstays local and does the coding with your model provider. Your repos, tools,\ndatabases, and services stay where they are. Bivy gives you remote access to all\nof it, plus live previews, automations, and review.\n\n- **Live previews.** The running app beside the chat. Mark it, send it back,\n share it with someone who has no Bivy account.\n- **Automations.** GitHub issues, failed CI, Linear, Slack, schedules, and\n webhooks start the work. It comes back as a preview link or a pull request.\n- **Any agent.** Hit a usage limit? Fork the session to another agent, or let\n Bivy retry when the limit resets.\n- **Your machine, anywhere.** Start at your desk, pick the session up on your\n phone. The machine dials out, so there are no ports to open, and session\n traffic is end-to-end encrypted.\n\n**[Start free on Bivy Cloud](https://app.bivy.sh)** ·\n**[Quickstart](docs/quickstart.md)** ·\n**[Documentation](docs/README.md)** ·\n**[Self-host](docs/deploy-images.md)** ·\n**[Website](https://bivy.sh)**\n\n**Recommended:** sign in at [app.bivy.sh](https://app.bivy.sh), then copy your\npersonalized **Connect a Machine** command into a terminal on your Mac or Linux\ncomputer. It installs and enrolls the machine without another Bivy login. The\nbrowser connects automatically; choose a repository and send your first task\nright there.\n\nPrefer starting from the terminal?\n\n```bash\ncurl -fsSL https://bivy.sh/install.sh | bash # install + guided setup\ncd your-repo\nbivy run claude # or codex, pi, opencode\nbivy open # continue in the web app (needs remote setup)\n```\n\nBivy Cloud hosts the app, control plane, and relay—not the machines running your\nagents. Connect a Mac, Linux computer, or existing server and bring your own\nagent subscription, model API key, or local model. You can also self-host the\nentire remote-access stack.\n\n> **Bivy is 0.x software.** Claude Code, Codex, Pi, OpenCode, and Grok are the\n> release-tested paths. Credential sync, resume, handoffs, approvals, and\n> sandboxing depend on the runtime. See the\n> [runtime support matrix](docs/runtime-support-matrix.md).\n\n## Don't just read the diff. Try the app.\n\nBivy lets you **use what the agent built and show it what to fix**, without a\nseparate deployment step.\n\n1. **Ask for a change.** The agent works in your repo with your existing tools\n and local services.\n2. **Try the app.** Bivy finds the dev server the agent starts and opens it\n beside the chat: web apps, terminals, and desktop apps. Use the running app,\n not a screenshot of what the agent says it finished.\n3. **Mark what needs work.** Press and hold anything in the preview to mark it,\n or drag to circle it, then say what you want. **Mark another** keeps\n separate notes separate. The marks go to the agent with the element and page\n context. No screenshots to paste.\n4. **Follow each note.** Every mark stays in the chat as a pin that resolves\n itself: **Changed** when a later run changes what you marked, **Element\n gone** when it leaves the page, **Done** when you say so.\n5. **Review the next version.** A new version waits on the preview pill instead\n of reloading under you. Take it when you're ready, compare before and after,\n inspect the diff and checks, and decide when the work is done.\n6. **Get a second opinion.** Share a preview link for 1 hour, 1 day, or 7 days.\n Teammates and clients try the running app and leave notes without a Bivy\n account. Make it view-only, or **Stop sharing** to end every link at once.\n\nOn Bivy Cloud, preview delivery is built in: no per-app domains, certificates,\npublic ports, or tunnels to configure. Self-hosters configure preview delivery\nonce for their Bivy deployment, not for every app. The app still needs its normal\nbuild or dev-server setup, and **the machine serving it must stay awake and\nonline**. These are development previews, not production hosting.\n\n**Share deliberately:** anyone with a preview link can use that app, including\nits live backend, until the link expires or you stop sharing.\nReviewer notes aren't sent to the agent automatically; you send them or explicitly\nallow agent access. Preview traffic uses HTTPS through the preview relay, not\nsession end-to-end encryption; the relay operator can see it.\n\n[App previews, visual feedback, and sharing →](docs/apps.md)\n\n## One workflow, from trigger to review\n\n```text\nPrompt · GitHub issue · CI failure · Linear · Slack · Schedule · Webhook\n │\n ▼\n Choose machine + agent + model\n + supported credentials\n │\n ▼\n Live agent session\n Join · steer · approve · stop\n │\n ▼\n Try app · inspect changes · checks\n │\n ▼\n Mark up · send feedback · iterate\n │\n ▼\n Share preview · review PR\n```\n\nA **Machine** is a computer or server you connect. A **Session** is live agent\nwork on that machine. A **Run** is delegated background work that creates a\nsession and tracks its outcome. An **Automation** is a reusable definition that\ncreates runs when an event matches.\n\nManual and automated work use the same kind of live session. You can join a run\nwhen it needs help rather than wait for a black-box job to finish.\n\n### Let events start the work\n\nAutomations turn recurring or incoming work into sessions you can join,\nsupervise, and review. An agent picks the task up on your machine and posts\nback a preview link or a pull request, so you try the result where the task\nlives and reply in the same session. Choose the repository, machine, agent,\nmodel, approval mode, sandbox setting, and maximum attempts.\n\n| Trigger | Example workflow |\n|---|---|\n| **GitHub issues and mentions** | Label an issue `bivy` or `bivy/<machine>`, or mention your Bivy GitHub App, to work toward a pull request. |\n| **Failed CI** | Match a failed workflow, ask the agent to reproduce it, make a fix, and run the affected checks. |\n| **Linear** | Label an issue to start work without copying its description into an agent. |\n| **Slack** | Send a request from the conversation where the work came up. |\n| **Schedules** | Run a weekly dependency review, recurring maintenance, or a one-time task. |\n| **Signed webhooks** | Connect alerts, internal tools, or your own event sources. |\n\nConfigure automations in the app or version them with your repository in\n`.bivy/automations.yaml`:\n\n```bash\nbivy automation init\n# Edit the generated definition for your repository and workflow.\nbivy automation validate\nbivy automation test --event .bivy/events/failed-ci.yaml # supply a local event fixture\nbivy automation apply\n```\n\nOr delegate a one-off job without creating an automation:\n\n```bash\nbivy runs start \"Review outdated dependencies and propose a small, tested update.\"\nbivy runs wait <id>\n```\n\nRuns keep routing and lifecycle evidence, check results, and output references\nin a reviewable Receipt. For unattended issue work, Bivy runs declared repository\nchecks after the agent's turn; failed required checks fail the run even if the\nagent reports success. A completed process alone is not proof that the task\nsucceeded.\n\n[Automation recipes →](docs/capability-recipes.md#let-events-start-runs) ·\n[Automations as code →](docs/automations-as-code.md) ·\n[Run outcomes and reliability limits →](docs/automation-runs.md)\n\n### Use every agent you pay for. Switch mid-task.\n\nRun Claude Code for one task, Codex for another, and Pi or OpenCode where they\nfit, side by side in one session list. Bivy supplies the shared session,\nremote-access, automation, and review surfaces; your chosen agent still does\nthe coding and uses your model provider.\n\n- **Hit a usage limit? Keep going.** When a turn fails on a limit, fork the\n session, with its code and conversation, to another agent and model, or let\n Bivy retry when the limit resets (the provider has to report a reset time).\n- **Get a second opinion.** `bivy delegate` hands a task to another agent, on\n the same machine or a different one, and brings back its answer, branch, and\n PR. `--to codex,claude@linux` sends one task to several agents to compare.\n- Choose an agent and, where supported, a model for each session or run.\n- Import existing Claude Code and Codex sessions.\n- Fork or move work to another agent or machine when a different setup fits\n better. Continuation fidelity varies: some paths preserve native history,\n while others replay portable turns or hand over a summary with the earlier\n transcript as a local file.\n- Use agent-native logins, Bivy-managed credentials, or local inference.\n Bivy's custom OpenAI-compatible endpoint registry currently feeds Pi;\n other agents may need their own provider configuration.\n- Register your own ACP or headless process agent with `bivy agent add`.\n\nBivy does not replace your agent, provide model inference, or make every agent's\nfeatures identical. Consult the [support matrix](docs/runtime-support-matrix.md)\nand [handoff recipes](docs/capability-recipes.md#fork-or-move-a-session).\n\n### Less signing in. Less copying secrets.\n\nBivy syncs **Bivy-managed API keys and supported OAuth credentials** across\nenrolled machines for compatible runtimes. Connect supported credentials once\nand reuse them where you run work, rather than manually distributing keys to\neach machine.\n\nFor ordinary account sync, credentials are encrypted on the node before upload.\nThe control plane stores ciphertext and wrapped-key metadata; enrolled nodes\nshare access by wrapping the vault key to one another. Bivy Cloud does not\nreceive plaintext credentials through this sync path.\n\nYou can also keep credentials local, use labeled keys and project presets, or\nreference environment variables and 1Password instead of embedding secrets in\nconfiguration:\n\n```bash\nbivy provider login\nbivy credentials add anthropic work\nbivy secrets ref github.repo-token op://Bivy/GitHub/repo-token\n```\n\n**Not every CLI login syncs.** Native agent logins may still be per-machine;\nGitHub App private-key sync is separately opt-in. If you lose every node and\ndevice able to unwrap a vault, you must sign in to providers again. Explicit\nhosted-provisioning custody grants are separate from ordinary encrypted sync.\n\n[Credential sync and runtime coverage →](docs/credential-sync.md) ·\n[Credentials guide →](docs/credentials-guide.md) ·\n[Key storage →](docs/key-management.md)\n\n### Work in the environment you already have\n\nA clean cloud sandbox isn't always enough. Your agent may need the database\nrunning on localhost, an uncommitted change, an internal API behind your VPN,\nor a model running on your GPU. Bivy runs the agent where those things already\nexist, subject to that machine's permissions and the runtime's protection.\n\nConnect several machines to the same account: a laptop for interactive work,\na Linux server for background jobs, or a GPU box for local inference. Choose\nthe machine for each session or pin it in an automation. Repository runs can\nuse isolated Git worktrees without rebuilding the whole development environment.\n\n**The execution machine must stay awake and online.** To close your laptop and\nleave work running, run the agent on a different, always-on machine.\n\n[Environment and multi-machine recipes →](docs/capability-recipes.md)\n\n### Start at your desk. Continue anywhere.\n\nOpen the same session in the browser, phone PWA, or terminal. Watch work live,\nanswer questions, approve supported tool calls, or stop the agent.\n\n- Send screenshots, images, logs, and other files from your phone.\n- Download reports and artifacts the agent creates.\n- Open [session apps](docs/apps.md) from chat or the **Apps** menu: live web\n previews, desktop app views, and CLI/TUI tools. Agents can publish views with\n `bivy app publish bivy.app.json` and create share links with `bivy app share`.\n- Use voice input and read-aloud where supported; provider-backed voice may\n send audio or text to the selected provider.\n- Keep a native terminal workflow or use structured chat, depending on the agent.\n\n```bash\nbivy run claude --no-follow # start without attaching\nbivy open # open the web app\nbivy resume # return to the session in your terminal\nbivy link # pair a device directly via QR\n```\n\nNo phone app installation is required. Open [app.bivy.sh](https://app.bivy.sh)\nin your browser; adding it to your home screen is optional.\n\n[Remote access →](docs/remote-access.md) ·\n[Voice, files, and terminal recipes →](docs/capability-recipes.md)\n\n### Agents can reach you, too\n\nEvery session gets the `bivy` CLI, so any agent with a shell can talk back\nthrough the app, not only agents with their own built-in tools:\n\n```bash\nbivy notify \"Tests are green, PR is up\" # chat card + phone push when you're away\nbivy ask \"Ship to staging?\" --option Yes --option No # waits for your answer\nbivy attach report.png --caption \"Before/after\" # show a file in the chat\nbivy suggest \"Add a dark theme to settings\" # a next task you start in one tap\nbivy context --json # session, workspace, machine, apps\n```\n\n`bivy help --json` lists every command, and with `BIVY_OUTPUT=json` failures\ncome back as structured errors with distinct exit codes, so an agent can tell\nwhat went wrong and what to run next. `bivy guide` prints short playbooks for\nagents, and the same commands are served as MCP tools for agents that prefer\nthem. Add your own standing instructions for\nevery session in **Settings → Agent instructions**.\n\n[Commands for agents inside a session →](docs/cli-reference.md#inside-an-agent-session) ·\n[Agent instructions →](docs/agent-instructions.md)\n\n## Get started\n\n### Install\n\nBivy supports **macOS and Linux with Node.js 20+**. The installer installs the\n`@bivy/bivy` package, runs guided setup, and starts a launchd or systemd service:\n\n```bash\ncurl -fsSL https://bivy.sh/install.sh | bash\n```\n\nSetup helps you choose an agent and configure remote access. Existing agents\nkeep their command, login, and configuration. The installer may use `sudo` to\ninstall a missing Node.js, but never for `npm install`. To inspect it first,\ndownload it with `curl -fsSL https://bivy.sh/install.sh -o install.sh`.\n\nAlready have Node.js and want to avoid sudo?\n\n```bash\nnpm install -g @bivy/bivy\nbivy setup\n```\n\nThen try one small task:\n\n```bash\ncd your-repo\nbivy run claude\n# Ask: \"Explain this repo and make one small, safe improvement. Run the relevant checks.\"\nbivy open\n```\n\nOpen that same session on your phone while it runs. For a web app, ask the agent\nto start its dev server, then open **Apps → Running in this workspace → Preview**.\nTry a page, point to something you'd change, and send the feedback back to the\nagent. No separate preview deployment needed.\n\nOnce that works, share a preview for review, connect another machine, or add\nyour first automation.\n\n**Local-only works too.** `bivy run`, `bivy resume`, and `bivy sessions` need no\naccount or server. Choose **local only for now** during setup; use `bivy login`\nlater. Browser and phone access need a hosted or self-hosted control plane;\nthe node itself does not serve a web UI.\n\n[Full quickstart →](docs/quickstart.md) ·\n[Installer options, service management, and uninstall →](docs/install.md)\n\n### Choose hosted or self-hosted\n\n| Option | What you get |\n|---|---|\n| **Free Cloud — $0** | Every launch feature, including automations; 10 new remote sessions per rolling seven days. No credit card required. |\n| **Cloud — $15/month** | The same features with unlimited remote sessions. |\n| **Self-hosted Core** | Operate the app, control plane, and relay yourself, with no Bivy usage limits. |\n\nManual and automated sessions share the Cloud allowance. Resuming existing\nsessions and viewing history do not consume it. Agent subscriptions and model\nprovider charges are separate. See [current pricing](https://bivy.sh#pricing).\n\n**Self-host anywhere:** deploy the public control-plane (including the web app)\nand relay images with Postgres and [a small set of environment variables](docs/deploy-images.md).\nYour server or container platform handles HTTPS. Set up owner access in the\nbrowser—no SSH, external authentication provider, or Bivy Cloud account required.\nFor a bare VPS, the [Compose installer](docs/self-host-quickstart.md) automates the\nsame stack. These onboarding features require a release containing them.\n\nStart on Cloud and self-host later if you prefer. Deploy the stack, reconnect\nmachines with `bivy relay:setup`, and pair devices to your server. This is not a\none-click migration of your Cloud account; your local repos and agent\nconfiguration stay in place.\n\n```bash\nbivy relay:setup \\\n --control-plane https://bivy.example.com \\\n --relay wss://relay.example.com\n```\n\nSelf-hosting is community-supported: you own TLS, backups, upgrades, and\nhardening. Public multi-architecture images are available as\n`ghcr.io/bivysh/bivy-control-plane` and `ghcr.io/bivysh/bivy-relay`; pin a release\nversion or full commit SHA.\n\n[Deploy the images anywhere →](docs/deploy-images.md) ·\n[Optional VPS installer →](docs/self-host-quickstart.md) ·\n[Operations reference →](docs/self-host.md)\n\n## Architecture\n\nYour environment, with clear security boundaries:\n\n```text\nYour machine Hosted or self-hosted\n┌──────────────────────┐ ┌──────────────────────┐\n│ Node daemon │──outbound──▶│ Relay │\n│ Agents, repos, tools │ │ Encrypted frames │\n│ Local credentials │ └──────────┬───────────┘\n└──────────────────────┘ │\n Browser / phone\n + control plane\n (app, accounts, metadata)\n```\n\n- **Execution stays on your machine.** Bivy Cloud does not run your agents.\n Your model provider still sees whatever the agent sends it.\n- **Interactive session traffic is end-to-end encrypted** between the node and\n paired devices. The relay forwards opaque session frames; your node dials out,\n so no inbound public port is required.\n- **App previews have a separate security boundary.** Preview traffic uses HTTPS\n and an outbound tunnel, not session E2E encryption. The preview ingress/relay\n operator can see it. Public preview links grant anyone holding them access to\n that view and its live backend until expiry or revocation. See\n [preview security and sharing](docs/apps.md#runtime-and-security-boundaries).\n- **Ordinary credential sync uploads ciphertext, not plaintext keys.**\n Supported credentials and recovery limits are documented separately.\n- **Encryption is not universal across integrations.** Slack commands and\n generic webhook instructions reach the control plane in plaintext. Do not\n put secrets in them. Routing and bounded run metadata are also visible there.\n- **Device authorization matters.** QR pairing authorizes a device directly\n through the node. Hosted account pairing trusts the control plane to authorize\n devices and serve the web app that holds client keys.\n- **Bivy is not an OS-level sandbox.** The default approval mode is\n `autonomous`; protection depends on the runtime. Some agents enforce sandbox\n tiers, while process agents may run with your full user permissions.\n Heuristic tool checks help prevent accidents but are not isolation.\n\nReview the runtime's Protection label and configure approval/sandbox settings\nfor the task, especially before enabling unattended work.\n\n[Security model and known limitations →](docs/security-model.md) ·\n[Runtime protection matrix →](docs/runtime-support-matrix.md) ·\n[Configuration →](docs/configuration.md)\n\n## Agents and everyday commands\n\n**Claude Code, Codex, Pi, OpenCode, and Grok are release-tested.** Additional\nadapters include Gemini CLI, Qwen Code, Goose, Aider, Cline, Crush, Cursor, GitHub\nCopilot, Amp, Auggie, Droid, Continue, Kilo Code, and Rovo Dev. Installation,\nresume, model selection, and tool protection vary—see the\n[support matrix](docs/runtime-support-matrix.md) and [agent guides](docs/agents/README.md).\n\nRun an arbitrary command with `bivy run -- ./your-agent --flags`, register a\nreusable entry with `bivy agent add`, or package a declarative integration with\nexperimental [plugins](docs/plugins.md).\n\n```bash\nbivy run claude # launch a durable session; also codex, pi, opencode\nbivy sessions # list live and saved sessions\nbivy resume # resume the most recent session\nbivy open # open the web app (requires remote setup)\nbivy nodes # list connected account machines\nbivy runs list # inspect delegated work\nbivy automation init # scaffold repo-owned automations\nbivy provider login # connect supported model credentials\nbivy agent add # register an ACP or process agent\nbivy doctor # check installation and connectivity\nbivy logs -f # follow node logs\nbivy update # update and restart the service\n```\n\n`bivy update` uses your original installation method and waits for an active\nturn to finish before restarting. Use `--force` to skip that wait.\n\n[CLI reference →](docs/cli-reference.md) ·\n[Node and project configuration →](docs/config-as-code.md) ·\n[GitHub setup →](docs/github-setup.md) ·\n[Linear setup →](docs/linear-work-queue.md)\n\n## Development and contributions\n\n```bash\npnpm install\npnpm run dev # node daemon on http://localhost:4317\npnpm run dev:web # web client dev server\n```\n\n| Directory | Contents |\n|---|---|\n| `src/`, `bin/` | Node daemon, CLI, runtime adapters, sessions, approvals, secrets |\n| `packages/core/` | Shared protocol, pairing, and wire format |\n| `packages/web/`, `packages/ui/` | React PWA and shared design system |\n| `services/relay/` | Self-hostable encrypted relay |\n| `services/control-plane/` | Self-hostable control plane |\n| `deploy/` | Deployment examples |\n\n```bash\npnpm run typecheck\npnpm run typecheck:web\npnpm run lint\npnpm run test:unit\npnpm run test:core\npnpm run check:licenses\npnpm run check:secrets\n```\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for the development workflow. Releases\nare published from CI with provenance attestations; see\n[release verification](docs/releasing.md).\n\n**Found a security issue?** Use\n[GitHub private vulnerability reporting](https://github.com/bivysh/bivy/security/advisories/new),\nnot a public issue. See [SECURITY.md](SECURITY.md).\n\n### In development—not available at launch\n\nAutomatically provisioned, short-lived **ephemeral machines** are in development\nfor hosted and bring-your-own-cloud deployments. Neither path is ready or\nsupported for this launch. Use an existing computer or server you operate.\nExperimental provisioning has different credential-custody and encryption\nboundaries; see the [provisioning trust model](docs/hosted-provisioning-trust-model.md).\n\n## License\n\nEverything in this repository—node, CLI, web/PWA, relay, and control plane—is\nfree and open-source **AGPL-3.0-only Core**, with no Bivy usage limits. You may\nuse, modify, and self-host it under that license. If users interact with your\nmodified version over a network, section 13 requires you to offer its\ncorresponding source. See [LICENSE](LICENSE).\n\nBivy Cloud is the hosted operation of that stack plus billing and plans, in a\nseparate private repository. Contributions use the\n[DCO](CONTRIBUTING.md#certificate-of-origin); there is no CLA.\n",
|
|
69
69
|
"readmeFilename": "README.md",
|
|
70
70
|
"agentBridges": {
|
|
71
71
|
"@anthropic-ai/claude-agent-sdk": "0.3.285",
|