Merge branch 't3/manage-host-ssh-credentials'

# Conflicts:
#	.agents/mind/architecture.md
#	apps/server/src/app.ts
#	apps/web/src/App.tsx
#	packages/core/src/protocol.ts
This commit is contained in:
Florian Schmidt
2026-11-16 10:24:42 +01:00
22 changed files with 1775 additions and 82 deletions
+16 -57
View File
@@ -29,6 +29,8 @@ import type {
Step,
} from "@shellbook/core";
import { NotebookList } from "./NotebookList";
import { HostKeyConfirmation } from "./HostKeyConfirmation";
import { HostsPage } from "./HostsPage";
import { HttpError } from "./api";
import type { Api } from "./api";
import { emptySession, eventReducer, stepKey } from "./events";
@@ -131,6 +133,10 @@ export function App({ api }: { api: Api }) {
})
.catch((e) => setError(String(e)));
const close = api.events((event: ServerEvent) => {
if ((event.type === "file.changed" || event.type === "file.deleted") && event.path === "hosts.yaml") {
void api.hosts().then(result => setHosts(result.hosts)).catch(e => setError(String(e)));
window.dispatchEvent(new Event("shellbook:hosts-changed")); return;
}
const open = current.current;
if (event.type === "file.changed" || event.type === "file.deleted") {
void api
@@ -377,7 +383,7 @@ export function App({ api }: { api: Api }) {
<main>
<HeaderNavigation page={page} onChange={setPage} />
{page === "Settings" && <SettingsPage openTerminal={() => { setTerminalOpened(true); setTerminal(true); }} />}
{page === "Hosts" && <p>Host management will appear here.</p>}
{page === "Hosts" && <HostsPage onChange={() => { void api.hosts().then(result => setHosts(result.hosts)).catch(e => setError(String(e))); }} />}
<div hidden={page !== "Notebooks"}>
<div className="toolbar">
<button aria-expanded={chat} onClick={() => { setChat(!chat); setTerminal(false); }}>Chat</button>
@@ -537,62 +543,15 @@ export function App({ api }: { api: Api }) {
</section>
</div>
)}
{keyPrompt?.hostKey && (
<div className="modal-backdrop">
<section
role="dialog"
aria-modal="true"
aria-labelledby="hostkey-title"
>
<h2 id="hostkey-title">
{keyPrompt.hostKey.changed
? "⚠ HOST KEY CHANGED"
: "Unknown SSH host key"}
</h2>
{keyPrompt.hostKey.changed && (
<p className="error">
STOP: a different key is already trusted. This may indicate a
man-in-the-middle attack. Verify the fingerprint independently
before accepting.
</p>
)}
<p>
Verify the key for <strong>{keyPrompt.hostKey.host}</strong>{" "}
through a trusted channel.
</p>
<code>{keyPrompt.hostKey.fingerprint}</code>
<div className="actions">
<button
onClick={() =>
dispatch({
type: "run.error",
runId: keyPrompt.runId,
message: "Host key rejected",
})
}
>
Reject
</button>
<button
onClick={() => {
const request = requests.current.get(keyPrompt.runId)!;
dispatch({
type: "run.error",
runId: keyPrompt.runId,
message: "Retrying with accepted host key",
});
void start({
...request,
acceptHostKey: keyPrompt.hostKey!.fingerprint,
});
}}
>
Trust this fingerprint and retry
</button>
</div>
</section>
</div>
)}
{keyPrompt?.hostKey && <HostKeyConfirmation
{...keyPrompt.hostKey}
onReject={() => dispatch({ type: "run.error", runId: keyPrompt.runId, message: "Host key rejected" })}
onTrust={() => {
const request = requests.current.get(keyPrompt.runId)!;
dispatch({ type: "run.error", runId: keyPrompt.runId, message: "Retrying with accepted host key" });
void start({ ...request, acceptHostKey: keyPrompt.hostKey!.fingerprint });
}}
/>}
</div>
);
}