diff --git a/webui/src/i18n/locales/en/common.json b/webui/src/i18n/locales/en/common.json
index f5fd7bf8b..a9cb7948e 100644
--- a/webui/src/i18n/locales/en/common.json
+++ b/webui/src/i18n/locales/en/common.json
@@ -1,4 +1,106 @@
{
+ "remote": {
+ "localShort": "Local",
+ "disconnectTitle": "Disconnect from {{name}}?",
+ "disconnectDescription": "This closes the server view and shared SSH connection. Unsaved work may be lost, and other tabs using this connection will disconnect. nanobot keeps running on the server.",
+ "hostBar": "Current connection",
+ "switchHost": "Switch host",
+ "manageConnections": "Manage connections…",
+ "ready": "Ready",
+ "preparing": "Connecting to {{name}}…",
+ "cancelSwitch": "Cancel switch",
+ "localEnvironment": "Local · {{name}}",
+ "sshHosts": "From your SSH config",
+ "sshHostsHint": "Choose a saved SSH host. Its username, key and port are inherited; no servers are contacted until you connect.",
+ "refreshHosts": "Refresh SSH hosts",
+ "searchHosts": "Search SSH hosts",
+ "useHost": "Use {{host}}",
+ "loadingHosts": "Reading SSH config…",
+ "noHosts": "No named hosts found. You can enter an SSH address below.",
+ "noMatchingHosts": "No matching hosts.",
+ "partialHosts": "Some entries couldn't be listed. You can still enter an alias or address manually.",
+ "otherConfig": "Use another SSH config file",
+ "configToRead": "SSH config file to read",
+ "readConfig": "Read hosts",
+ "discoveryError": "Couldn't read SSH hosts. Retry or enter an address manually.",
+ "portPlaceholder": "Use SSH config (normally 22)",
+ "loading": "Loading connections…",
+ "retry": "Retry",
+ "unavailable": "Open this page from a locally running nanobot to connect to servers over SSH.",
+ "back": "Back",
+ "disconnect": "Disconnect",
+ "verifyTitle": "Verify this server",
+ "verifyDescription": "Before connecting for the first time, compare this SSH fingerprint with your server console or administrator.",
+ "verifyHint": "Continue only if it matches. Only this server's public key is saved; your system SSH config is unchanged.",
+ "verifyConnect": "Fingerprint matches · Connect",
+ "title": "Remote connections",
+ "description": "Connect to nanobot on a server. Chats and settings stay there.",
+ "local": "Local nanobot",
+ "current": "Currently using",
+ "remote": "Remote",
+ "returnLocal": "Back to local nanobot",
+ "add": "Connect to remote nanobot…",
+ "addTitle": "Connect to remote nanobot",
+ "addDescription": "Connect to a nanobot that's already running on your server.",
+ "host": "SSH address",
+ "name": "Name (optional)",
+ "namePlaceholder": "Team server",
+ "keyHint": "Uses your system's SSH keys. Model keys and conversations stay on the server.",
+ "advanced": "Advanced",
+ "sshPort": "SSH port",
+ "ssh_config": "SSH config file (optional)",
+ "identity_file": "Private key path (optional)",
+ "config_path": "Server's nanobot config path",
+ "runtime_user": "nanobot service account (optional)",
+ "saveConnect": "Save & connect",
+ "connecting": "Connecting…",
+ "opening": "Opening your server…",
+ "frameTitle": "nanobot on {{name}}",
+ "offline": "Server connection lost",
+ "noFallback": "You're still using remote nanobot. Nothing is sent to local nanobot.",
+ "reconnect": "Reconnect",
+ "manage": "Manage {{name}}",
+ "edit": "Edit connection",
+ "forget": "Forget server",
+ "forgetTitle": "Forget {{name}}?",
+ "forgetDescription": "Only this saved connection will be removed. nanobot, its keys and conversations on the server will stay untouched.",
+ "errors": {
+ "view_limit": "Three server views are already kept open. Disconnect one in Manage connections before opening another.",
+ "view_load_failed": "The server view is taking too long to load. Retry; your current view is unchanged.",
+ "same_instance": "This is the nanobot you are already using. No remote connection is needed.",
+ "ssh_config_unreadable": "This SSH config could not be read. Check its path, permissions and format.",
+ "local_port_in_use": "This connection's local port is in use. Close the conflicting application, or forget and add this server again.",
+ "host_key_scan_failed": "Couldn't retrieve this server's fingerprint. For jump hosts, verify it through your existing SSH configuration.",
+ "unknown": "Couldn't connect. Check the server and try again.",
+ "directory_unavailable": "Couldn't read your saved servers. Please try again.",
+ "ssh_unavailable": "Install the OpenSSH client on this machine to connect.",
+ "ssh_auth_failed": "SSH couldn't sign in. Check the username and key, and unlock your key in the system SSH agent if needed.",
+ "ssh_unreachable": "Can't reach SSH on this server. Check the address, port and network.",
+ "host_key_unknown": "This server hasn't been verified by SSH on this machine yet. Verify its host fingerprint with your administrator before connecting.",
+ "host_key_changed": "The server's SSH identity has changed. Connection blocked. Confirm this change with your administrator; don't bypass the warning.",
+ "local_file_not_found": "The SSH config or private key file couldn't be found on this machine.",
+ "runtime_user_denied": "SSH signed in, but cannot read as that service account without a password. Check the account with your server administrator.",
+ "python_unavailable": "The server needs python3 to locate its existing nanobot configuration.",
+ "config_not_found": "nanobot's config wasn't found. Set its server-side path in Advanced.",
+ "config_permission": "This SSH user can't read nanobot's config. Set the nanobot service account in Advanced.",
+ "config_invalid": "Couldn't read the server's nanobot configuration.",
+ "webui_disabled": "The server's WebUI is disabled. Enable it on the server first.",
+ "webui_auth_required": "The server needs a WebUI login secret in its config. No model key is needed here.",
+ "public_ws_unsupported": "This server uses a public WebSocket URL. This first version supports a loopback WebUI over SSH.",
+ "remote_auth_failed": "The server rejected its saved WebUI credential. Check its running configuration.",
+ "incompatible_gateway": "This endpoint isn't a compatible nanobot gateway. Update the server or check its configuration.",
+ "webui_unavailable": "The gateway is running, but its WebUI isn't installed.",
+ "remote_unreachable": "SSH connected, but the nanobot WebUI isn't responding. Check that it's running.",
+ "profile_store_invalid": "Saved connections couldn't be read. They haven't been overwritten.",
+ "invalid_profile": "Check the address, port and Advanced fields.",
+ "profile_not_found": "This saved server no longer exists. Refresh the list.",
+ "profile_limit": "You can save up to 20 servers.",
+ "connection_limit": "Disconnect an existing server before opening another connection.",
+ "disconnect_before_edit": "Disconnect this server before editing it.",
+ "local_io_error": "Couldn't save or open the connection. Check local file permissions.",
+ "invalid_remote_url": "The connection returned an unexpected address. It was blocked."
+ }
+ },
"previewTabs": {
"title": "Preview",
"closeTab": "Close {{name}}",
diff --git a/webui/src/i18n/locales/es/common.json b/webui/src/i18n/locales/es/common.json
index 6e434a3bb..2b3ba95e5 100644
--- a/webui/src/i18n/locales/es/common.json
+++ b/webui/src/i18n/locales/es/common.json
@@ -1,4 +1,106 @@
{
+ "remote": {
+ "localShort": "Local",
+ "disconnectTitle": "Disconnect from {{name}}?",
+ "disconnectDescription": "This closes the server view and shared SSH connection. Unsaved work may be lost, and other tabs using this connection will disconnect. nanobot keeps running on the server.",
+ "hostBar": "Current connection",
+ "switchHost": "Switch host",
+ "manageConnections": "Manage connections…",
+ "ready": "Ready",
+ "preparing": "Connecting to {{name}}…",
+ "cancelSwitch": "Cancel switch",
+ "localEnvironment": "Local · {{name}}",
+ "sshHosts": "From your SSH config",
+ "sshHostsHint": "Choose a saved SSH host. Its username, key and port are inherited; no servers are contacted until you connect.",
+ "refreshHosts": "Refresh SSH hosts",
+ "searchHosts": "Search SSH hosts",
+ "useHost": "Use {{host}}",
+ "loadingHosts": "Reading SSH config…",
+ "noHosts": "No named hosts found. You can enter an SSH address below.",
+ "noMatchingHosts": "No matching hosts.",
+ "partialHosts": "Some entries couldn't be listed. You can still enter an alias or address manually.",
+ "otherConfig": "Use another SSH config file",
+ "configToRead": "SSH config file to read",
+ "readConfig": "Read hosts",
+ "discoveryError": "Couldn't read SSH hosts. Retry or enter an address manually.",
+ "portPlaceholder": "Use SSH config (normally 22)",
+ "loading": "Loading connections…",
+ "retry": "Retry",
+ "unavailable": "Open this page from a locally running nanobot to connect to servers over SSH.",
+ "back": "Back",
+ "disconnect": "Disconnect",
+ "verifyTitle": "Verify this server",
+ "verifyDescription": "Before connecting for the first time, compare this SSH fingerprint with your server console or administrator.",
+ "verifyHint": "Continue only if it matches. Only this server's public key is saved; your system SSH config is unchanged.",
+ "verifyConnect": "Fingerprint matches · Connect",
+ "title": "Remote connections",
+ "description": "Connect to nanobot on a server. Chats and settings stay there.",
+ "local": "Local nanobot",
+ "current": "Currently using",
+ "remote": "Remote",
+ "returnLocal": "Back to local nanobot",
+ "add": "Connect to remote nanobot…",
+ "addTitle": "Connect to remote nanobot",
+ "addDescription": "Connect to a nanobot that's already running on your server.",
+ "host": "SSH address",
+ "name": "Name (optional)",
+ "namePlaceholder": "Team server",
+ "keyHint": "Uses your system's SSH keys. Model keys and conversations stay on the server.",
+ "advanced": "Advanced",
+ "sshPort": "SSH port",
+ "ssh_config": "SSH config file (optional)",
+ "identity_file": "Private key path (optional)",
+ "config_path": "Server's nanobot config path",
+ "runtime_user": "nanobot service account (optional)",
+ "saveConnect": "Save & connect",
+ "connecting": "Connecting…",
+ "opening": "Opening your server…",
+ "frameTitle": "nanobot on {{name}}",
+ "offline": "Server connection lost",
+ "noFallback": "You're still using remote nanobot. Nothing is sent to local nanobot.",
+ "reconnect": "Reconnect",
+ "manage": "Manage {{name}}",
+ "edit": "Edit connection",
+ "forget": "Forget server",
+ "forgetTitle": "Forget {{name}}?",
+ "forgetDescription": "Only this saved connection will be removed. nanobot, its keys and conversations on the server will stay untouched.",
+ "errors": {
+ "view_limit": "Three server views are already kept open. Disconnect one in Manage connections before opening another.",
+ "view_load_failed": "The server view is taking too long to load. Retry; your current view is unchanged.",
+ "same_instance": "This is the nanobot you are already using. No remote connection is needed.",
+ "ssh_config_unreadable": "This SSH config could not be read. Check its path, permissions and format.",
+ "local_port_in_use": "This connection's local port is in use. Close the conflicting application, or forget and add this server again.",
+ "host_key_scan_failed": "Couldn't retrieve this server's fingerprint. For jump hosts, verify it through your existing SSH configuration.",
+ "unknown": "Couldn't connect. Check the server and try again.",
+ "directory_unavailable": "Couldn't read your saved servers. Please try again.",
+ "ssh_unavailable": "Install the OpenSSH client on this machine to connect.",
+ "ssh_auth_failed": "SSH couldn't sign in. Check the username and key, and unlock your key in the system SSH agent if needed.",
+ "ssh_unreachable": "Can't reach SSH on this server. Check the address, port and network.",
+ "host_key_unknown": "This server hasn't been verified by SSH on this machine yet. Verify its host fingerprint with your administrator before connecting.",
+ "host_key_changed": "The server's SSH identity has changed. Connection blocked. Confirm this change with your administrator; don't bypass the warning.",
+ "local_file_not_found": "The SSH config or private key file couldn't be found on this machine.",
+ "runtime_user_denied": "SSH signed in, but cannot read as that service account without a password. Check the account with your server administrator.",
+ "python_unavailable": "The server needs python3 to locate its existing nanobot configuration.",
+ "config_not_found": "nanobot's config wasn't found. Set its server-side path in Advanced.",
+ "config_permission": "This SSH user can't read nanobot's config. Set the nanobot service account in Advanced.",
+ "config_invalid": "Couldn't read the server's nanobot configuration.",
+ "webui_disabled": "The server's WebUI is disabled. Enable it on the server first.",
+ "webui_auth_required": "The server needs a WebUI login secret in its config. No model key is needed here.",
+ "public_ws_unsupported": "This server uses a public WebSocket URL. This first version supports a loopback WebUI over SSH.",
+ "remote_auth_failed": "The server rejected its saved WebUI credential. Check its running configuration.",
+ "incompatible_gateway": "This endpoint isn't a compatible nanobot gateway. Update the server or check its configuration.",
+ "webui_unavailable": "The gateway is running, but its WebUI isn't installed.",
+ "remote_unreachable": "SSH connected, but the nanobot WebUI isn't responding. Check that it's running.",
+ "profile_store_invalid": "Saved connections couldn't be read. They haven't been overwritten.",
+ "invalid_profile": "Check the address, port and Advanced fields.",
+ "profile_not_found": "This saved server no longer exists. Refresh the list.",
+ "profile_limit": "You can save up to 20 servers.",
+ "connection_limit": "Disconnect an existing server before opening another connection.",
+ "disconnect_before_edit": "Disconnect this server before editing it.",
+ "local_io_error": "Couldn't save or open the connection. Check local file permissions.",
+ "invalid_remote_url": "The connection returned an unexpected address. It was blocked."
+ }
+ },
"previewTabs": {
"title": "Vista previa",
"closeTab": "Cerrar {{name}}",
diff --git a/webui/src/i18n/locales/fr/common.json b/webui/src/i18n/locales/fr/common.json
index fa5e4b25c..d1da50c23 100644
--- a/webui/src/i18n/locales/fr/common.json
+++ b/webui/src/i18n/locales/fr/common.json
@@ -1,4 +1,106 @@
{
+ "remote": {
+ "localShort": "Local",
+ "disconnectTitle": "Disconnect from {{name}}?",
+ "disconnectDescription": "This closes the server view and shared SSH connection. Unsaved work may be lost, and other tabs using this connection will disconnect. nanobot keeps running on the server.",
+ "hostBar": "Current connection",
+ "switchHost": "Switch host",
+ "manageConnections": "Manage connections…",
+ "ready": "Ready",
+ "preparing": "Connecting to {{name}}…",
+ "cancelSwitch": "Cancel switch",
+ "localEnvironment": "Local · {{name}}",
+ "sshHosts": "From your SSH config",
+ "sshHostsHint": "Choose a saved SSH host. Its username, key and port are inherited; no servers are contacted until you connect.",
+ "refreshHosts": "Refresh SSH hosts",
+ "searchHosts": "Search SSH hosts",
+ "useHost": "Use {{host}}",
+ "loadingHosts": "Reading SSH config…",
+ "noHosts": "No named hosts found. You can enter an SSH address below.",
+ "noMatchingHosts": "No matching hosts.",
+ "partialHosts": "Some entries couldn't be listed. You can still enter an alias or address manually.",
+ "otherConfig": "Use another SSH config file",
+ "configToRead": "SSH config file to read",
+ "readConfig": "Read hosts",
+ "discoveryError": "Couldn't read SSH hosts. Retry or enter an address manually.",
+ "portPlaceholder": "Use SSH config (normally 22)",
+ "loading": "Loading connections…",
+ "retry": "Retry",
+ "unavailable": "Open this page from a locally running nanobot to connect to servers over SSH.",
+ "back": "Back",
+ "disconnect": "Disconnect",
+ "verifyTitle": "Verify this server",
+ "verifyDescription": "Before connecting for the first time, compare this SSH fingerprint with your server console or administrator.",
+ "verifyHint": "Continue only if it matches. Only this server's public key is saved; your system SSH config is unchanged.",
+ "verifyConnect": "Fingerprint matches · Connect",
+ "title": "Remote connections",
+ "description": "Connect to nanobot on a server. Chats and settings stay there.",
+ "local": "Local nanobot",
+ "current": "Currently using",
+ "remote": "Remote",
+ "returnLocal": "Back to local nanobot",
+ "add": "Connect to remote nanobot…",
+ "addTitle": "Connect to remote nanobot",
+ "addDescription": "Connect to a nanobot that's already running on your server.",
+ "host": "SSH address",
+ "name": "Name (optional)",
+ "namePlaceholder": "Team server",
+ "keyHint": "Uses your system's SSH keys. Model keys and conversations stay on the server.",
+ "advanced": "Advanced",
+ "sshPort": "SSH port",
+ "ssh_config": "SSH config file (optional)",
+ "identity_file": "Private key path (optional)",
+ "config_path": "Server's nanobot config path",
+ "runtime_user": "nanobot service account (optional)",
+ "saveConnect": "Save & connect",
+ "connecting": "Connecting…",
+ "opening": "Opening your server…",
+ "frameTitle": "nanobot on {{name}}",
+ "offline": "Server connection lost",
+ "noFallback": "You're still using remote nanobot. Nothing is sent to local nanobot.",
+ "reconnect": "Reconnect",
+ "manage": "Manage {{name}}",
+ "edit": "Edit connection",
+ "forget": "Forget server",
+ "forgetTitle": "Forget {{name}}?",
+ "forgetDescription": "Only this saved connection will be removed. nanobot, its keys and conversations on the server will stay untouched.",
+ "errors": {
+ "view_limit": "Three server views are already kept open. Disconnect one in Manage connections before opening another.",
+ "view_load_failed": "The server view is taking too long to load. Retry; your current view is unchanged.",
+ "same_instance": "This is the nanobot you are already using. No remote connection is needed.",
+ "ssh_config_unreadable": "This SSH config could not be read. Check its path, permissions and format.",
+ "local_port_in_use": "This connection's local port is in use. Close the conflicting application, or forget and add this server again.",
+ "host_key_scan_failed": "Couldn't retrieve this server's fingerprint. For jump hosts, verify it through your existing SSH configuration.",
+ "unknown": "Couldn't connect. Check the server and try again.",
+ "directory_unavailable": "Couldn't read your saved servers. Please try again.",
+ "ssh_unavailable": "Install the OpenSSH client on this machine to connect.",
+ "ssh_auth_failed": "SSH couldn't sign in. Check the username and key, and unlock your key in the system SSH agent if needed.",
+ "ssh_unreachable": "Can't reach SSH on this server. Check the address, port and network.",
+ "host_key_unknown": "This server hasn't been verified by SSH on this machine yet. Verify its host fingerprint with your administrator before connecting.",
+ "host_key_changed": "The server's SSH identity has changed. Connection blocked. Confirm this change with your administrator; don't bypass the warning.",
+ "local_file_not_found": "The SSH config or private key file couldn't be found on this machine.",
+ "runtime_user_denied": "SSH signed in, but cannot read as that service account without a password. Check the account with your server administrator.",
+ "python_unavailable": "The server needs python3 to locate its existing nanobot configuration.",
+ "config_not_found": "nanobot's config wasn't found. Set its server-side path in Advanced.",
+ "config_permission": "This SSH user can't read nanobot's config. Set the nanobot service account in Advanced.",
+ "config_invalid": "Couldn't read the server's nanobot configuration.",
+ "webui_disabled": "The server's WebUI is disabled. Enable it on the server first.",
+ "webui_auth_required": "The server needs a WebUI login secret in its config. No model key is needed here.",
+ "public_ws_unsupported": "This server uses a public WebSocket URL. This first version supports a loopback WebUI over SSH.",
+ "remote_auth_failed": "The server rejected its saved WebUI credential. Check its running configuration.",
+ "incompatible_gateway": "This endpoint isn't a compatible nanobot gateway. Update the server or check its configuration.",
+ "webui_unavailable": "The gateway is running, but its WebUI isn't installed.",
+ "remote_unreachable": "SSH connected, but the nanobot WebUI isn't responding. Check that it's running.",
+ "profile_store_invalid": "Saved connections couldn't be read. They haven't been overwritten.",
+ "invalid_profile": "Check the address, port and Advanced fields.",
+ "profile_not_found": "This saved server no longer exists. Refresh the list.",
+ "profile_limit": "You can save up to 20 servers.",
+ "connection_limit": "Disconnect an existing server before opening another connection.",
+ "disconnect_before_edit": "Disconnect this server before editing it.",
+ "local_io_error": "Couldn't save or open the connection. Check local file permissions.",
+ "invalid_remote_url": "The connection returned an unexpected address. It was blocked."
+ }
+ },
"previewTabs": {
"title": "Aperçu",
"closeTab": "Fermer {{name}}",
diff --git a/webui/src/i18n/locales/id/common.json b/webui/src/i18n/locales/id/common.json
index 4bfaa1374..256204d25 100644
--- a/webui/src/i18n/locales/id/common.json
+++ b/webui/src/i18n/locales/id/common.json
@@ -1,4 +1,106 @@
{
+ "remote": {
+ "localShort": "Local",
+ "disconnectTitle": "Disconnect from {{name}}?",
+ "disconnectDescription": "This closes the server view and shared SSH connection. Unsaved work may be lost, and other tabs using this connection will disconnect. nanobot keeps running on the server.",
+ "hostBar": "Current connection",
+ "switchHost": "Switch host",
+ "manageConnections": "Manage connections…",
+ "ready": "Ready",
+ "preparing": "Connecting to {{name}}…",
+ "cancelSwitch": "Cancel switch",
+ "localEnvironment": "Local · {{name}}",
+ "sshHosts": "From your SSH config",
+ "sshHostsHint": "Choose a saved SSH host. Its username, key and port are inherited; no servers are contacted until you connect.",
+ "refreshHosts": "Refresh SSH hosts",
+ "searchHosts": "Search SSH hosts",
+ "useHost": "Use {{host}}",
+ "loadingHosts": "Reading SSH config…",
+ "noHosts": "No named hosts found. You can enter an SSH address below.",
+ "noMatchingHosts": "No matching hosts.",
+ "partialHosts": "Some entries couldn't be listed. You can still enter an alias or address manually.",
+ "otherConfig": "Use another SSH config file",
+ "configToRead": "SSH config file to read",
+ "readConfig": "Read hosts",
+ "discoveryError": "Couldn't read SSH hosts. Retry or enter an address manually.",
+ "portPlaceholder": "Use SSH config (normally 22)",
+ "loading": "Loading connections…",
+ "retry": "Retry",
+ "unavailable": "Open this page from a locally running nanobot to connect to servers over SSH.",
+ "back": "Back",
+ "disconnect": "Disconnect",
+ "verifyTitle": "Verify this server",
+ "verifyDescription": "Before connecting for the first time, compare this SSH fingerprint with your server console or administrator.",
+ "verifyHint": "Continue only if it matches. Only this server's public key is saved; your system SSH config is unchanged.",
+ "verifyConnect": "Fingerprint matches · Connect",
+ "title": "Remote connections",
+ "description": "Connect to nanobot on a server. Chats and settings stay there.",
+ "local": "Local nanobot",
+ "current": "Currently using",
+ "remote": "Remote",
+ "returnLocal": "Back to local nanobot",
+ "add": "Connect to remote nanobot…",
+ "addTitle": "Connect to remote nanobot",
+ "addDescription": "Connect to a nanobot that's already running on your server.",
+ "host": "SSH address",
+ "name": "Name (optional)",
+ "namePlaceholder": "Team server",
+ "keyHint": "Uses your system's SSH keys. Model keys and conversations stay on the server.",
+ "advanced": "Advanced",
+ "sshPort": "SSH port",
+ "ssh_config": "SSH config file (optional)",
+ "identity_file": "Private key path (optional)",
+ "config_path": "Server's nanobot config path",
+ "runtime_user": "nanobot service account (optional)",
+ "saveConnect": "Save & connect",
+ "connecting": "Connecting…",
+ "opening": "Opening your server…",
+ "frameTitle": "nanobot on {{name}}",
+ "offline": "Server connection lost",
+ "noFallback": "You're still using remote nanobot. Nothing is sent to local nanobot.",
+ "reconnect": "Reconnect",
+ "manage": "Manage {{name}}",
+ "edit": "Edit connection",
+ "forget": "Forget server",
+ "forgetTitle": "Forget {{name}}?",
+ "forgetDescription": "Only this saved connection will be removed. nanobot, its keys and conversations on the server will stay untouched.",
+ "errors": {
+ "view_limit": "Three server views are already kept open. Disconnect one in Manage connections before opening another.",
+ "view_load_failed": "The server view is taking too long to load. Retry; your current view is unchanged.",
+ "same_instance": "This is the nanobot you are already using. No remote connection is needed.",
+ "ssh_config_unreadable": "This SSH config could not be read. Check its path, permissions and format.",
+ "local_port_in_use": "This connection's local port is in use. Close the conflicting application, or forget and add this server again.",
+ "host_key_scan_failed": "Couldn't retrieve this server's fingerprint. For jump hosts, verify it through your existing SSH configuration.",
+ "unknown": "Couldn't connect. Check the server and try again.",
+ "directory_unavailable": "Couldn't read your saved servers. Please try again.",
+ "ssh_unavailable": "Install the OpenSSH client on this machine to connect.",
+ "ssh_auth_failed": "SSH couldn't sign in. Check the username and key, and unlock your key in the system SSH agent if needed.",
+ "ssh_unreachable": "Can't reach SSH on this server. Check the address, port and network.",
+ "host_key_unknown": "This server hasn't been verified by SSH on this machine yet. Verify its host fingerprint with your administrator before connecting.",
+ "host_key_changed": "The server's SSH identity has changed. Connection blocked. Confirm this change with your administrator; don't bypass the warning.",
+ "local_file_not_found": "The SSH config or private key file couldn't be found on this machine.",
+ "runtime_user_denied": "SSH signed in, but cannot read as that service account without a password. Check the account with your server administrator.",
+ "python_unavailable": "The server needs python3 to locate its existing nanobot configuration.",
+ "config_not_found": "nanobot's config wasn't found. Set its server-side path in Advanced.",
+ "config_permission": "This SSH user can't read nanobot's config. Set the nanobot service account in Advanced.",
+ "config_invalid": "Couldn't read the server's nanobot configuration.",
+ "webui_disabled": "The server's WebUI is disabled. Enable it on the server first.",
+ "webui_auth_required": "The server needs a WebUI login secret in its config. No model key is needed here.",
+ "public_ws_unsupported": "This server uses a public WebSocket URL. This first version supports a loopback WebUI over SSH.",
+ "remote_auth_failed": "The server rejected its saved WebUI credential. Check its running configuration.",
+ "incompatible_gateway": "This endpoint isn't a compatible nanobot gateway. Update the server or check its configuration.",
+ "webui_unavailable": "The gateway is running, but its WebUI isn't installed.",
+ "remote_unreachable": "SSH connected, but the nanobot WebUI isn't responding. Check that it's running.",
+ "profile_store_invalid": "Saved connections couldn't be read. They haven't been overwritten.",
+ "invalid_profile": "Check the address, port and Advanced fields.",
+ "profile_not_found": "This saved server no longer exists. Refresh the list.",
+ "profile_limit": "You can save up to 20 servers.",
+ "connection_limit": "Disconnect an existing server before opening another connection.",
+ "disconnect_before_edit": "Disconnect this server before editing it.",
+ "local_io_error": "Couldn't save or open the connection. Check local file permissions.",
+ "invalid_remote_url": "The connection returned an unexpected address. It was blocked."
+ }
+ },
"previewTabs": {
"title": "Pratinjau",
"closeTab": "Tutup {{name}}",
diff --git a/webui/src/i18n/locales/ja/common.json b/webui/src/i18n/locales/ja/common.json
index 72d74490c..d32b9f583 100644
--- a/webui/src/i18n/locales/ja/common.json
+++ b/webui/src/i18n/locales/ja/common.json
@@ -1,4 +1,106 @@
{
+ "remote": {
+ "localShort": "Local",
+ "disconnectTitle": "Disconnect from {{name}}?",
+ "disconnectDescription": "This closes the server view and shared SSH connection. Unsaved work may be lost, and other tabs using this connection will disconnect. nanobot keeps running on the server.",
+ "hostBar": "Current connection",
+ "switchHost": "Switch host",
+ "manageConnections": "Manage connections…",
+ "ready": "Ready",
+ "preparing": "Connecting to {{name}}…",
+ "cancelSwitch": "Cancel switch",
+ "localEnvironment": "Local · {{name}}",
+ "sshHosts": "From your SSH config",
+ "sshHostsHint": "Choose a saved SSH host. Its username, key and port are inherited; no servers are contacted until you connect.",
+ "refreshHosts": "Refresh SSH hosts",
+ "searchHosts": "Search SSH hosts",
+ "useHost": "Use {{host}}",
+ "loadingHosts": "Reading SSH config…",
+ "noHosts": "No named hosts found. You can enter an SSH address below.",
+ "noMatchingHosts": "No matching hosts.",
+ "partialHosts": "Some entries couldn't be listed. You can still enter an alias or address manually.",
+ "otherConfig": "Use another SSH config file",
+ "configToRead": "SSH config file to read",
+ "readConfig": "Read hosts",
+ "discoveryError": "Couldn't read SSH hosts. Retry or enter an address manually.",
+ "portPlaceholder": "Use SSH config (normally 22)",
+ "loading": "Loading connections…",
+ "retry": "Retry",
+ "unavailable": "Open this page from a locally running nanobot to connect to servers over SSH.",
+ "back": "Back",
+ "disconnect": "Disconnect",
+ "verifyTitle": "Verify this server",
+ "verifyDescription": "Before connecting for the first time, compare this SSH fingerprint with your server console or administrator.",
+ "verifyHint": "Continue only if it matches. Only this server's public key is saved; your system SSH config is unchanged.",
+ "verifyConnect": "Fingerprint matches · Connect",
+ "title": "Remote connections",
+ "description": "Connect to nanobot on a server. Chats and settings stay there.",
+ "local": "Local nanobot",
+ "current": "Currently using",
+ "remote": "Remote",
+ "returnLocal": "Back to local nanobot",
+ "add": "Connect to remote nanobot…",
+ "addTitle": "Connect to remote nanobot",
+ "addDescription": "Connect to a nanobot that's already running on your server.",
+ "host": "SSH address",
+ "name": "Name (optional)",
+ "namePlaceholder": "Team server",
+ "keyHint": "Uses your system's SSH keys. Model keys and conversations stay on the server.",
+ "advanced": "Advanced",
+ "sshPort": "SSH port",
+ "ssh_config": "SSH config file (optional)",
+ "identity_file": "Private key path (optional)",
+ "config_path": "Server's nanobot config path",
+ "runtime_user": "nanobot service account (optional)",
+ "saveConnect": "Save & connect",
+ "connecting": "Connecting…",
+ "opening": "Opening your server…",
+ "frameTitle": "nanobot on {{name}}",
+ "offline": "Server connection lost",
+ "noFallback": "You're still using remote nanobot. Nothing is sent to local nanobot.",
+ "reconnect": "Reconnect",
+ "manage": "Manage {{name}}",
+ "edit": "Edit connection",
+ "forget": "Forget server",
+ "forgetTitle": "Forget {{name}}?",
+ "forgetDescription": "Only this saved connection will be removed. nanobot, its keys and conversations on the server will stay untouched.",
+ "errors": {
+ "view_limit": "Three server views are already kept open. Disconnect one in Manage connections before opening another.",
+ "view_load_failed": "The server view is taking too long to load. Retry; your current view is unchanged.",
+ "same_instance": "This is the nanobot you are already using. No remote connection is needed.",
+ "ssh_config_unreadable": "This SSH config could not be read. Check its path, permissions and format.",
+ "local_port_in_use": "This connection's local port is in use. Close the conflicting application, or forget and add this server again.",
+ "host_key_scan_failed": "Couldn't retrieve this server's fingerprint. For jump hosts, verify it through your existing SSH configuration.",
+ "unknown": "Couldn't connect. Check the server and try again.",
+ "directory_unavailable": "Couldn't read your saved servers. Please try again.",
+ "ssh_unavailable": "Install the OpenSSH client on this machine to connect.",
+ "ssh_auth_failed": "SSH couldn't sign in. Check the username and key, and unlock your key in the system SSH agent if needed.",
+ "ssh_unreachable": "Can't reach SSH on this server. Check the address, port and network.",
+ "host_key_unknown": "This server hasn't been verified by SSH on this machine yet. Verify its host fingerprint with your administrator before connecting.",
+ "host_key_changed": "The server's SSH identity has changed. Connection blocked. Confirm this change with your administrator; don't bypass the warning.",
+ "local_file_not_found": "The SSH config or private key file couldn't be found on this machine.",
+ "runtime_user_denied": "SSH signed in, but cannot read as that service account without a password. Check the account with your server administrator.",
+ "python_unavailable": "The server needs python3 to locate its existing nanobot configuration.",
+ "config_not_found": "nanobot's config wasn't found. Set its server-side path in Advanced.",
+ "config_permission": "This SSH user can't read nanobot's config. Set the nanobot service account in Advanced.",
+ "config_invalid": "Couldn't read the server's nanobot configuration.",
+ "webui_disabled": "The server's WebUI is disabled. Enable it on the server first.",
+ "webui_auth_required": "The server needs a WebUI login secret in its config. No model key is needed here.",
+ "public_ws_unsupported": "This server uses a public WebSocket URL. This first version supports a loopback WebUI over SSH.",
+ "remote_auth_failed": "The server rejected its saved WebUI credential. Check its running configuration.",
+ "incompatible_gateway": "This endpoint isn't a compatible nanobot gateway. Update the server or check its configuration.",
+ "webui_unavailable": "The gateway is running, but its WebUI isn't installed.",
+ "remote_unreachable": "SSH connected, but the nanobot WebUI isn't responding. Check that it's running.",
+ "profile_store_invalid": "Saved connections couldn't be read. They haven't been overwritten.",
+ "invalid_profile": "Check the address, port and Advanced fields.",
+ "profile_not_found": "This saved server no longer exists. Refresh the list.",
+ "profile_limit": "You can save up to 20 servers.",
+ "connection_limit": "Disconnect an existing server before opening another connection.",
+ "disconnect_before_edit": "Disconnect this server before editing it.",
+ "local_io_error": "Couldn't save or open the connection. Check local file permissions.",
+ "invalid_remote_url": "The connection returned an unexpected address. It was blocked."
+ }
+ },
"previewTabs": {
"title": "プレビュー",
"closeTab": "{{name}} を閉じる",
diff --git a/webui/src/i18n/locales/ko/common.json b/webui/src/i18n/locales/ko/common.json
index 855c8a0b0..a4c43a05d 100644
--- a/webui/src/i18n/locales/ko/common.json
+++ b/webui/src/i18n/locales/ko/common.json
@@ -1,4 +1,106 @@
{
+ "remote": {
+ "localShort": "Local",
+ "disconnectTitle": "Disconnect from {{name}}?",
+ "disconnectDescription": "This closes the server view and shared SSH connection. Unsaved work may be lost, and other tabs using this connection will disconnect. nanobot keeps running on the server.",
+ "hostBar": "Current connection",
+ "switchHost": "Switch host",
+ "manageConnections": "Manage connections…",
+ "ready": "Ready",
+ "preparing": "Connecting to {{name}}…",
+ "cancelSwitch": "Cancel switch",
+ "localEnvironment": "Local · {{name}}",
+ "sshHosts": "From your SSH config",
+ "sshHostsHint": "Choose a saved SSH host. Its username, key and port are inherited; no servers are contacted until you connect.",
+ "refreshHosts": "Refresh SSH hosts",
+ "searchHosts": "Search SSH hosts",
+ "useHost": "Use {{host}}",
+ "loadingHosts": "Reading SSH config…",
+ "noHosts": "No named hosts found. You can enter an SSH address below.",
+ "noMatchingHosts": "No matching hosts.",
+ "partialHosts": "Some entries couldn't be listed. You can still enter an alias or address manually.",
+ "otherConfig": "Use another SSH config file",
+ "configToRead": "SSH config file to read",
+ "readConfig": "Read hosts",
+ "discoveryError": "Couldn't read SSH hosts. Retry or enter an address manually.",
+ "portPlaceholder": "Use SSH config (normally 22)",
+ "loading": "Loading connections…",
+ "retry": "Retry",
+ "unavailable": "Open this page from a locally running nanobot to connect to servers over SSH.",
+ "back": "Back",
+ "disconnect": "Disconnect",
+ "verifyTitle": "Verify this server",
+ "verifyDescription": "Before connecting for the first time, compare this SSH fingerprint with your server console or administrator.",
+ "verifyHint": "Continue only if it matches. Only this server's public key is saved; your system SSH config is unchanged.",
+ "verifyConnect": "Fingerprint matches · Connect",
+ "title": "Remote connections",
+ "description": "Connect to nanobot on a server. Chats and settings stay there.",
+ "local": "Local nanobot",
+ "current": "Currently using",
+ "remote": "Remote",
+ "returnLocal": "Back to local nanobot",
+ "add": "Connect to remote nanobot…",
+ "addTitle": "Connect to remote nanobot",
+ "addDescription": "Connect to a nanobot that's already running on your server.",
+ "host": "SSH address",
+ "name": "Name (optional)",
+ "namePlaceholder": "Team server",
+ "keyHint": "Uses your system's SSH keys. Model keys and conversations stay on the server.",
+ "advanced": "Advanced",
+ "sshPort": "SSH port",
+ "ssh_config": "SSH config file (optional)",
+ "identity_file": "Private key path (optional)",
+ "config_path": "Server's nanobot config path",
+ "runtime_user": "nanobot service account (optional)",
+ "saveConnect": "Save & connect",
+ "connecting": "Connecting…",
+ "opening": "Opening your server…",
+ "frameTitle": "nanobot on {{name}}",
+ "offline": "Server connection lost",
+ "noFallback": "You're still using remote nanobot. Nothing is sent to local nanobot.",
+ "reconnect": "Reconnect",
+ "manage": "Manage {{name}}",
+ "edit": "Edit connection",
+ "forget": "Forget server",
+ "forgetTitle": "Forget {{name}}?",
+ "forgetDescription": "Only this saved connection will be removed. nanobot, its keys and conversations on the server will stay untouched.",
+ "errors": {
+ "view_limit": "Three server views are already kept open. Disconnect one in Manage connections before opening another.",
+ "view_load_failed": "The server view is taking too long to load. Retry; your current view is unchanged.",
+ "same_instance": "This is the nanobot you are already using. No remote connection is needed.",
+ "ssh_config_unreadable": "This SSH config could not be read. Check its path, permissions and format.",
+ "local_port_in_use": "This connection's local port is in use. Close the conflicting application, or forget and add this server again.",
+ "host_key_scan_failed": "Couldn't retrieve this server's fingerprint. For jump hosts, verify it through your existing SSH configuration.",
+ "unknown": "Couldn't connect. Check the server and try again.",
+ "directory_unavailable": "Couldn't read your saved servers. Please try again.",
+ "ssh_unavailable": "Install the OpenSSH client on this machine to connect.",
+ "ssh_auth_failed": "SSH couldn't sign in. Check the username and key, and unlock your key in the system SSH agent if needed.",
+ "ssh_unreachable": "Can't reach SSH on this server. Check the address, port and network.",
+ "host_key_unknown": "This server hasn't been verified by SSH on this machine yet. Verify its host fingerprint with your administrator before connecting.",
+ "host_key_changed": "The server's SSH identity has changed. Connection blocked. Confirm this change with your administrator; don't bypass the warning.",
+ "local_file_not_found": "The SSH config or private key file couldn't be found on this machine.",
+ "runtime_user_denied": "SSH signed in, but cannot read as that service account without a password. Check the account with your server administrator.",
+ "python_unavailable": "The server needs python3 to locate its existing nanobot configuration.",
+ "config_not_found": "nanobot's config wasn't found. Set its server-side path in Advanced.",
+ "config_permission": "This SSH user can't read nanobot's config. Set the nanobot service account in Advanced.",
+ "config_invalid": "Couldn't read the server's nanobot configuration.",
+ "webui_disabled": "The server's WebUI is disabled. Enable it on the server first.",
+ "webui_auth_required": "The server needs a WebUI login secret in its config. No model key is needed here.",
+ "public_ws_unsupported": "This server uses a public WebSocket URL. This first version supports a loopback WebUI over SSH.",
+ "remote_auth_failed": "The server rejected its saved WebUI credential. Check its running configuration.",
+ "incompatible_gateway": "This endpoint isn't a compatible nanobot gateway. Update the server or check its configuration.",
+ "webui_unavailable": "The gateway is running, but its WebUI isn't installed.",
+ "remote_unreachable": "SSH connected, but the nanobot WebUI isn't responding. Check that it's running.",
+ "profile_store_invalid": "Saved connections couldn't be read. They haven't been overwritten.",
+ "invalid_profile": "Check the address, port and Advanced fields.",
+ "profile_not_found": "This saved server no longer exists. Refresh the list.",
+ "profile_limit": "You can save up to 20 servers.",
+ "connection_limit": "Disconnect an existing server before opening another connection.",
+ "disconnect_before_edit": "Disconnect this server before editing it.",
+ "local_io_error": "Couldn't save or open the connection. Check local file permissions.",
+ "invalid_remote_url": "The connection returned an unexpected address. It was blocked."
+ }
+ },
"previewTabs": {
"title": "미리보기",
"closeTab": "{{name}} 닫기",
diff --git a/webui/src/i18n/locales/pt-BR/common.json b/webui/src/i18n/locales/pt-BR/common.json
index 78ba410f3..80cd07bd3 100644
--- a/webui/src/i18n/locales/pt-BR/common.json
+++ b/webui/src/i18n/locales/pt-BR/common.json
@@ -1,4 +1,106 @@
{
+ "remote": {
+ "localShort": "Local",
+ "disconnectTitle": "Disconnect from {{name}}?",
+ "disconnectDescription": "This closes the server view and shared SSH connection. Unsaved work may be lost, and other tabs using this connection will disconnect. nanobot keeps running on the server.",
+ "hostBar": "Current connection",
+ "switchHost": "Switch host",
+ "manageConnections": "Manage connections…",
+ "ready": "Ready",
+ "preparing": "Connecting to {{name}}…",
+ "cancelSwitch": "Cancel switch",
+ "localEnvironment": "Local · {{name}}",
+ "sshHosts": "From your SSH config",
+ "sshHostsHint": "Choose a saved SSH host. Its username, key and port are inherited; no servers are contacted until you connect.",
+ "refreshHosts": "Refresh SSH hosts",
+ "searchHosts": "Search SSH hosts",
+ "useHost": "Use {{host}}",
+ "loadingHosts": "Reading SSH config…",
+ "noHosts": "No named hosts found. You can enter an SSH address below.",
+ "noMatchingHosts": "No matching hosts.",
+ "partialHosts": "Some entries couldn't be listed. You can still enter an alias or address manually.",
+ "otherConfig": "Use another SSH config file",
+ "configToRead": "SSH config file to read",
+ "readConfig": "Read hosts",
+ "discoveryError": "Couldn't read SSH hosts. Retry or enter an address manually.",
+ "portPlaceholder": "Use SSH config (normally 22)",
+ "loading": "Loading connections…",
+ "retry": "Retry",
+ "unavailable": "Open this page from a locally running nanobot to connect to servers over SSH.",
+ "back": "Back",
+ "disconnect": "Disconnect",
+ "verifyTitle": "Verify this server",
+ "verifyDescription": "Before connecting for the first time, compare this SSH fingerprint with your server console or administrator.",
+ "verifyHint": "Continue only if it matches. Only this server's public key is saved; your system SSH config is unchanged.",
+ "verifyConnect": "Fingerprint matches · Connect",
+ "title": "Remote connections",
+ "description": "Connect to nanobot on a server. Chats and settings stay there.",
+ "local": "Local nanobot",
+ "current": "Currently using",
+ "remote": "Remote",
+ "returnLocal": "Back to local nanobot",
+ "add": "Connect to remote nanobot…",
+ "addTitle": "Connect to remote nanobot",
+ "addDescription": "Connect to a nanobot that's already running on your server.",
+ "host": "SSH address",
+ "name": "Name (optional)",
+ "namePlaceholder": "Team server",
+ "keyHint": "Uses your system's SSH keys. Model keys and conversations stay on the server.",
+ "advanced": "Advanced",
+ "sshPort": "SSH port",
+ "ssh_config": "SSH config file (optional)",
+ "identity_file": "Private key path (optional)",
+ "config_path": "Server's nanobot config path",
+ "runtime_user": "nanobot service account (optional)",
+ "saveConnect": "Save & connect",
+ "connecting": "Connecting…",
+ "opening": "Opening your server…",
+ "frameTitle": "nanobot on {{name}}",
+ "offline": "Server connection lost",
+ "noFallback": "You're still using remote nanobot. Nothing is sent to local nanobot.",
+ "reconnect": "Reconnect",
+ "manage": "Manage {{name}}",
+ "edit": "Edit connection",
+ "forget": "Forget server",
+ "forgetTitle": "Forget {{name}}?",
+ "forgetDescription": "Only this saved connection will be removed. nanobot, its keys and conversations on the server will stay untouched.",
+ "errors": {
+ "view_limit": "Three server views are already kept open. Disconnect one in Manage connections before opening another.",
+ "view_load_failed": "The server view is taking too long to load. Retry; your current view is unchanged.",
+ "same_instance": "This is the nanobot you are already using. No remote connection is needed.",
+ "ssh_config_unreadable": "This SSH config could not be read. Check its path, permissions and format.",
+ "local_port_in_use": "This connection's local port is in use. Close the conflicting application, or forget and add this server again.",
+ "host_key_scan_failed": "Couldn't retrieve this server's fingerprint. For jump hosts, verify it through your existing SSH configuration.",
+ "unknown": "Couldn't connect. Check the server and try again.",
+ "directory_unavailable": "Couldn't read your saved servers. Please try again.",
+ "ssh_unavailable": "Install the OpenSSH client on this machine to connect.",
+ "ssh_auth_failed": "SSH couldn't sign in. Check the username and key, and unlock your key in the system SSH agent if needed.",
+ "ssh_unreachable": "Can't reach SSH on this server. Check the address, port and network.",
+ "host_key_unknown": "This server hasn't been verified by SSH on this machine yet. Verify its host fingerprint with your administrator before connecting.",
+ "host_key_changed": "The server's SSH identity has changed. Connection blocked. Confirm this change with your administrator; don't bypass the warning.",
+ "local_file_not_found": "The SSH config or private key file couldn't be found on this machine.",
+ "runtime_user_denied": "SSH signed in, but cannot read as that service account without a password. Check the account with your server administrator.",
+ "python_unavailable": "The server needs python3 to locate its existing nanobot configuration.",
+ "config_not_found": "nanobot's config wasn't found. Set its server-side path in Advanced.",
+ "config_permission": "This SSH user can't read nanobot's config. Set the nanobot service account in Advanced.",
+ "config_invalid": "Couldn't read the server's nanobot configuration.",
+ "webui_disabled": "The server's WebUI is disabled. Enable it on the server first.",
+ "webui_auth_required": "The server needs a WebUI login secret in its config. No model key is needed here.",
+ "public_ws_unsupported": "This server uses a public WebSocket URL. This first version supports a loopback WebUI over SSH.",
+ "remote_auth_failed": "The server rejected its saved WebUI credential. Check its running configuration.",
+ "incompatible_gateway": "This endpoint isn't a compatible nanobot gateway. Update the server or check its configuration.",
+ "webui_unavailable": "The gateway is running, but its WebUI isn't installed.",
+ "remote_unreachable": "SSH connected, but the nanobot WebUI isn't responding. Check that it's running.",
+ "profile_store_invalid": "Saved connections couldn't be read. They haven't been overwritten.",
+ "invalid_profile": "Check the address, port and Advanced fields.",
+ "profile_not_found": "This saved server no longer exists. Refresh the list.",
+ "profile_limit": "You can save up to 20 servers.",
+ "connection_limit": "Disconnect an existing server before opening another connection.",
+ "disconnect_before_edit": "Disconnect this server before editing it.",
+ "local_io_error": "Couldn't save or open the connection. Check local file permissions.",
+ "invalid_remote_url": "The connection returned an unexpected address. It was blocked."
+ }
+ },
"previewTabs": {
"title": "Prévia",
"closeTab": "Fechar {{name}}",
diff --git a/webui/src/i18n/locales/vi/common.json b/webui/src/i18n/locales/vi/common.json
index e8b28263e..a7c309f9e 100644
--- a/webui/src/i18n/locales/vi/common.json
+++ b/webui/src/i18n/locales/vi/common.json
@@ -1,4 +1,106 @@
{
+ "remote": {
+ "localShort": "Local",
+ "disconnectTitle": "Disconnect from {{name}}?",
+ "disconnectDescription": "This closes the server view and shared SSH connection. Unsaved work may be lost, and other tabs using this connection will disconnect. nanobot keeps running on the server.",
+ "hostBar": "Current connection",
+ "switchHost": "Switch host",
+ "manageConnections": "Manage connections…",
+ "ready": "Ready",
+ "preparing": "Connecting to {{name}}…",
+ "cancelSwitch": "Cancel switch",
+ "localEnvironment": "Local · {{name}}",
+ "sshHosts": "From your SSH config",
+ "sshHostsHint": "Choose a saved SSH host. Its username, key and port are inherited; no servers are contacted until you connect.",
+ "refreshHosts": "Refresh SSH hosts",
+ "searchHosts": "Search SSH hosts",
+ "useHost": "Use {{host}}",
+ "loadingHosts": "Reading SSH config…",
+ "noHosts": "No named hosts found. You can enter an SSH address below.",
+ "noMatchingHosts": "No matching hosts.",
+ "partialHosts": "Some entries couldn't be listed. You can still enter an alias or address manually.",
+ "otherConfig": "Use another SSH config file",
+ "configToRead": "SSH config file to read",
+ "readConfig": "Read hosts",
+ "discoveryError": "Couldn't read SSH hosts. Retry or enter an address manually.",
+ "portPlaceholder": "Use SSH config (normally 22)",
+ "loading": "Loading connections…",
+ "retry": "Retry",
+ "unavailable": "Open this page from a locally running nanobot to connect to servers over SSH.",
+ "back": "Back",
+ "disconnect": "Disconnect",
+ "verifyTitle": "Verify this server",
+ "verifyDescription": "Before connecting for the first time, compare this SSH fingerprint with your server console or administrator.",
+ "verifyHint": "Continue only if it matches. Only this server's public key is saved; your system SSH config is unchanged.",
+ "verifyConnect": "Fingerprint matches · Connect",
+ "title": "Remote connections",
+ "description": "Connect to nanobot on a server. Chats and settings stay there.",
+ "local": "Local nanobot",
+ "current": "Currently using",
+ "remote": "Remote",
+ "returnLocal": "Back to local nanobot",
+ "add": "Connect to remote nanobot…",
+ "addTitle": "Connect to remote nanobot",
+ "addDescription": "Connect to a nanobot that's already running on your server.",
+ "host": "SSH address",
+ "name": "Name (optional)",
+ "namePlaceholder": "Team server",
+ "keyHint": "Uses your system's SSH keys. Model keys and conversations stay on the server.",
+ "advanced": "Advanced",
+ "sshPort": "SSH port",
+ "ssh_config": "SSH config file (optional)",
+ "identity_file": "Private key path (optional)",
+ "config_path": "Server's nanobot config path",
+ "runtime_user": "nanobot service account (optional)",
+ "saveConnect": "Save & connect",
+ "connecting": "Connecting…",
+ "opening": "Opening your server…",
+ "frameTitle": "nanobot on {{name}}",
+ "offline": "Server connection lost",
+ "noFallback": "You're still using remote nanobot. Nothing is sent to local nanobot.",
+ "reconnect": "Reconnect",
+ "manage": "Manage {{name}}",
+ "edit": "Edit connection",
+ "forget": "Forget server",
+ "forgetTitle": "Forget {{name}}?",
+ "forgetDescription": "Only this saved connection will be removed. nanobot, its keys and conversations on the server will stay untouched.",
+ "errors": {
+ "view_limit": "Three server views are already kept open. Disconnect one in Manage connections before opening another.",
+ "view_load_failed": "The server view is taking too long to load. Retry; your current view is unchanged.",
+ "same_instance": "This is the nanobot you are already using. No remote connection is needed.",
+ "ssh_config_unreadable": "This SSH config could not be read. Check its path, permissions and format.",
+ "local_port_in_use": "This connection's local port is in use. Close the conflicting application, or forget and add this server again.",
+ "host_key_scan_failed": "Couldn't retrieve this server's fingerprint. For jump hosts, verify it through your existing SSH configuration.",
+ "unknown": "Couldn't connect. Check the server and try again.",
+ "directory_unavailable": "Couldn't read your saved servers. Please try again.",
+ "ssh_unavailable": "Install the OpenSSH client on this machine to connect.",
+ "ssh_auth_failed": "SSH couldn't sign in. Check the username and key, and unlock your key in the system SSH agent if needed.",
+ "ssh_unreachable": "Can't reach SSH on this server. Check the address, port and network.",
+ "host_key_unknown": "This server hasn't been verified by SSH on this machine yet. Verify its host fingerprint with your administrator before connecting.",
+ "host_key_changed": "The server's SSH identity has changed. Connection blocked. Confirm this change with your administrator; don't bypass the warning.",
+ "local_file_not_found": "The SSH config or private key file couldn't be found on this machine.",
+ "runtime_user_denied": "SSH signed in, but cannot read as that service account without a password. Check the account with your server administrator.",
+ "python_unavailable": "The server needs python3 to locate its existing nanobot configuration.",
+ "config_not_found": "nanobot's config wasn't found. Set its server-side path in Advanced.",
+ "config_permission": "This SSH user can't read nanobot's config. Set the nanobot service account in Advanced.",
+ "config_invalid": "Couldn't read the server's nanobot configuration.",
+ "webui_disabled": "The server's WebUI is disabled. Enable it on the server first.",
+ "webui_auth_required": "The server needs a WebUI login secret in its config. No model key is needed here.",
+ "public_ws_unsupported": "This server uses a public WebSocket URL. This first version supports a loopback WebUI over SSH.",
+ "remote_auth_failed": "The server rejected its saved WebUI credential. Check its running configuration.",
+ "incompatible_gateway": "This endpoint isn't a compatible nanobot gateway. Update the server or check its configuration.",
+ "webui_unavailable": "The gateway is running, but its WebUI isn't installed.",
+ "remote_unreachable": "SSH connected, but the nanobot WebUI isn't responding. Check that it's running.",
+ "profile_store_invalid": "Saved connections couldn't be read. They haven't been overwritten.",
+ "invalid_profile": "Check the address, port and Advanced fields.",
+ "profile_not_found": "This saved server no longer exists. Refresh the list.",
+ "profile_limit": "You can save up to 20 servers.",
+ "connection_limit": "Disconnect an existing server before opening another connection.",
+ "disconnect_before_edit": "Disconnect this server before editing it.",
+ "local_io_error": "Couldn't save or open the connection. Check local file permissions.",
+ "invalid_remote_url": "The connection returned an unexpected address. It was blocked."
+ }
+ },
"previewTabs": {
"title": "Xem trước",
"closeTab": "Đóng {{name}}",
diff --git a/webui/src/i18n/locales/zh-CN/common.json b/webui/src/i18n/locales/zh-CN/common.json
index a708a6756..bf11a02c3 100644
--- a/webui/src/i18n/locales/zh-CN/common.json
+++ b/webui/src/i18n/locales/zh-CN/common.json
@@ -1,4 +1,106 @@
{
+ "remote": {
+ "localShort": "本地",
+ "disconnectTitle": "断开与 {{name}} 的连接?",
+ "disconnectDescription": "将关闭此服务器页面及共享的 SSH 连接,可能丢失未保存的内容,并影响其他正在使用此连接的标签页。服务器上的 nanobot 会继续运行。",
+ "hostBar": "当前连接",
+ "switchHost": "切换主机",
+ "manageConnections": "管理连接…",
+ "ready": "已就绪",
+ "preparing": "正在连接 {{name}}…",
+ "cancelSwitch": "取消切换",
+ "localEnvironment": "本地 · {{name}}",
+ "sshHosts": "来自 SSH 配置",
+ "sshHostsHint": "选择已有主机,用户名、密钥和端口会沿用 SSH 配置。点击连接前不会访问服务器。",
+ "refreshHosts": "刷新 SSH 主机",
+ "searchHosts": "搜索 SSH 主机",
+ "useHost": "使用 {{host}}",
+ "loadingHosts": "正在读取 SSH 配置…",
+ "noHosts": "没有找到已命名的主机,也可以在下面手动输入 SSH 地址。",
+ "noMatchingHosts": "没有匹配的主机。",
+ "partialHosts": "部分配置未能列出,你仍可手动输入主机别名或地址。",
+ "otherConfig": "使用其他 SSH 配置文件",
+ "configToRead": "要读取的 SSH 配置文件",
+ "readConfig": "读取主机",
+ "discoveryError": "无法读取 SSH 主机,请重试或手动输入地址。",
+ "portPlaceholder": "沿用 SSH 配置(通常为 22)",
+ "loading": "正在读取连接…",
+ "retry": "重试",
+ "unavailable": "请从本地运行的 nanobot 打开此页面,才能通过 SSH 连接服务器。",
+ "back": "返回",
+ "disconnect": "断开连接",
+ "verifyTitle": "验证服务器身份",
+ "verifyDescription": "第一次连接前,请与服务器控制台或管理员核对下面的 SSH 指纹。",
+ "verifyHint": "指纹一致再继续。只保存这台服务器的公钥,不修改系统 SSH 配置。",
+ "verifyConnect": "指纹一致,继续连接",
+ "title": "远程连接",
+ "description": "连接服务器上的 nanobot,聊天和设置保留在服务器。",
+ "local": "本地 nanobot",
+ "current": "正在使用",
+ "remote": "远程",
+ "returnLocal": "切回本地 nanobot",
+ "add": "连接远程 nanobot…",
+ "addTitle": "连接远程 nanobot",
+ "addDescription": "连接服务器上已经运行的 nanobot。",
+ "host": "SSH 地址",
+ "name": "名称(可选)",
+ "namePlaceholder": "团队服务器",
+ "keyHint": "使用系统 SSH 密钥。模型 Key 和会话留在服务器上。",
+ "advanced": "高级",
+ "sshPort": "SSH 端口",
+ "ssh_config": "SSH 配置文件(可选)",
+ "identity_file": "私钥路径(可选)",
+ "config_path": "服务器上的 nanobot 配置路径",
+ "runtime_user": "nanobot 运行账号(可选)",
+ "saveConnect": "保存并连接",
+ "connecting": "正在连接…",
+ "opening": "正在打开服务器…",
+ "frameTitle": "{{name}} 上的 nanobot",
+ "offline": "与服务器的连接已断开",
+ "noFallback": "当前仍在使用远程 nanobot,不会将操作转到本地 nanobot。",
+ "reconnect": "重新连接",
+ "manage": "管理 {{name}}",
+ "edit": "编辑连接",
+ "forget": "忘记服务器",
+ "forgetTitle": "忘记 {{name}}?",
+ "forgetDescription": "只移除本机保存的连接。服务器上的 nanobot、密钥和会话都不会被删除。",
+ "errors": {
+ "view_limit": "已保留 3 个服务器界面。请在管理连接中断开其中一个,再打开新服务器。",
+ "view_load_failed": "服务器界面加载较慢,请重试。当前界面保持不变。",
+ "same_instance": "这是你当前正在使用的 nanobot,无需再次连接。",
+ "ssh_config_unreadable": "无法读取此 SSH 配置,请检查文件路径、权限和格式。",
+ "local_port_in_use": "这个连接的本机端口正被其他程序占用。请关闭占用程序后重试,或忘记并重新添加连接。",
+ "host_key_scan_failed": "暂时无法获取服务器指纹。如果使用跳板机,请通过已有 SSH 配置验证身份。",
+ "unknown": "连接未成功,请检查服务器后重试。",
+ "directory_unavailable": "暂时无法读取已保存的服务器,请重试。",
+ "ssh_unavailable": "本机需要安装 OpenSSH 客户端才能连接。",
+ "ssh_auth_failed": "SSH 登录失败。请检查用户名和密钥;加密的密钥需要先在系统 SSH agent 中解锁。",
+ "ssh_unreachable": "无法连接服务器的 SSH,请检查地址、端口和网络。",
+ "host_key_unknown": "本机还没有验证过这台服务器。请先与服务器管理员核对 SSH 指纹后再连接。",
+ "host_key_changed": "服务器的 SSH 身份发生了变化,已阻止连接。请先与管理员确认,不要跳过这个警告。",
+ "local_file_not_found": "本机找不到指定的 SSH 配置文件或私钥。",
+ "runtime_user_denied": "SSH 已登录,但不能免密切换到这个运行账号,请与服务器管理员确认。",
+ "python_unavailable": "服务器需要 python3 来读取已有的 nanobot 配置。",
+ "config_not_found": "找不到 nanobot 配置,请在「高级」中填写它在服务器上的路径。",
+ "config_permission": "SSH 账号无权读取 nanobot 配置,请在「高级」中填写 nanobot 的运行账号。",
+ "config_invalid": "无法读取服务器上的 nanobot 配置。",
+ "webui_disabled": "服务器的 WebUI 尚未启用,请先在服务器上开启。",
+ "webui_auth_required": "服务器需要在配置中设置 WebUI 登录密钥。这里不需要模型 Key。",
+ "public_ws_unsupported": "这台服务器设置了公网 WebSocket 地址。首版支持通过 SSH 连接回环地址上的 WebUI。",
+ "remote_auth_failed": "服务器拒绝了 WebUI 登录凭据,请检查它实际运行的配置。",
+ "incompatible_gateway": "该地址不是兼容的 nanobot gateway,请检查配置或更新服务器版本。",
+ "webui_unavailable": "Gateway 在运行,但没有安装 WebUI。",
+ "remote_unreachable": "SSH 已连接,但 nanobot WebUI 没有响应,请确认它正在运行。",
+ "profile_store_invalid": "无法读取已保存的连接,原文件未被覆盖。",
+ "invalid_profile": "请检查服务器地址、端口和高级选项。",
+ "profile_not_found": "这个连接已不存在,请刷新列表。",
+ "profile_limit": "最多可以保存 20 台服务器。",
+ "connection_limit": "请先断开一台服务器,再建立新连接。",
+ "disconnect_before_edit": "请先断开这个服务器,再编辑连接信息。",
+ "local_io_error": "无法保存或打开连接,请检查本机文件权限。",
+ "invalid_remote_url": "连接返回了异常地址,已阻止打开。"
+ }
+ },
"previewTabs": {
"title": "预览",
"closeTab": "关闭 {{name}}",
diff --git a/webui/src/i18n/locales/zh-TW/common.json b/webui/src/i18n/locales/zh-TW/common.json
index e797dfe2b..09d6fb16b 100644
--- a/webui/src/i18n/locales/zh-TW/common.json
+++ b/webui/src/i18n/locales/zh-TW/common.json
@@ -1,4 +1,106 @@
{
+ "remote": {
+ "localShort": "本地",
+ "disconnectTitle": "中斷與 {{name}} 的連線?",
+ "disconnectDescription": "將關閉此伺服器頁面及共用的 SSH 連線,可能遺失未儲存的內容,並影響其他正在使用此連線的分頁。伺服器上的 nanobot 會繼續執行。",
+ "hostBar": "当前连接",
+ "switchHost": "切换主机",
+ "manageConnections": "管理连接…",
+ "ready": "已就绪",
+ "preparing": "正在连接 {{name}}…",
+ "cancelSwitch": "取消切换",
+ "localEnvironment": "Local · {{name}}",
+ "sshHosts": "From your SSH config",
+ "sshHostsHint": "Choose a saved SSH host. Its username, key and port are inherited; no servers are contacted until you connect.",
+ "refreshHosts": "Refresh SSH hosts",
+ "searchHosts": "Search SSH hosts",
+ "useHost": "Use {{host}}",
+ "loadingHosts": "Reading SSH config…",
+ "noHosts": "No named hosts found. You can enter an SSH address below.",
+ "noMatchingHosts": "No matching hosts.",
+ "partialHosts": "Some entries couldn't be listed. You can still enter an alias or address manually.",
+ "otherConfig": "Use another SSH config file",
+ "configToRead": "SSH config file to read",
+ "readConfig": "Read hosts",
+ "discoveryError": "Couldn't read SSH hosts. Retry or enter an address manually.",
+ "portPlaceholder": "Use SSH config (normally 22)",
+ "loading": "正在讀取連線…",
+ "retry": "重試",
+ "unavailable": "請從本機執行的 nanobot 開啟此頁面,才能透過 SSH 連線伺服器。",
+ "back": "Back",
+ "disconnect": "Disconnect",
+ "verifyTitle": "Verify this server",
+ "verifyDescription": "Before connecting for the first time, compare this SSH fingerprint with your server console or administrator.",
+ "verifyHint": "Continue only if it matches. Only this server's public key is saved; your system SSH config is unchanged.",
+ "verifyConnect": "Fingerprint matches · Connect",
+ "title": "Remote connections",
+ "description": "Connect to nanobot on a server. Chats and settings stay there.",
+ "local": "Local nanobot",
+ "current": "Currently using",
+ "remote": "Remote",
+ "returnLocal": "Back to local nanobot",
+ "add": "Connect to remote nanobot…",
+ "addTitle": "Connect to remote nanobot",
+ "addDescription": "Connect to a nanobot that's already running on your server.",
+ "host": "SSH address",
+ "name": "Name (optional)",
+ "namePlaceholder": "Team server",
+ "keyHint": "Uses your system's SSH keys. Model keys and conversations stay on the server.",
+ "advanced": "Advanced",
+ "sshPort": "SSH port",
+ "ssh_config": "SSH config file (optional)",
+ "identity_file": "Private key path (optional)",
+ "config_path": "Server's nanobot config path",
+ "runtime_user": "nanobot service account (optional)",
+ "saveConnect": "Save & connect",
+ "connecting": "Connecting…",
+ "opening": "Opening your server…",
+ "frameTitle": "nanobot on {{name}}",
+ "offline": "Server connection lost",
+ "noFallback": "You're still using remote nanobot. Nothing is sent to local nanobot.",
+ "reconnect": "Reconnect",
+ "manage": "Manage {{name}}",
+ "edit": "Edit connection",
+ "forget": "Forget server",
+ "forgetTitle": "Forget {{name}}?",
+ "forgetDescription": "Only this saved connection will be removed. nanobot, its keys and conversations on the server will stay untouched.",
+ "errors": {
+ "view_limit": "已保留 3 个服务器界面。请在管理连接中断开其中一个,再打开新服务器。",
+ "view_load_failed": "服务器界面加载较慢,请重试。当前界面保持不变。",
+ "same_instance": "This is the nanobot you are already using. No remote connection is needed.",
+ "ssh_config_unreadable": "This SSH config could not be read. Check its path, permissions and format.",
+ "local_port_in_use": "This connection's local port is in use. Close the conflicting application, or forget and add this server again.",
+ "host_key_scan_failed": "Couldn't retrieve this server's fingerprint. For jump hosts, verify it through your existing SSH configuration.",
+ "unknown": "Couldn't connect. Check the server and try again.",
+ "directory_unavailable": "Couldn't read your saved servers. Please try again.",
+ "ssh_unavailable": "Install the OpenSSH client on this machine to connect.",
+ "ssh_auth_failed": "SSH couldn't sign in. Check the username and key, and unlock your key in the system SSH agent if needed.",
+ "ssh_unreachable": "Can't reach SSH on this server. Check the address, port and network.",
+ "host_key_unknown": "This server hasn't been verified by SSH on this machine yet. Verify its host fingerprint with your administrator before connecting.",
+ "host_key_changed": "The server's SSH identity has changed. Connection blocked. Confirm this change with your administrator; don't bypass the warning.",
+ "local_file_not_found": "The SSH config or private key file couldn't be found on this machine.",
+ "runtime_user_denied": "SSH signed in, but cannot read as that service account without a password. Check the account with your server administrator.",
+ "python_unavailable": "The server needs python3 to locate its existing nanobot configuration.",
+ "config_not_found": "nanobot's config wasn't found. Set its server-side path in Advanced.",
+ "config_permission": "This SSH user can't read nanobot's config. Set the nanobot service account in Advanced.",
+ "config_invalid": "Couldn't read the server's nanobot configuration.",
+ "webui_disabled": "The server's WebUI is disabled. Enable it on the server first.",
+ "webui_auth_required": "The server needs a WebUI login secret in its config. No model key is needed here.",
+ "public_ws_unsupported": "This server uses a public WebSocket URL. This first version supports a loopback WebUI over SSH.",
+ "remote_auth_failed": "The server rejected its saved WebUI credential. Check its running configuration.",
+ "incompatible_gateway": "This endpoint isn't a compatible nanobot gateway. Update the server or check its configuration.",
+ "webui_unavailable": "The gateway is running, but its WebUI isn't installed.",
+ "remote_unreachable": "SSH connected, but the nanobot WebUI isn't responding. Check that it's running.",
+ "profile_store_invalid": "Saved connections couldn't be read. They haven't been overwritten.",
+ "invalid_profile": "Check the address, port and Advanced fields.",
+ "profile_not_found": "This saved server no longer exists. Refresh the list.",
+ "profile_limit": "You can save up to 20 servers.",
+ "connection_limit": "Disconnect an existing server before opening another connection.",
+ "disconnect_before_edit": "Disconnect this server before editing it.",
+ "local_io_error": "Couldn't save or open the connection. Check local file permissions.",
+ "invalid_remote_url": "The connection returned an unexpected address. It was blocked."
+ }
+ },
"previewTabs": {
"title": "預覽",
"closeTab": "關閉 {{name}}",
diff --git a/webui/src/lib/remote-instances.ts b/webui/src/lib/remote-instances.ts
new file mode 100644
index 000000000..6f792d66d
--- /dev/null
+++ b/webui/src/lib/remote-instances.ts
@@ -0,0 +1,81 @@
+import type { WebUIMutationTransport } from "./api";
+import { fetchWithTimeout } from "./http";
+
+export interface RemoteProfile {
+ id: string;
+ name: string;
+ host: string;
+ port: number | null;
+ ssh_config: string;
+ identity_file: string;
+ config_path: string;
+ runtime_user: string;
+ connected: boolean;
+}
+
+export interface RemoteDirectory {
+ available: boolean;
+ machine_name?: string;
+ profiles: RemoteProfile[];
+}
+
+export interface SSHDiscovery {
+ hosts: { host: string; source: string; ssh_config: string }[];
+ files: string[];
+ incomplete: boolean;
+}
+
+export interface RemoteConnection {
+ id: string;
+ name: string;
+ host: string;
+ hostname: string;
+ config_path: string;
+ gateway_id: string;
+ url: string;
+}
+
+export async function readRemoteInstances(token: string): Promise
{
+ const response = await fetchWithTimeout("/api/remote-instances", {
+ headers: { Authorization: `Bearer ${token}` },
+ });
+ if (response.status === 403 || response.status === 404) return { available: false, profiles: [] };
+ if (!response.ok) throw new Error("directory_unavailable");
+ return response.json() as Promise;
+}
+
+export function remoteAction(
+ client: WebUIMutationTransport, action: string, payload: Record,
+): Promise {
+ return client.requestMutation(`remote.${action}`, payload, 65_000);
+}
+
+/** Never let a server response navigate the shell to an arbitrary origin. */
+export function validateRemoteConnection(connection: RemoteConnection): RemoteConnection {
+ const url = new URL(connection.url);
+ if (url.protocol !== "http:" || url.hostname !== "127.0.0.1" || !url.port
+ || url.username || url.password || url.pathname !== "/") {
+ throw new Error("invalid_remote_url");
+ }
+ return connection;
+}
+
+export type SelectedRemote = Pick;
+const SELECTED_REMOTE = "nanobot.remote-instance";
+
+export function readSelectedRemote(): SelectedRemote | null {
+ try {
+ // A remote WebUI embedded by another nanobot must not inherit a local host's selector.
+ if (window.top !== window) return null;
+ const value = JSON.parse(window.sessionStorage.getItem(SELECTED_REMOTE) || "null") as SelectedRemote | null;
+ return value && /^[a-f0-9-]{36}$/.test(value.id) && typeof value.name === "string"
+ && typeof value.hostname === "string" ? value : null;
+ } catch { return null; }
+}
+
+export function rememberSelectedRemote(value: SelectedRemote | null): void {
+ try {
+ if (value) window.sessionStorage.setItem(SELECTED_REMOTE, JSON.stringify({ id: value.id, name: value.name, hostname: value.hostname }));
+ else window.sessionStorage.removeItem(SELECTED_REMOTE);
+ } catch { /* Storage can be disabled; the live connection still works. */ }
+}
diff --git a/webui/src/tests/app-layout.test.tsx b/webui/src/tests/app-layout.test.tsx
index 27be13240..b3a71cc10 100644
--- a/webui/src/tests/app-layout.test.tsx
+++ b/webui/src/tests/app-layout.test.tsx
@@ -679,6 +679,50 @@ describe("App layout", () => {
expect(window.location.hash).toBe("#/channels");
});
+ it("opens Remote connections in the main shell and restores it through browser history", async () => {
+ requestMutationSpy.mockResolvedValue({ hosts: [], files: [], incomplete: false });
+ mockFetchRoutes({
+ "/api/settings": baseSettingsPayload(),
+ "/api/remote-instances": { available: true, profiles: [] },
+ });
+ render();
+ await waitFor(() => expect(connectSpy).toHaveBeenCalled());
+ const sidebar = screen.getByRole("navigation", { name: "Sidebar navigation" });
+ const remote = await within(sidebar).findByRole("button", { name: "Remote connections" });
+ fireEvent.click(remote);
+ fireEvent.click(await screen.findByRole("button", { name: "Connect to remote nanobot…" }));
+ const host = await screen.findByRole("textbox", { name: "SSH address" });
+ expect(screen.getByRole("main")).toContainElement(host);
+ expect(sidebar).toBeVisible();
+ expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
+ expect(remote).toHaveAttribute("aria-current", "page");
+ expect(window.location.hash).toBe("#/remote");
+ expect(document.title).toBe("Remote connections · nanobot");
+ fireEvent.click(within(sidebar).getByRole("button", { name: "New topic" }));
+ expect(window.location.hash).toBe("#/new");
+ expect(screen.queryByRole("textbox", { name: "SSH address" })).not.toBeInTheDocument();
+ act(() => {
+ window.history.replaceState(null, "", "#/remote");
+ window.dispatchEvent(new PopStateEvent("popstate"));
+ });
+ expect(await screen.findByRole("region", { name: "From your SSH config" })).toBeVisible();
+ expect(remote).toHaveAttribute("aria-current", "page");
+ });
+
+ it("opens a remote setup deep link after reloading without opening Settings", async () => {
+ requestMutationSpy.mockResolvedValue({ hosts: [], files: [], incomplete: false });
+ window.history.replaceState(null, "", "#/remote");
+ mockFetchRoutes({
+ "/api/settings": baseSettingsPayload(),
+ "/api/remote-instances": { available: true, profiles: [] },
+ });
+ render();
+ expect(await screen.findByRole("region", { name: "From your SSH config" })).toBeVisible();
+ expect(screen.getByRole("navigation", { name: "Sidebar navigation" })).toBeVisible();
+ expect(screen.queryByRole("navigation", { name: "Settings sections" })).not.toBeInTheDocument();
+ expect(window.location.hash).toBe("#/remote");
+ });
+
it("highlights the blank new-topic destination immediately", async () => {
render();
diff --git a/webui/src/tests/host-bridge.test.tsx b/webui/src/tests/host-bridge.test.tsx
new file mode 100644
index 000000000..9f450a3a9
--- /dev/null
+++ b/webui/src/tests/host-bridge.test.tsx
@@ -0,0 +1,110 @@
+import { act, cleanup, renderHook } from "@testing-library/react";
+import { afterEach, describe, expect, it, vi } from "vitest";
+import { HOST_BRIDGE, isLocalShellOrigin, readHostAnchor } from "@/components/remote/host-bridge";
+import { useSidebarHostBridge } from "@/components/remote/useSidebarHostBridge";
+import type { HostFrame } from "@/components/remote/useHostSessions";
+const origin = "http://127.0.0.1:23456";
+const makeFrame = (id = "host-a"): HostFrame => ({
+ connection: { id, name: "Team server", host: "private-ssh-alias", hostname: "team-host", config_path: "/private/config.json", gateway_id: "gateway-1", url: `${origin}/#/?bootstrapSecret=never-share-this` },
+ loaded: true, offline: false, failures: 0,
+});
+const rect = { left: 60, top: 600, width: 120, height: 32 };
+function addFrame() {
+ const node = document.createElement("iframe");
+ // A detached frame avoids loading a page in the unit-test environment.
+ Object.defineProperty(node, "contentWindow", { value: { postMessage: vi.fn() } });
+ vi.spyOn(node, "getBoundingClientRect").mockReturnValue(new DOMRect(10, 20, 800, 800));
+ return node;
+}
+function send(source: Window, data: Record, from = origin) {
+ act(() => { window.dispatchEvent(new MessageEvent("message", { source, origin: from, data: { channel: HOST_BRIDGE, ...data } })); });
+}
+function parentView() {
+ const node = addFrame();
+ const source = node.contentWindow!;
+ const post = vi.spyOn(source, "postMessage").mockImplementation(() => {});
+ const nodes = { current: new Map([["host-a", node]]) };
+ const restore = vi.fn();
+ const hook = renderHook(({ selectedId }) => useSidebarHostBridge([makeFrame()], selectedId, nodes, restore, {}), {
+ initialProps: { selectedId: "host-a" as string | undefined },
+ });
+ send(source, { type: "hello" });
+ const init = post.mock.calls[0][0] as Record;
+ return { ...hook, node, source, post, init, restore };
+}
+afterEach(() => { cleanup(); document.querySelectorAll("iframe").forEach((node) => node.remove()); vi.restoreAllMocks(); vi.unstubAllGlobals(); });
+
+describe("sidebar host bridge", () => {
+ it("sends only current display identity, never secrets, profiles or filesystem paths", () => {
+ const { post, init } = parentView();
+ expect(post).toHaveBeenCalledWith(expect.objectContaining({ type: "init", name: "Team server", hostname: "team-host" }), origin);
+ const json = JSON.stringify(init);
+ expect(json).not.toContain("never-share-this");
+ expect(json).not.toContain("config.json");
+ expect(json).not.toContain("private-ssh-alias");
+ expect(init).not.toHaveProperty("profiles");
+ });
+
+ it("requires matching source, origin and nonce before enabling the sidebar or opening its menu", () => {
+ const { source, init, result } = parentView();
+ send(source, { type: "ready", nonce: "wrong" });
+ send(source, { type: "ready", nonce: init.nonce }, "https://attacker.example");
+ send(window, { type: "ready", nonce: init.nonce });
+ expect(result.current.readyIds).toEqual([]);
+ send(source, { type: "ready", nonce: init.nonce });
+ expect(result.current.readyIds).toEqual(["host-a"]);
+ send(source, { type: "open", nonce: init.nonce, anchor: rect });
+ expect(result.current.anchor).toEqual({ ...rect, left: 70, top: 620 });
+ });
+
+ it("ignores inactive frames and does not accept commands to connect, disconnect or navigate", () => {
+ const { source, init, result, rerender } = parentView();
+ for (const type of ["connect", "disconnect", "select", "navigate"]) send(source, { type, nonce: init.nonce, id: "another-host", url: "https://attacker.example" });
+ expect(result.current.anchor).toBeNull();
+ rerender({ selectedId: undefined });
+ send(source, { type: "open", nonce: init.nonce, anchor: rect });
+ expect(result.current.anchor).toBeNull();
+ });
+
+ it("rejects invalid anchor values without opening a menu", () => {
+ const { source, init, result } = parentView();
+ send(source, { type: "open", nonce: init.nonce, anchor: { ...rect, top: NaN } });
+ expect(result.current.anchor).toBeNull();
+ expect(readHostAnchor({ ...rect, width: -1 })).toBeNull();
+ expect(readHostAnchor({ ...rect, left: "0" })).toBeNull();
+ });
+
+ it("restores remote focus only through a verified sidebar bridge", () => {
+ const { source, init, result, post } = parentView();
+ send(source, { type: "ready", nonce: init.nonce });
+ act(() => result.current.focus("host-a"));
+ expect(post).toHaveBeenLastCalledWith({ channel: HOST_BRIDGE, type: "focus", nonce: init.nonce }, origin);
+ });
+
+ it("embedded mode trusts only its loopback parent and pins the handshake", () => {
+ const parent = addFrame().contentWindow!;
+ const post = vi.spyOn(parent, "postMessage").mockImplementation(() => {});
+ vi.stubGlobal("parent", parent);
+ const restore = vi.fn();
+ const nodes = { current: new Map() };
+ const { result } = renderHook(() => useSidebarHostBridge([], undefined, nodes, restore, {}));
+ expect(post).toHaveBeenCalledWith({ channel: HOST_BRIDGE, type: "hello" }, "*");
+ const nonce = crypto.randomUUID();
+ const init = { type: "init", nonce, name: "Team server", hostname: "team-host" };
+ send(parent, init, "https://attacker.example");
+ send(window, init, "http://127.0.0.1:8870");
+ expect(result.current.embedded).toBeNull();
+ send(parent, init, "http://127.0.0.1:8870");
+ expect(result.current.embedded?.name).toBe("Team server");
+ act(() => result.current.embedded?.open(rect));
+ expect(post).toHaveBeenLastCalledWith({ channel: HOST_BRIDGE, type: "open", nonce, anchor: rect }, "http://127.0.0.1:8870");
+ send(parent, { ...init, name: "Spoofed", nonce: crypto.randomUUID() }, "http://127.0.0.1:8870");
+ expect(result.current.embedded?.name).toBe("Team server");
+ send(parent, { type: "focus", nonce }, "http://127.0.0.1:8870");
+ expect(restore).toHaveBeenCalledOnce();
+ });
+
+ it.each(["null", "https://example.com", "http://127.0.0.1.evil.test", "file:///tmp/page", "http://127.0.0.1:8870/path"])("rejects non-shell origin %s", (value) => {
+ expect(isLocalShellOrigin(value)).toBe(false);
+ });
+});
diff --git a/webui/src/tests/host-sessions.test.tsx b/webui/src/tests/host-sessions.test.tsx
new file mode 100644
index 000000000..a827e97ea
--- /dev/null
+++ b/webui/src/tests/host-sessions.test.tsx
@@ -0,0 +1,168 @@
+import { act, cleanup, renderHook } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { useHostSessions, MAX_HOST_VIEWS } from "@/components/remote/useHostSessions";
+import type { RemoteConnection } from "@/lib/remote-instances";
+
+const mocks = vi.hoisted(() => ({ read: vi.fn(), request: vi.fn(), token: () => "token",
+ client: { requestMutation: (...args: unknown[]) => mocks.request(...args), onStatus: () => () => {} } }));
+vi.mock("@/providers/ClientProvider", () => ({ useClient: () => ({ client: mocks.client, getToken: mocks.token }) }));
+vi.mock("@/lib/remote-instances", async (original) => ({
+ ...await original(), readRemoteInstances: mocks.read,
+}));
+const ids = Array.from({ length: 4 }, (_, i) => `3b968d52-081d-4898-9970-ff0a1fc9381${i}`);
+const connections: RemoteConnection[] = ids.map((id, i) => ({ id, name: `Server ${i}`, hostname: `host-${i}`,
+ gateway_id: `gateway-${i}`, url: `http://127.0.0.1:${24000 + i}/#/?bootstrapSecret=secret` }));
+const directory = { available: true, profiles: connections.map((item) => ({ ...item, connected: true })) };
+const deferred = () => {
+ let resolve!: (value: T) => void;
+ let reject!: (reason: Error) => void;
+ const promise = new Promise((yes, no) => { resolve = yes; reject = no; });
+ return { promise, resolve, reject };
+};
+type Session = ReturnType;
+async function start(result: { current: Session }, index: number) {
+ let completion!: Promise;
+ await act(async () => { completion = result.current.connect(ids[index]); });
+ return { completion };
+}
+async function ready(result: { current: Session }, index: number) {
+ const { completion } = await start(result, index);
+ await act(async () => { result.current.loaded(ids[index]); await completion; });
+}
+
+beforeEach(() => {
+ vi.useFakeTimers();
+ window.sessionStorage.clear();
+ mocks.read.mockReset().mockResolvedValue(directory);
+ mocks.request.mockReset().mockImplementation(async (action: string, payload: { id: string }) =>
+ action === "remote.connect" ? connections.find((item) => item.id === payload.id) : {});
+});
+afterEach(() => { cleanup(); vi.useRealTimers(); vi.restoreAllMocks(); });
+
+describe("host session lifecycle", () => {
+ it("keeps the current host until the destination view loads, then switches warm without RPC", async () => {
+ const { result } = renderHook(useHostSessions);
+ await ready(result, 0);
+ const { completion } = await start(result, 1);
+ expect(result.current.selected?.id).toBe(ids[0]);
+ expect(result.current.pending?.id).toBe(ids[1]);
+ await act(async () => { result.current.loaded(ids[1]); await completion; });
+ expect(result.current.selected?.id).toBe(ids[1]);
+ await act(async () => { await result.current.connect(ids[0]); });
+ expect(result.current.selected?.id).toBe(ids[0]);
+ expect(mocks.request.mock.calls.filter(([action]) => action === "remote.connect")).toHaveLength(2);
+ });
+
+ it("retains views and shared tunnels when switching local, including after a long idle", async () => {
+ const { result } = renderHook(useHostSessions);
+ await ready(result, 0);
+ const frame = result.current.frames[0];
+ act(() => result.current.local());
+ await act(async () => { await vi.advanceTimersByTimeAsync(15 * 60_000); });
+ expect(result.current.selected).toBeNull();
+ expect(result.current.frames[0]).toBe(frame);
+ expect(mocks.request.mock.calls.some(([action]) => action === "remote.disconnect")).toBe(false);
+ await act(async () => { await result.current.connect(ids[0]); });
+ expect(result.current.selected?.id).toBe(ids[0]);
+ });
+
+ it("a failed destination leaves the active host usable", async () => {
+ const { result } = renderHook(useHostSessions);
+ await ready(result, 0);
+ mocks.request.mockRejectedValueOnce(new Error("ssh_unreachable"));
+ await act(async () => { await expect(result.current.connect(ids[1])).rejects.toThrow("ssh_unreachable"); });
+ expect(result.current.selected?.id).toBe(ids[0]);
+ expect(result.current.frames[0].offline).toBe(false);
+ expect(result.current.pending).toBeNull();
+ });
+
+ it("the latest choice wins even when an earlier SSH request finishes later", async () => {
+ const { result } = renderHook(useHostSessions);
+ const slow = deferred();
+ mocks.request.mockReturnValueOnce(slow.promise);
+ const first = await start(result, 0);
+ await ready(result, 1);
+ await act(async () => { slow.resolve(connections[0]); await first.completion; });
+ expect(result.current.selected?.id).toBe(ids[1]);
+ expect(result.current.frames).toHaveLength(1);
+ expect(mocks.request.mock.calls.some(([action]) => action === "remote.disconnect")).toBe(false);
+ });
+
+ it("cancelling SSH suppresses late errors and never activates a host", async () => {
+ const { result } = renderHook(useHostSessions);
+ const slow = deferred();
+ mocks.request.mockReturnValueOnce(slow.promise);
+ const first = await start(result, 0);
+ act(() => result.current.cancel());
+ await act(async () => { slow.reject(new Error("ssh_unreachable")); await first.completion; });
+ expect(result.current.selected).toBeNull();
+ expect(result.current.pending).toBeNull();
+ expect(result.current.error).toBe("");
+ });
+
+ it("cancelling page load releases an unused view slot and ignores a late load event", async () => {
+ const { result } = renderHook(useHostSessions);
+ const first = await start(result, 0);
+ await act(async () => { result.current.cancel(); await first.completion; });
+ act(() => result.current.loaded(ids[0]));
+ expect(result.current.selected).toBeNull();
+ expect(result.current.frames).toHaveLength(0);
+ expect(vi.getTimerCount()).toBe(1); // health interval only
+ });
+
+ it("a timed-out cold page leaves the old host intact and can be retried", async () => {
+ const { result } = renderHook(useHostSessions);
+ await ready(result, 0);
+ const { completion } = await start(result, 1);
+ const rejected = expect(completion).rejects.toThrow("view_load_failed");
+ await act(async () => { await vi.advanceTimersByTimeAsync(25_000); await rejected; });
+ expect(result.current.selected?.id).toBe(ids[0]);
+ expect(result.current.frames).toHaveLength(1);
+ await ready(result, 1);
+ expect(result.current.selected?.id).toBe(ids[1]);
+ });
+
+ it("a newer request for the same host is not removed by the previous cancelled load", async () => {
+ const { result } = renderHook(useHostSessions);
+ const first = await start(result, 0);
+ const second = await start(result, 0);
+ await act(async () => { result.current.loaded(ids[0]); await Promise.all([first.completion, second.completion]); });
+ expect(result.current.selected?.id).toBe(ids[0]);
+ expect(result.current.frames).toHaveLength(1);
+ });
+
+ it("bounds view memory without silently discarding user drafts", async () => {
+ const { result } = renderHook(useHostSessions);
+ for (let i = 0; i < MAX_HOST_VIEWS; i++) await ready(result, i);
+ await act(async () => { await expect(result.current.connect(ids[3])).rejects.toThrow("view_limit"); });
+ expect(result.current.frames.map((item) => item.connection.id)).toEqual(ids.slice(0, 3));
+ expect(result.current.selected?.id).toBe(ids[2]);
+ await act(async () => { await result.current.disconnect(ids[0]); });
+ expect(result.current.frames).toHaveLength(2);
+ await ready(result, 3);
+ expect(result.current.selected?.id).toBe(ids[3]);
+ });
+
+ it("releases an unfinished view when a same-host retry fails", async () => {
+ const { result } = renderHook(useHostSessions);
+ const first = await start(result, 0);
+ mocks.request.mockRejectedValueOnce(new Error("ssh_unreachable"));
+ await act(async () => {
+ await expect(result.current.connect(ids[0])).rejects.toThrow("ssh_unreachable");
+ await first.completion;
+ });
+ expect(result.current.frames).toHaveLength(0);
+ expect(result.current.selected).toBeNull();
+ });
+
+ it("explicit disconnect closes that view, but never stops the remote bot", async () => {
+ const { result } = renderHook(useHostSessions);
+ await ready(result, 0);
+ await ready(result, 1);
+ await act(async () => { await result.current.disconnect(ids[1]); });
+ expect(result.current.selected).toBeNull();
+ expect(result.current.frames.map((item) => item.connection.id)).toEqual([ids[0]]);
+ expect(mocks.request).toHaveBeenCalledWith("remote.disconnect", { id: ids[1] }, 65_000);
+ expect(mocks.request.mock.calls.some(([action]) => action.includes("stop"))).toBe(false);
+ });
+});
diff --git a/webui/src/tests/remote-instances.test.tsx b/webui/src/tests/remote-instances.test.tsx
new file mode 100644
index 000000000..c1d072b55
--- /dev/null
+++ b/webui/src/tests/remote-instances.test.tsx
@@ -0,0 +1,454 @@
+import { act, cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
+import { useState } from "react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { RemoteInstances } from "@/components/remote/RemoteInstances";
+import { RemoteConnectionsPage } from "@/components/remote/RemoteConnectionsPage";
+import { Sidebar } from "@/components/Sidebar";
+import { HOST_BRIDGE } from "@/components/remote/host-bridge";
+import { readSelectedRemote, rememberSelectedRemote, validateRemoteConnection, type RemoteConnection } from "@/lib/remote-instances";
+import i18n from "@/i18n";
+import type { Window as HappyWindow } from "happy-dom";
+
+(window as unknown as HappyWindow).happyDOM.settings.disableIframePageLoading = true;
+
+const mocks = vi.hoisted(() => {
+ const request = vi.fn();
+ const discover = vi.fn();
+ const onStatus = vi.fn();
+ return { read: vi.fn(), request, discover, onStatus, client: { status: "open", requestMutation: (action: string, payload: unknown, timeout: number) => action === "remote.discover" ? discover(payload) : request(action, payload, timeout), onStatus }, token: () => "local-token" };
+});
+vi.mock("@/providers/ClientProvider", () => ({ useClient: () => ({ client: mocks.client, getToken: mocks.token }) }));
+vi.mock("@/lib/remote-instances", async (original) => ({
+ ...await original(), readRemoteInstances: mocks.read,
+}));
+
+const profile = { id: "3b968d52-081d-4898-9970-ff0a1fc93817", name: "Team server", host: "ubuntu@example.test", port: 22, config_path: "~/.nanobot/config.json", ssh_config: "", identity_file: "", runtime_user: "", connected: false };
+const connection: RemoteConnection = { ...profile, hostname: "team-host", gateway_id: "gateway-1", url: "http://127.0.0.1:23456/#/?bootstrapSecret=private-secret" };
+const noop = () => {};
+function LocalShell({ collapsed = false, initialRemote = false }) {
+ const [remotePage, setRemotePage] = useState(initialRemote);
+ return <>
+ setRemotePage(false)} onSelect={noop} onRequestDelete={noop} onTogglePin={noop}
+ onRequestRename={noop} onToggleArchive={noop} onToggleGroup={noop}
+ onRequestRenameProject={noop} onNewChatInProject={noop} onOpenSettings={noop}
+ onOpenApps={noop} onOpenSkills={noop} onOpenAutomations={noop} onOpenChannels={noop}
+ onOpenRemoteConnections={() => setRemotePage(true)} activeUtility={remotePage ? "remote" : null}
+ onOpenSearch={noop} onToggleArchived={noop} />
+ {remotePage ? setRemotePage(false)} /> : <>Local conversations
>}
+ >;
+}
+const view = (collapsed = false, initialRemote = false) => render();
+
+beforeEach(async () => {
+ await i18n.changeLanguage("en");
+ window.sessionStorage.clear(); window.localStorage.clear();
+ mocks.onStatus.mockReset().mockImplementation((handler) => { handler("open"); return () => {}; });
+ mocks.read.mockReset().mockResolvedValue({ available: true, machine_name: "Xubin-Mac", profiles: [profile] });
+ mocks.discover.mockReset().mockResolvedValue({ hosts: [], files: [], incomplete: false });
+ mocks.request.mockReset().mockImplementation(async (action: string) => {
+ if (action === "remote.connect") return connection;
+ if (action === "remote.save") return { id: profile.id };
+ return {};
+ });
+});
+afterEach(() => { cleanup(); vi.restoreAllMocks(); vi.unstubAllGlobals(); });
+
+async function readyRemote() {
+ const frame = await screen.findByTitle("nanobot on Team server");
+ await act(async () => { fireEvent.load(frame); });
+ await waitFor(() => expect(readSelectedRemote()?.id).toBe(profile.id));
+ return frame;
+}
+async function chooseHost(name: string) {
+ fireEvent.pointerDown(screen.getByRole("button", { name: "Switch host" }), { button: 0, ctrlKey: false });
+ fireEvent.click(await screen.findByRole("menuitem", { name }));
+}
+async function openDirectory() {
+ fireEvent.click(await screen.findByRole("button", { name: "Remote connections" }));
+}
+
+describe("remote instance UX", () => {
+ it("places remote connections after Channels with the existing sidebar button style", async () => {
+ view();
+ const entry = await screen.findByRole("button", { name: "Remote connections" });
+ const channels = screen.getByRole("button", { name: "Channels" });
+ expect(channels.nextElementSibling).toBe(entry);
+ expect(entry).toHaveClass("h-8", "rounded-xl", "text-[13px]");
+ expect(entry).not.toHaveAttribute("aria-haspopup");
+ expect(entry).not.toHaveAttribute("aria-current");
+ expect(screen.queryByText("This machine")).not.toBeInTheDocument();
+ fireEvent.click(entry);
+ await screen.findByRole("heading", { name: "Remote connections" });
+ expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
+ expect(screen.getByRole("main")).toContainElement(screen.getByText("Team server"));
+ expect(entry).toHaveAttribute("aria-current", "page");
+ expect(screen.getByRole("navigation", { name: "Sidebar navigation" })).toBeVisible();
+ expect(screen.getByText("Local nanobot")).toBeInTheDocument();
+ expect(screen.getByText("Currently using")).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "Connect to remote nanobot…" })).toBeInTheDocument();
+ });
+
+ it("keeps the connection action accessible when the sidebar is collapsed", async () => {
+ view(true);
+ const entry = await screen.findByRole("button", { name: "Remote connections" });
+ expect(entry).toHaveClass("w-8", "justify-center");
+ expect(entry.textContent).toBe("");
+ const switcher = screen.getByRole("button", { name: "Switch host" });
+ expect(switcher).toHaveClass("w-8", "h-8");
+ expect(switcher).toHaveAttribute("title", expect.stringContaining("Xubin-Mac"));
+ fireEvent.click(entry);
+ await screen.findByRole("heading", { name: "Remote connections" });
+ });
+
+ it("moves the remote picker into a verified sidebar and can return local through its parent-owned menu", async () => {
+ view();
+ await screen.findByText("Local");
+ await chooseHost("Team server ubuntu@example.test");
+ const frame = await screen.findByTitle("nanobot on Team server");
+ const source = { postMessage: vi.fn() };
+ Object.defineProperty(frame, "contentWindow", { value: source });
+ await act(async () => { fireEvent.load(frame); });
+ await waitFor(() => expect(readSelectedRemote()?.id).toBe(profile.id));
+ expect(screen.getByTestId("legacy-host-footer")).toBeVisible();
+ const nonce = source.postMessage.mock.calls[0][0].nonce;
+ const message = (data: Record) => act(() => {
+ window.dispatchEvent(new MessageEvent("message", { source: source as unknown as Window,
+ origin: "http://127.0.0.1:23456", data: { channel: HOST_BRIDGE, nonce, ...data } }));
+ });
+ message({ type: "ready" });
+ expect(screen.queryByTestId("legacy-host-footer")).not.toBeInTheDocument();
+ message({ type: "open", anchor: { left: 40, top: 500, width: 150, height: 32 } });
+ expect(await screen.findByRole("menu")).toHaveAttribute("data-side", "top");
+ fireEvent.click(screen.getByRole("menuitem", { name: "Local nanobot Xubin-Mac" }));
+ await waitFor(() => expect(screen.getByText("Local conversations")).toBeVisible());
+ expect(frame).toBeInTheDocument();
+ expect(mocks.request.mock.calls.some(([action]) => action === "remote.disconnect")).toBe(false);
+ });
+
+ it("uses clear Chinese navigation and returns from the connection form without saving", async () => {
+ await i18n.changeLanguage("zh-CN");
+ view();
+ fireEvent.click(await screen.findByRole("button", { name: "远程连接" }));
+ expect(screen.getByText("本地 nanobot")).toBeInTheDocument();
+ fireEvent.click(screen.getByRole("button", { name: "连接远程 nanobot…" }));
+ expect(screen.getByRole("heading", { name: "连接远程 nanobot" })).toBeInTheDocument();
+ expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
+ fireEvent.click(screen.getByRole("button", { name: "返回" }));
+ expect(screen.getByRole("heading", { name: "远程连接" })).toBeInTheDocument();
+ expect(screen.queryByRole("textbox", { name: "SSH 地址" })).not.toBeInTheDocument();
+ expect(mocks.request).not.toHaveBeenCalled();
+ });
+
+ it("opens a saved server without asking for keys or configuration again", async () => {
+ view(); await openDirectory();
+ fireEvent.click(screen.getByRole("button", { name: "Team server ubuntu@example.test" }));
+ const frame = await readyRemote();
+ expect(frame).toHaveAttribute("src", connection.url);
+ expect(frame).toHaveAttribute("sandbox", expect.not.stringContaining("allow-top-navigation"));
+ expect(document.querySelector('[data-host-view="local"]')).toHaveAttribute("inert");
+ expect(screen.getByRole("button", { name: "Switch host" })).toHaveAttribute("title", expect.stringContaining("Team server · team-host"));
+ expect(mocks.request).toHaveBeenCalledWith("remote.connect", { id: profile.id }, 65_000);
+ expect(window.sessionStorage.getItem("nanobot.remote-instance")).not.toContain("secret");
+ const storedValues = Array.from({ length: window.localStorage.length }, (_, index) =>
+ window.localStorage.getItem(window.localStorage.key(index) || ""));
+ expect(JSON.stringify(storedValues)).not.toContain("private-secret");
+ expect(JSON.stringify(storedValues)).not.toContain(connection.url);
+ });
+
+ it("returning local keeps the saved server view and SSH warm", async () => {
+ view(); await openDirectory();
+ fireEvent.click(screen.getByRole("button", { name: "Team server ubuntu@example.test" }));
+ await readyRemote();
+ await chooseHost("Local nanobot Xubin-Mac");
+ expect(screen.getByRole("heading", { name: "Remote connections" })).toBeVisible();
+ expect(mocks.request.mock.calls.some(([action]) => action === "remote.disconnect")).toBe(false);
+ expect(readSelectedRemote()).toBeNull();
+ expect(mocks.request.mock.calls.some(([action]) => String(action).includes("stop"))).toBe(false);
+ });
+
+ it("keeps local drafts, view identity and keyboard focus across warm round trips", async () => {
+ view();
+ const draft = screen.getByRole("textbox", { name: "Local draft" });
+ draft.focus();
+ fireEvent.change(draft, { target: { value: "Unsent local draft" } });
+ await screen.findByText("Local");
+ await chooseHost("Team server ubuntu@example.test");
+ const frame = await readyRemote();
+ expect(draft).not.toBeVisible();
+ const shortcut = vi.fn();
+ window.addEventListener("keydown", shortcut);
+ fireEvent.keyDown(screen.getByRole("button", { name: "Switch host" }), { key: "b", metaKey: true });
+ expect(shortcut).not.toHaveBeenCalled();
+ window.removeEventListener("keydown", shortcut);
+ await chooseHost("Local nanobot Xubin-Mac");
+ await waitFor(() => expect(draft).toHaveFocus());
+ expect(screen.getByRole("textbox", { name: "Local draft" })).toBe(draft);
+ expect(draft).toHaveValue("Unsent local draft");
+ await chooseHost("Team server ubuntu@example.test Ready");
+ expect(screen.getByTitle("nanobot on Team server")).toBe(frame);
+ expect(mocks.request.mock.calls.filter(([action]) => action === "remote.connect")).toHaveLength(1);
+ });
+
+ it("can close an offline cached view, but confirms before discarding its state", async () => {
+ view(); await openDirectory();
+ fireEvent.click(screen.getByRole("button", { name: "Team server ubuntu@example.test" }));
+ await readyRemote();
+ await chooseHost("Local nanobot Xubin-Mac");
+ fireEvent.pointerDown(screen.getByRole("button", { name: "Manage Team server" }), { button: 0, ctrlKey: false });
+ fireEvent.click(await screen.findByRole("menuitem", { name: "Disconnect" }));
+ const dialog = await screen.findByRole("dialog", { name: "Disconnect from Team server?" });
+ expect(mocks.request.mock.calls.some(([action]) => action === "remote.disconnect")).toBe(false);
+ fireEvent.click(within(dialog).getByRole("button", { name: "Disconnect" }));
+ await waitFor(() => expect(screen.queryByTitle("nanobot on Team server")).not.toBeInTheDocument());
+ expect(mocks.request).toHaveBeenCalledWith("remote.disconnect", { id: profile.id }, 65_000);
+ });
+
+ it("refresh restores the selected remote, keeping the local shell hidden", async () => {
+ rememberSelectedRemote(connection);
+ view();
+ expect(screen.queryByText("Local conversations")).not.toBeVisible();
+ await readyRemote();
+ expect(mocks.request).toHaveBeenCalledWith("remote.connect", { id: profile.id }, 65_000);
+ });
+
+ it("failed restore stays remote and offers reconnect and an explicit return", async () => {
+ rememberSelectedRemote(connection);
+ mocks.request.mockRejectedValue(new Error("ssh_unreachable"));
+ view();
+ await screen.findByText("Server connection lost");
+ expect(screen.queryByText("Local conversations")).not.toBeVisible();
+ expect(screen.getByRole("button", { name: "Reconnect" })).toBeInTheDocument();
+ fireEvent.click(screen.getByRole("button", { name: "Back to local nanobot" }));
+ await screen.findByText("Local conversations");
+ });
+
+ it("waits for the local socket before restoring and restores only once", async () => {
+ let status: ((value: string) => void) | undefined;
+ const unsubscribe = vi.fn();
+ mocks.onStatus.mockImplementation((handler) => { status = handler; handler("connecting"); return unsubscribe; });
+ rememberSelectedRemote(connection);
+ const rendered = view();
+ expect(mocks.request).not.toHaveBeenCalled();
+ expect(screen.queryByText("Local conversations")).not.toBeVisible();
+ await act(async () => { status?.("open"); });
+ await readyRemote();
+ await act(async () => { status?.("reconnecting"); status?.("open"); });
+ expect(mocks.request).toHaveBeenCalledTimes(1);
+ rendered.unmount();
+ expect(unsubscribe).toHaveBeenCalled();
+ });
+
+ it("clears errors from an earlier connection when opening a server from the page", async () => {
+ rememberSelectedRemote(connection);
+ mocks.request.mockRejectedValue(new Error("ssh_unreachable"));
+ view();
+ await screen.findByText("Server connection lost");
+ fireEvent.click(screen.getByRole("button", { name: "Back to local nanobot" }));
+ await screen.findByText("Local conversations");
+ mocks.request.mockResolvedValue(connection);
+ await openDirectory();
+ fireEvent.click(screen.getByRole("button", { name: "Team server ubuntu@example.test" }));
+ await readyRemote();
+ expect(screen.queryByRole("alert")).not.toBeInTheDocument();
+ });
+
+ it("saves once and preserves entered fields when SSH authentication fails", async () => {
+ mocks.request.mockImplementation(async (action: string) => {
+ if (action === "remote.save") return { id: profile.id };
+ throw new Error("ssh_auth_failed");
+ });
+ view(); await openDirectory(); fireEvent.click(screen.getByRole("button", { name: "Connect to remote nanobot…" }));
+ fireEvent.change(screen.getByRole("textbox", { name: "SSH address" }), { target: { value: "ubuntu@example.test" } });
+ fireEvent.click(screen.getByRole("button", { name: "Save & connect" }));
+ await screen.findByRole("alert");
+ expect(screen.getByRole("textbox", { name: "SSH address" })).toHaveValue("ubuntu@example.test");
+ expect(screen.getByRole("button", { name: "Save & connect" })).toBeEnabled();
+ expect(mocks.request.mock.calls.filter(([action]) => action === "remote.save")).toHaveLength(1);
+ });
+
+ it("doesn't create privileged controls on an unsupported remote gateway", async () => {
+ mocks.read.mockResolvedValue({ available: false, profiles: [] });
+ view(); await waitFor(() => expect(mocks.read).toHaveBeenCalled());
+ expect(screen.queryByRole("button", { name: "Remote connections" })).not.toBeInTheDocument();
+ });
+
+ it("does not discover SSH hosts or expose nested connections inside a remote frame", async () => {
+ vi.stubGlobal("top", {});
+ view(false, true);
+ await screen.findByText(i18n.t("remote.unavailable"));
+ expect(mocks.read).not.toHaveBeenCalled();
+ expect(mocks.discover).not.toHaveBeenCalled();
+ expect(screen.queryByRole("button", { name: "Remote connections" })).not.toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: "Connect to remote nanobot…" })).not.toBeInTheDocument();
+ });
+
+ it("offers existing SSH hosts or manual inline setup for the first server", async () => {
+ mocks.read.mockResolvedValue({ available: true, profiles: [] });
+ view(); await openDirectory();
+ await screen.findByText("No named hosts found. You can enter an SSH address below.");
+ fireEvent.click(screen.getByRole("button", { name: "Connect to remote nanobot…" }));
+ const host = screen.getByRole("textbox", { name: "SSH address" });
+ expect(host.closest(".settings-row")).not.toBeNull();
+ expect(screen.getByRole("main")).toContainElement(host);
+ expect(screen.queryByRole("dialog")).not.toBeInTheDocument();
+ expect(screen.queryByRole("button", { name: "Connect to remote nanobot…" })).not.toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "Save & connect" })).toBeDisabled();
+ });
+
+ it("does not navigate to a remote instance after leaving a pending connection", async () => {
+ let finish: ((result: RemoteConnection) => void) | undefined;
+ mocks.request.mockImplementation(() => new Promise((resolve) => { finish = resolve; }));
+ view(); await openDirectory();
+ fireEvent.click(screen.getByRole("button", { name: "Team server ubuntu@example.test" }));
+ fireEvent.click(screen.getByRole("button", { name: "New topic" }));
+ await act(async () => { finish?.(connection); });
+ expect(screen.getByText("Local conversations")).toBeVisible();
+ expect(screen.queryByTitle("nanobot on Team server")).not.toBeInTheDocument();
+ expect(readSelectedRemote()).toBeNull();
+ });
+
+ it("does not start SSH if the user leaves while a profile is saving", async () => {
+ let finish: ((result: { id: string }) => void) | undefined;
+ mocks.read.mockResolvedValue({ available: true, profiles: [] });
+ mocks.request.mockImplementation(() => new Promise<{ id: string }>((resolve) => { finish = resolve; }));
+ view(); await openDirectory();
+ fireEvent.click(screen.getByRole("button", { name: "Connect to remote nanobot…" }));
+ fireEvent.change(screen.getByRole("textbox", { name: "SSH address" }), { target: { value: "ubuntu@example.test" } });
+ fireEvent.click(screen.getByRole("button", { name: "Save & connect" }));
+ fireEvent.click(screen.getByRole("button", { name: "New topic" }));
+ await act(async () => { finish?.({ id: profile.id }); });
+ expect(mocks.request).toHaveBeenCalledTimes(1);
+ expect(screen.getByText("Local conversations")).toBeVisible();
+ });
+
+ it("keeps cached servers visible during refresh and lets users retry failed reads", async () => {
+ view();
+ await screen.findByRole("button", { name: "Remote connections" });
+ mocks.read.mockRejectedValue(new Error("directory_unavailable"));
+ await openDirectory();
+ await screen.findByRole("alert");
+ expect(screen.getByText("Team server")).toBeVisible();
+ mocks.read.mockResolvedValue({ available: true, profiles: [profile] });
+ fireEvent.click(screen.getByRole("button", { name: "Retry" }));
+ await waitFor(() => expect(screen.queryByRole("alert")).not.toBeInTheDocument());
+ expect(screen.getByText("Team server")).toBeVisible();
+ });
+
+ it("explains unavailable direct routes without displaying SSH controls", async () => {
+ mocks.read.mockResolvedValue({ available: false, profiles: [] });
+ view(false, true);
+ await screen.findByText("Open this page from a locally running nanobot to connect to servers over SSH.");
+ expect(screen.queryByRole("textbox", { name: "SSH address" })).not.toBeInTheDocument();
+ expect(mocks.request).not.toHaveBeenCalled();
+ });
+
+ it("identifies the host in the existing sidebar footer without a top bar", async () => {
+ view();
+ const identity = await screen.findByRole("button", { name: "Switch host" });
+ expect(identity).toHaveTextContent("Local");
+ expect(identity).toHaveAttribute("title", expect.stringContaining("Xubin-Mac"));
+ expect(screen.getByRole("navigation", { name: "Sidebar navigation" })).toContainElement(identity);
+ expect(document.querySelector("header")).toBeNull();
+ fireEvent.pointerDown(identity, { button: 0, ctrlKey: false });
+ expect(await screen.findByRole("menuitem", { name: "Local nanobot Xubin-Mac" })).toBeVisible();
+ expect(screen.getByRole("menuitem", { name: "Manage connections…" })).toBeVisible();
+ });
+
+ it("discovers and filters SSH aliases without connecting, then inherits the selected config", async () => {
+ mocks.discover.mockResolvedValue({ hosts: [
+ { host: "team-sg", source: "/home/test/.ssh/config", ssh_config: "" },
+ { host: "staging", source: "/home/test/.ssh/hosts", ssh_config: "" },
+ ], files: ["/home/test/.ssh/config"], incomplete: false });
+ view(); await openDirectory();
+ await screen.findByRole("button", { name: "Use team-sg" });
+ expect(mocks.request).not.toHaveBeenCalled();
+ fireEvent.change(screen.getByRole("textbox", { name: "Search SSH hosts" }), { target: { value: "team" } });
+ expect(screen.queryByRole("button", { name: "Use staging" })).not.toBeInTheDocument();
+ fireEvent.click(screen.getByRole("button", { name: "Use team-sg" }));
+ expect(screen.getByRole("textbox", { name: "SSH address" })).toHaveValue("team-sg");
+ fireEvent.click(screen.getByRole("button", { name: "Save & connect" }));
+ await readyRemote();
+ expect(mocks.request).toHaveBeenCalledWith("remote.save", expect.objectContaining({ profile: expect.objectContaining({ host: "team-sg", ssh_config: "", port: null }) }), 65_000);
+ });
+
+ it("reads a custom SSH config and carries that path to the selected profile", async () => {
+ view(); await openDirectory();
+ fireEvent.click(screen.getByRole("button", { name: "Use another SSH config file" }));
+ fireEvent.change(screen.getByRole("textbox", { name: "SSH config file to read" }), { target: { value: "/team/ssh_config" } });
+ mocks.discover.mockResolvedValue({ hosts: [{ host: "team", source: "/team/ssh_config", ssh_config: "/team/ssh_config" }], files: ["/team/ssh_config"], incomplete: false });
+ fireEvent.click(screen.getByRole("button", { name: "Read hosts" }));
+ fireEvent.click(await screen.findByRole("button", { name: "Use team" }));
+ fireEvent.click(screen.getByRole("button", { name: "Advanced options" }));
+ expect(screen.getByRole("textbox", { name: "SSH config file (optional)" })).toHaveValue("/team/ssh_config");
+ expect(screen.getByRole("spinbutton", { name: "SSH port" })).toHaveValue(null);
+ expect(mocks.discover).toHaveBeenCalledWith({ ssh_config: "/team/ssh_config" });
+ const reads = mocks.discover.mock.calls.length;
+ fireEvent.click(screen.getByRole("button", { name: "Back" }));
+ expect(screen.getByRole("button", { name: "Use team" })).toBeVisible();
+ expect(screen.getByRole("textbox", { name: "SSH config file to read" })).toHaveValue("/team/ssh_config");
+ expect(mocks.discover).toHaveBeenCalledTimes(reads);
+ });
+
+ it("keeps manual entry available for an invalid discovery response", async () => {
+ mocks.discover.mockResolvedValue({ hosts: [{}], files: [], incomplete: false });
+ view(); await openDirectory();
+ await screen.findByRole("alert");
+ fireEvent.click(screen.getByRole("button", { name: "Connect to remote nanobot…" }));
+ expect(screen.getByRole("textbox", { name: "SSH address" })).toBeVisible();
+ expect(mocks.request).not.toHaveBeenCalled();
+ });
+
+ it("keeps manual setup available when discovery fails and does not clear cached hosts", async () => {
+ mocks.discover.mockResolvedValue({ hosts: [{ host: "team", source: "/config", ssh_config: "/config" }], files: ["/config"], incomplete: false });
+ view(); await openDirectory();
+ await screen.findByRole("button", { name: "Use team" });
+ mocks.discover.mockRejectedValue(new Error("ssh_config_unreadable"));
+ fireEvent.click(screen.getByRole("button", { name: "Refresh SSH hosts" }));
+ await screen.findByRole("alert");
+ expect(screen.getByRole("button", { name: "Use team" })).toBeVisible();
+ fireEvent.click(screen.getByRole("button", { name: "Connect to remote nanobot…" }));
+ expect(screen.getByRole("textbox", { name: "SSH address" })).toBeVisible();
+ });
+
+ it("requires an explicit fingerprint confirmation and never trusts a changed host", async () => {
+ mocks.request.mockImplementation(async (action: string) => {
+ if (action === "remote.connect") throw new Error("host_key_unknown");
+ if (action === "remote.fingerprint") return { fingerprint: "SHA256:example", challenge: "one-use" };
+ return {};
+ });
+ view(); await openDirectory();
+ fireEvent.click(screen.getByRole("button", { name: "Team server ubuntu@example.test" }));
+ await screen.findByText("SHA256:example");
+ expect(mocks.request.mock.calls.some(([action]) => action === "remote.trust")).toBe(false);
+ mocks.request.mockImplementation(async (action: string) => action === "remote.connect" ? connection : {});
+ fireEvent.click(screen.getByRole("button", { name: "Fingerprint matches · Connect" }));
+ await readyRemote();
+ expect(mocks.request).toHaveBeenCalledWith("remote.trust", { id: profile.id, challenge: "one-use" }, 65_000);
+ });
+
+ it("tolerates transient health failures and covers, rather than reloads, the remote frame", async () => {
+ let tick: (() => void) | undefined;
+ vi.spyOn(window, "setInterval").mockImplementation((callback, delay) => { if (delay === 5_000) tick = callback as () => void; return 1; });
+ view(); await openDirectory();
+ fireEvent.click(screen.getByRole("button", { name: "Team server ubuntu@example.test" }));
+ const frame = await readyRemote();
+ fireEvent.load(frame);
+ await act(async () => { tick?.(); });
+ expect(screen.queryByText("Server connection lost")).not.toBeInTheDocument();
+ await act(async () => { tick?.(); });
+ await screen.findByText("Server connection lost");
+ expect(screen.getByTitle("nanobot on Team server")).toBeInTheDocument();
+ expect(frame.parentElement).toHaveAttribute("inert");
+ expect(document.querySelector('[data-host-view="local"]')).toHaveAttribute("inert");
+ fireEvent.click(screen.getByRole("button", { name: "Reconnect" }));
+ await waitFor(() => expect(screen.queryByText("Server connection lost")).not.toBeInTheDocument());
+ expect(screen.queryByText("Opening your server…")).not.toBeInTheDocument();
+ expect(screen.getByTitle("nanobot on Team server")).toBe(frame);
+ expect(frame.parentElement).not.toHaveAttribute("inert");
+ });
+});
+
+it.each(["https://evil.example/", "http://user@127.0.0.1:23456/", "javascript:alert(1)", "http://127.0.0.1:23456/wrong"])("rejects unsafe navigation %s", (url) => {
+ expect(() => validateRemoteConnection({ ...connection, url })).toThrow();
+});