Skip to content

Commit fd9de96

Browse files
authored
feat(server): vana server start runs in the background by default (#63)
* feat(server): vana server start runs in the background by default `vana login` already started the server in the background while `vana server start` stayed in the terminal, so the same action behaved two ways. Now both run in the background, return once the server answers, and `vana server stop` stops it. --foreground keeps it in the terminal with its logs (debugging, containers, a service manager); --detach is still accepted. The background process itself runs --foreground so it never detaches again. README and the agent-access skill describe the new default and the public server, not the old --public flag. Claude-Session: https://claude.ai/code/session_01Fcv6uEy4zcXaigzDNxeW3j * docs(server): describe server start as running in the background Claude-Session: https://claude.ai/code/session_01Fcv6uEy4zcXaigzDNxeW3j
1 parent cc4baaf commit fd9de96

4 files changed

Lines changed: 57 additions & 44 deletions

File tree

‎README.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ vana login # Vana account, or --server <url> for a self-hosted
4040
vana connect github # managed browser, collects, syncs to your server
4141
vana data show github # what was collected
4242
vana server status # your server, local and registered URLs
43-
vana server start # run your own server here when Vana Desktop is not
43+
vana server start # run your own server in the background (no Desktop needed)
4444
```
4545

46-
`vana server start` is local only: `vana connect` writes to it, apps cannot
47-
reach it. `vana server start --public` registers it on-chain for your
48-
account, opens a public URL through Vana's relay, syncs to Vana storage, and
49-
stays public on every later start. A registration cannot be removed, so this
50-
is a step you take on purpose. On a Mac the tunnel client is a build of frpc
46+
`vana server start` runs your Personal Server in the background and returns
47+
once it answers; `vana server stop` stops it, and `--foreground` keeps it in
48+
the terminal with its logs. It is public by default: registered on-chain for
49+
your account, reachable through Vana's relay, and synced to Vana storage.
50+
`--local` keeps it on this machine only. On a Mac the tunnel client is a build of frpc
5151
signed and notarized by Vana (or Vana Desktop's copy, when installed).
5252

5353
**Builder side** is what an app or an agent uses to work with someone

‎skills/agent-access/SKILL.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ On the owner's machine:
7979
npm install -g vana-cli # or: npx vana-cli <command>
8080
vana login
8181
vana connect github # or any source from `vana sources`
82-
vana server start --detach
82+
vana server start
8383
vana server status --json
8484
```
8585

@@ -94,7 +94,7 @@ by an earlier `vana` and must be restarted, do it:
9494

9595
```bash
9696
vana server stop
97-
vana server start --detach
97+
vana server start
9898
```
9999

100100
## 2. Install the agent and load the builder skill

‎src/cli/index.ts‎

Lines changed: 46 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ Examples:
693693
Examples:
694694
vana server
695695
vana server start
696-
vana server start --detach
696+
vana server start --foreground
697697
vana server stop
698698
vana server set-url http://localhost:8080
699699
vana server set-url https://ps-abc123.server.vana.org
@@ -746,7 +746,7 @@ Examples:
746746
server
747747
.command("start")
748748
.description(
749-
"Run your own Personal Server here, in the foreground, when Vana Desktop is not running one",
749+
"Run your own Personal Server in the background (no Vana Desktop needed); stop with `vana server stop`",
750750
)
751751
.option(
752752
"--port <port>",
@@ -756,36 +756,48 @@ Examples:
756756
"--local",
757757
"Stay local only: no public URL, no on-chain registration, apps cannot reach it",
758758
)
759-
.option("--detach", "Run in the background; stop with `vana server stop`")
759+
.option(
760+
"--foreground",
761+
"Stay in this terminal with the server's logs; stop with Ctrl+C",
762+
)
763+
.option("--detach", "Run in the background (the default)")
760764
.option("--json", "Output machine-readable JSON")
761-
.action(async (startOptions: { port?: string; local?: boolean }) => {
762-
process.exitCode = await runCommandWithTelemetry(
763-
{ ...telemetryBaseContext, command: "server", subcommand: "start" },
764-
async () => {
765-
const port = startOptions.port
766-
? Number(startOptions.port)
767-
: undefined;
768-
if (
769-
port !== undefined &&
770-
!(Number.isInteger(port) && port > 0 && port < 65535)
771-
) {
772-
process.stderr.write("--port needs a port number.\n");
773-
return CliExitCode.USAGE;
774-
}
775-
return runServerStart(
776-
{
777-
network: resolveNetwork(parsedOptions.network).name,
778-
port,
779-
noInput: parsedOptions.noInput,
780-
yes: parsedOptions.yes,
781-
local: startOptions.local,
782-
detach: parsedOptions.detach,
783-
},
784-
serverStartIo(parsedOptions),
785-
);
786-
},
787-
);
788-
});
765+
.action(
766+
async (startOptions: {
767+
port?: string;
768+
local?: boolean;
769+
foreground?: boolean;
770+
}) => {
771+
process.exitCode = await runCommandWithTelemetry(
772+
{ ...telemetryBaseContext, command: "server", subcommand: "start" },
773+
async () => {
774+
const port = startOptions.port
775+
? Number(startOptions.port)
776+
: undefined;
777+
if (
778+
port !== undefined &&
779+
!(Number.isInteger(port) && port > 0 && port < 65535)
780+
) {
781+
process.stderr.write("--port needs a port number.\n");
782+
return CliExitCode.USAGE;
783+
}
784+
return runServerStart(
785+
{
786+
network: resolveNetwork(parsedOptions.network).name,
787+
port,
788+
noInput: parsedOptions.noInput,
789+
yes: parsedOptions.yes,
790+
local: startOptions.local,
791+
// In the background unless asked to stay: `vana login` starts
792+
// it that way too, and the server outlives the terminal.
793+
detach: !startOptions.foreground,
794+
},
795+
serverStartIo(parsedOptions),
796+
);
797+
},
798+
);
799+
},
800+
);
789801

790802
server
791803
.command("stop")
@@ -2972,7 +2984,7 @@ async function runServerStatus(
29722984

29732985
if (target.state !== "available") {
29742986
emit.blank();
2975-
emit.next("vana server start --detach");
2987+
emit.next("vana server start");
29762988
}
29772989

29782990
emit.blank();
@@ -7132,7 +7144,7 @@ async function runLogin(
71327144
renderer.detail(`Personal Server: ${running} (running)`);
71337145
} else {
71347146
renderer.detail("No Personal Server found for this account yet.");
7135-
renderer.next("vana server start --detach");
7147+
renderer.next("vana server start");
71367148
renderer.detail(
71377149
"Or point at one you already run: vana server set-url <url>",
71387150
);
@@ -7256,9 +7268,7 @@ async function offerServerStart(
72567268
...vanaPromptTheme,
72577269
});
72587270
if (!start) {
7259-
process.stderr.write(
7260-
" Start it later with `vana server start --detach`.\n",
7261-
);
7271+
process.stderr.write(" Start it later with `vana server start`.\n");
72627272
return;
72637273
}
72647274
await runServerStart(

‎src/personal-server/local/detach.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ export async function startDetachedServer(input: {
7171
process.argv[1],
7272
"server",
7373
"start",
74+
// The background process is the server itself; without this it would
75+
// detach again.
76+
"--foreground",
7477
"--json",
7578
"--no-input",
7679
"--yes",

0 commit comments

Comments
 (0)