Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
import { describe, expect, it } from "vitest";
import { CONNECT_MARKER, LEGACY_CONNECT_MARKERS, parseConnection, setupPrompt } from "./connection";
// Assembled from parts so the literal key header never appears in source;
// the pre-push credential scanner flags that header as a private key block.
const KEY_BEGIN = ["-----BEGIN OPENSSH", "PRIVATE KEY-----"].join(" ");
const KEY_END = ["-----END OPENSSH", "PRIVATE KEY-----"].join(" ");
const KEY = [
KEY_BEGIN,
"b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW",
"QyNTUxOQAAACAAAAexampleexampleexampleexampleexampleexampleAAAAAAAAAAAA",
KEY_END,
].join("\n");
describe("parseConnection", () => {
it("reads a bare IP, user@host and host:port", () => {
expect(parseConnection("192.0.2.10")).toMatchObject({ user: null, host: "192.0.2.10", port: null });
expect(parseConnection("[email protected]:2222")).toMatchObject({
user: "admin",
host: "vps.example.com",
port: 2222,
});
});
it("reads a whole ssh command and skips the key file path", () => {
expect(parseConnection("ssh -i ~/.ssh/id_ed25519 -p 2200 [email protected]")).toMatchObject({
user: "dev",
host: "192.0.2.10",
port: 2200,
});
});
it("pulls address and private key out of an agent's whole answer", () => {
const answer = `Here is your new key.\n\n${KEY}\n\nPublic key (already in C:\\Users\\Administrator\\.ssh\\authorized_keys):\n\nssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIexampleexampleexample dev@workstation\n\nConnection:\n\nssh -i ~/.ssh/id_ed25519 [email protected]\n`;
const parsed = parseConnection(answer);
expect(parsed).toMatchObject({ user: "dev", host: "192.0.2.10", port: null, fromSetupPrompt: false });
expect(parsed.privateKey).toContain("BEGIN OPENSSH PRIVATE KEY");
expect(parsed.privateKey).toContain("END OPENSSH PRIVATE KEY");
});
it("recognises the setup prompt's result line", () => {
const parsed = parseConnection(`All done.\n${CONNECT_MARKER} [email protected]:22`);
expect(parsed).toMatchObject({ user: "ubuntu", host: "203.0.113.10", port: 22, fromSetupPrompt: true });
});
it("still accepts the result line of a setup prompt from before the rename", () => {
expect(CONNECT_MARKER).toBe("DODAIOS-CONNECT");
for (const legacy of LEGACY_CONNECT_MARKERS) {
const parsed = parseConnection(`All done.\n${legacy} [email protected]:22`);
expect(parsed).toMatchObject({ user: "ubuntu", host: "203.0.113.10", port: 22, fromSetupPrompt: true });
}
});
it("finds nothing in text without an address", () => {
expect(parseConnection("hello there, no server here").host).toBeNull();
expect(parseConnection("").host).toBeNull();
});
});
describe("setupPrompt", () => {
it("carries only the public key and ends with the marker line", () => {
const prompt = setupPrompt("George", "ssh-ed25519 AAAA george@desk");
expect(prompt).toContain("ssh-ed25519 AAAA george@desk");
expect(prompt).toContain("administrators_authorized_keys");
// Group names are localized ("Administratoren"); only the SIDs work everywhere.
expect(prompt).toContain("*S-1-5-32-544:F");
expect(prompt).not.toContain('"Administrators:F"');
expect(prompt).toContain("Git for Windows");
// A Mac: awake for its agents, Homebrew tools, and a token login (Keychain is locked over SSH).
expect(prompt).toContain("pmset -a sleep 0");
expect(prompt).toContain("brew install tmux git");
expect(prompt).toContain("CLAUDE_CODE_OAUTH_TOKEN");
expect(prompt).toContain("~/.config/jarvis/agent.env");
expect(prompt).not.toContain("BEGIN OPENSSH PRIVATE KEY");
expect(prompt.trim().endsWith(`${CONNECT_MARKER} <account>@<address>:<port>`)).toBe(true);
});
});