feat(webui): guide sandbox launcher recovery from chat
This commit is contained in:
1 parent
16250540d3
commit
f5e5bd6ea0
47 files changed
+613
-32
No files matched your search
@@ -2382,6 +2382,8 @@ With a Unix sandbox enabled, the selected shell and any requested login profile
|
||||
|
||||
In **Settings → Advanced → Command sandbox**, choose the host's isolation method and use **Check sandbox**. The gateway checks the saved configuration with a bounded, temporary test: launcher startup, workspace writes, and denial of an external test file. It does not run a user command, change the real workspace, or certify all security properties. The result describes the saved configuration, not a live command session; restart the gateway after saving to apply changes. Open **Advanced options** to set a trusted launcher path and the existing additional paths and command controls. An older host without this optional settings capability keeps the existing sandbox editor and does not receive check requests.
|
||||
|
||||
When command execution confirms a missing or rejected sandbox launcher, or the operating system rejects starting that launcher, the WebUI shows a small notice above the message input. **Check settings** opens the sandbox section; path errors also open its path editor. The notice does not take input focus, edit configuration, install software, turn isolation off, or retry a command. Closing it suppresses the same issue for the current turn; a new turn needs a fresh failure to show it again. Opening old conversation history does not replay notices. Ordinary command output and nonzero exit codes do not by themselves prove a sandbox fault; use **Check sandbox** to investigate other failures. For a custom package, obtain the protected component location from its maintainer rather than guessing a path.
|
||||
|
||||
NAS and other custom packages can provide their own launcher, but a file in an app's writable data directory is not safe to launch before isolation. For fnOS or similar installations, ask the package maintainer to install bubblewrap and its parent directories in a root-protected location, then set that absolute path. Finding `bwrap` in an interactive shell or venv does not establish that the gateway can launch it safely or that the kernel permits namespaces. A failed check must be resolved in the launcher installation, host kernel policy, or container setup; it does not turn isolation off. Existing configurations without `sandboxLauncher` retain the same defaults. Clearing this field restores system lookup; no chat or configuration migration is required.
|
||||
|
||||
## Pairing
|
||||
|
||||
@@ -198,15 +198,17 @@ class ToolResult(str):
|
||||
"""String-compatible tool output with structured status."""
|
||||
|
||||
is_error: bool
|
||||
error_code: str | None
|
||||
|
||||
def __new__(cls, content: str, *, is_error: bool = False) -> ToolResult:
|
||||
def __new__(cls, content: str, *, is_error: bool = False, error_code: str | None = None) -> ToolResult:
|
||||
obj = str.__new__(cls, content)
|
||||
obj.is_error = is_error
|
||||
obj.error_code = error_code
|
||||
return obj
|
||||
|
||||
@classmethod
|
||||
def error(cls, content: str) -> ToolResult:
|
||||
return cls(content, is_error=True)
|
||||
def error(cls, content: str, *, error_code: str | None = None) -> ToolResult:
|
||||
return cls(content, is_error=True, error_code=error_code)
|
||||
|
||||
|
||||
class Tool(ABC):
|
||||
|
||||
@@ -10,6 +10,7 @@ from typing import Any, cast
|
||||
from loguru import logger
|
||||
|
||||
from nanobot.agent.hook import AgentHook, AgentHookContext
|
||||
from nanobot.agent.tools.base import ToolResult
|
||||
from nanobot.agent.tools.context import tool_log_content_allowed
|
||||
from nanobot.agent.tools.file_state import file_read_context
|
||||
from nanobot.agent.tools.registry import ToolRegistry, is_tool_error_result, with_tool_error_hint
|
||||
@@ -222,6 +223,8 @@ async def _execute_tool_call_inner(
|
||||
"status": "error",
|
||||
"detail": result.replace("\n", " ").strip()[:120],
|
||||
}
|
||||
if isinstance(result, ToolResult) and result.error_code:
|
||||
event["error_code"] = result.error_code
|
||||
handled = _classify_violation(
|
||||
raw_text=result,
|
||||
soft_payload=payload,
|
||||
|
||||
@@ -204,7 +204,10 @@ class ToolRegistry:
|
||||
assert tool is not None # guarded by prepare_call()
|
||||
result = await tool.execute(**params)
|
||||
if is_tool_error_result(result):
|
||||
return ToolResult.error(with_tool_error_hint(str(result)))
|
||||
return ToolResult.error(
|
||||
with_tool_error_hint(str(result)),
|
||||
error_code=result.error_code if isinstance(result, ToolResult) else None,
|
||||
)
|
||||
return result
|
||||
except Exception as e:
|
||||
return ToolResult.error(with_tool_error_hint(f"Error executing {name}: {str(e)}"))
|
||||
|
||||
@@ -364,7 +364,13 @@ class ExecTool(Tool):
|
||||
result += "\nInitial wait ended; session remains active."
|
||||
return ToolResult.error(result) if poll.failed else result
|
||||
except Exception as exc:
|
||||
return ToolResult.error(f"Error executing command: {exc}")
|
||||
# Only an OS rejection of the actual launcher is attributable here.
|
||||
# A command's nonzero exit or stderr is not proof of a sandbox fault.
|
||||
code = "sandbox_start_failed" if (
|
||||
isinstance(exc, OSError) and self.sandbox and not _IS_WINDOWS
|
||||
and isinstance(prepared.command, list) and exc.filename == prepared.command[0]
|
||||
) else None
|
||||
return ToolResult.error(f"Error executing command: {exc}", error_code=code)
|
||||
|
||||
def _resolve_timeout(self, timeout: object) -> int | None:
|
||||
if timeout is not None:
|
||||
@@ -483,8 +489,12 @@ class ExecTool(Tool):
|
||||
)
|
||||
except SandboxLauncherError as exc:
|
||||
if exc.reason == "launcher_missing":
|
||||
return ToolResult.error(f"Error: sandbox launcher not found: {command[0]}")
|
||||
return ToolResult.error(f"Error: sandbox launcher rejected: {exc.reason}")
|
||||
return ToolResult.error(
|
||||
f"Error: sandbox launcher not found: {command[0]}", error_code="sandbox_launcher_missing",
|
||||
)
|
||||
return ToolResult.error(
|
||||
f"Error: sandbox launcher rejected: {exc.reason}", error_code=f"sandbox_{exc.reason}",
|
||||
)
|
||||
cwd = str(Path(workspace).resolve())
|
||||
|
||||
return _PreparedCommand(
|
||||
|
||||
@@ -133,6 +133,8 @@ def build_tool_event_finish_payloads(context: AgentHookContext) -> list[dict[str
|
||||
"embeds": embeds,
|
||||
}
|
||||
if phase == "error":
|
||||
if event.get("error_code"):
|
||||
payload["error_code"] = event["error_code"]
|
||||
if isinstance(result, str) and result.strip():
|
||||
payload["error"] = result.strip()
|
||||
else:
|
||||
|
||||
@@ -7,6 +7,8 @@ import pytest
|
||||
from agent.runner_helpers import make_run_spec
|
||||
from nanobot.agent.progress_hook import AgentProgressHook
|
||||
from nanobot.agent.runner import AgentRunner
|
||||
from nanobot.agent.tools.base import ToolResult
|
||||
from nanobot.agent.tools.registry import with_tool_error_hint
|
||||
from nanobot.config.schema import AgentDefaults
|
||||
from nanobot.providers.base import LLMResponse, ToolCallRequest
|
||||
from nanobot.utils.progress_events import output_events
|
||||
@@ -14,6 +16,40 @@ from nanobot.utils.progress_events import output_events
|
||||
_DEFAULTS = AgentDefaults()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_tool_error_code_is_display_metadata_not_model_content() -> None:
|
||||
provider, tools = MagicMock(), MagicMock()
|
||||
tool_call = ToolCallRequest(id="sandbox-call", name="exec", arguments={"command": "printf test"})
|
||||
responses = iter([
|
||||
LLMResponse(content="", tool_calls=[tool_call]),
|
||||
LLMResponse(content="Please check the installation.", tool_calls=[]),
|
||||
])
|
||||
provider.chat_stream_with_retry = AsyncMock(side_effect=lambda *a, **kw: next(responses))
|
||||
tools.get_definitions.return_value = []
|
||||
tools.prepare_call.return_value = (None, tool_call.arguments, None)
|
||||
text = "Error: sandbox launcher not found: bwrap"
|
||||
tools.execute = AsyncMock(return_value=ToolResult.error(text, error_code="sandbox_launcher_missing"))
|
||||
events: list[dict] = []
|
||||
|
||||
async def on_progress(content: str, *, tool_hint: bool = False, tool_events: list[dict] | None = None) -> None:
|
||||
events.extend(tool_events or [])
|
||||
|
||||
await AgentRunner().run(make_run_spec(
|
||||
provider, tools=tools, model="test", initial_messages=[{"role": "user", "content": "Run a command"}],
|
||||
max_iterations=3, max_tool_result_chars=_DEFAULTS.max_tool_result_chars,
|
||||
hook=AgentProgressHook(output_events(on_progress=on_progress)),
|
||||
))
|
||||
|
||||
finished = events[-1]
|
||||
assert finished["phase"] == "error"
|
||||
assert finished["error_code"] == "sandbox_launcher_missing"
|
||||
assert finished["error"] == with_tool_error_hint(text)
|
||||
request = provider.chat_stream_with_retry.call_args.kwargs
|
||||
tool_message = next(message for message in request["messages"] if message["role"] == "tool")
|
||||
assert tool_message["content"] == with_tool_error_hint(text)
|
||||
assert "error_code" not in tool_message
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_start_and_finish_events_emitted() -> None:
|
||||
provider = MagicMock()
|
||||
|
||||
@@ -10,6 +10,8 @@ from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
from nanobot.agent.tools.base import ToolResult
|
||||
from nanobot.agent.tools.exec_session import ExecSessionManager
|
||||
from nanobot.agent.tools.sandbox_check import check_sandbox, sandbox_settings_status
|
||||
from nanobot.agent.tools.sandbox_launcher import SandboxLauncherError, resolve_sandbox_launcher
|
||||
from nanobot.agent.tools.shell import ExecTool
|
||||
@@ -38,6 +40,7 @@ async def test_nonstandard_bwrap_is_not_silently_run_without_sandbox(tmp_path, m
|
||||
result = await tool.execute(command="printf ran > command-ran")
|
||||
|
||||
assert "sandbox launcher not found: bwrap" in result
|
||||
assert isinstance(result, ToolResult) and result.error_code == "sandbox_launcher_missing"
|
||||
assert not marker.exists()
|
||||
|
||||
|
||||
@@ -57,6 +60,9 @@ async def test_writable_custom_launcher_is_rejected_before_execution(tmp_path, l
|
||||
tool = ExecTool(working_dir=str(workspace), sandbox="bwrap", sandbox_launcher=str(launcher))
|
||||
response = await tool.execute(command="echo command-ran", shell="/bin/sh", login=True)
|
||||
assert "sandbox launcher rejected" in response
|
||||
assert isinstance(response, ToolResult) and response.error_code in {
|
||||
"sandbox_agent_writable", "sandbox_unprotected_installation",
|
||||
}
|
||||
assert not marker.exists()
|
||||
if sys.platform.startswith("linux"):
|
||||
status = await check_sandbox(config, workspace)
|
||||
@@ -149,6 +155,26 @@ async def test_native_probe_checks_isolation_without_touching_workspace(tmp_path
|
||||
# The same resolver and backend must work for actual command execution.
|
||||
tool = ExecTool(working_dir=str(tmp_path), sandbox=backend, sandbox_launcher=result["launcher"])
|
||||
assert "actual-command" in await tool.execute(command="printf actual-command")
|
||||
failed_command = await tool.execute(command="printf 'sandbox launcher not found: bwrap'; exit 1")
|
||||
assert "Exit code: 1" in failed_command
|
||||
assert (failed_command.error_code if isinstance(failed_command, ToolResult) else None) is None
|
||||
|
||||
|
||||
@pytest.mark.skipif(os.name != "posix", reason="Unix launch boundary")
|
||||
@pytest.mark.parametrize("failure_target", ["launcher", "cwd"])
|
||||
async def test_only_an_os_error_for_the_launcher_is_classified_as_a_sandbox_failure(tmp_path, monkeypatch, failure_target):
|
||||
backend = "seatbelt" if sys.platform == "darwin" else "bwrap"
|
||||
launcher = "/usr/bin/sandbox-exec" if backend == "seatbelt" else "/bin/sh"
|
||||
|
||||
async def start(*, command, cwd, **kwargs):
|
||||
raise PermissionError(13, "launch rejected", command[0] if failure_target == "launcher" else cwd)
|
||||
|
||||
manager = ExecSessionManager()
|
||||
monkeypatch.setattr(manager, "start", start)
|
||||
tool = ExecTool(working_dir=str(tmp_path), sandbox=backend, sandbox_launcher=launcher, session_manager=manager)
|
||||
result = await tool.execute(command="printf not-run")
|
||||
assert isinstance(result, ToolResult) and result.is_error
|
||||
assert result.error_code == ("sandbox_start_failed" if failure_target == "launcher" else None)
|
||||
|
||||
|
||||
async def test_missing_environment_launcher_does_not_fall_back_or_launch(tmp_path, monkeypatch):
|
||||
|
||||
@@ -425,14 +425,16 @@ async def test_registry_uses_structured_tool_result_for_errors(already_hinted: b
|
||||
)
|
||||
error_content = "Error: real failure" + (error_hint if already_hinted else "")
|
||||
failing_tool = _FakeTool("failing_tool")
|
||||
failing_tool.execute = AsyncMock(return_value=ToolResult.error(error_content))
|
||||
failing_tool.execute = AsyncMock(return_value=ToolResult.error(error_content, error_code="sandbox_launcher_missing"))
|
||||
registry.register(failing_tool)
|
||||
|
||||
error_result = await registry.execute("failing_tool", {})
|
||||
|
||||
assert isinstance(error_result, ToolResult)
|
||||
assert error_result.is_error
|
||||
assert error_result.error_code == "sandbox_launcher_missing"
|
||||
assert error_result == "Error: real failure" + error_hint
|
||||
assert json.dumps({"content": error_result}) == json.dumps({"content": "Error: real failure" + error_hint})
|
||||
|
||||
|
||||
def test_get_definitions_returns_cached_result() -> None:
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useState } from "react";
|
||||
|
||||
import { ModelFallbackNotice } from "@/components/thread/ModelFallbackNotice";
|
||||
import { RecoveryNotice } from "@/components/thread/RecoveryNotice";
|
||||
import { SandboxNotice } from "@/components/thread/SandboxNotice";
|
||||
import { StreamErrorNotice } from "@/components/thread/StreamErrorNotice";
|
||||
import { ThreadComposer } from "@/components/thread/ThreadComposer";
|
||||
import { ThreadMessages } from "@/components/thread/ThreadMessages";
|
||||
@@ -33,6 +34,8 @@ export function ChatFailureFixture({ parameters }: { parameters: URLSearchParams
|
||||
? <StreamErrorNotice error={{ kind: "model_request_failed", chatId: "fixture", errorKind: "authentication" }} onDismiss={dismiss} onOpenSettings={settings} />
|
||||
: parameters.get("notice") === "fallback"
|
||||
? <ModelFallbackNotice model="Fallback model" onDismiss={dismiss} onOpenSettings={settings} />
|
||||
: parameters.get("notice") === "sandbox"
|
||||
? <SandboxNotice issue="missing" onDismiss={dismiss} onOpenSettings={settings} />
|
||||
: <RecoveryNotice
|
||||
state={{ recovery_id: "fixture-recovery", status: "awaiting_user", reason: "model_request_failed", failure_error_kind: "authentication" }}
|
||||
onContinue={async () => { setVisible(false); setAction("continued"); }}
|
||||
|
||||
@@ -2,8 +2,8 @@ import { expect, test } from "@playwright/test";
|
||||
|
||||
for (const width of [1440, 390]) {
|
||||
for (const variant of ["thread", "hero"]) {
|
||||
for (const notice of ["recovery", "stream", "fallback"]) {
|
||||
test(`${notice} aligns with ${variant} composer at ${width}px`, async ({ page }) => {
|
||||
for (const notice of ["recovery", "stream", "fallback", "sandbox"]) {
|
||||
test(`${notice} aligns with ${variant} composer at ${width}px`, async ({ page }, info) => {
|
||||
await page.setViewportSize({ width, height: 1000 });
|
||||
await page.emulateMedia({ reducedMotion: "reduce" });
|
||||
await page.addInitScript(({ dark, locale }) => {
|
||||
@@ -29,6 +29,17 @@ for (const width of [1440, 390]) {
|
||||
expect(box.x + box.width).toBeLessThanOrEqual(noticeBox.x + noticeBox.width);
|
||||
}
|
||||
expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBeLessThanOrEqual(width);
|
||||
if (notice === "sandbox") {
|
||||
await expect(alert).toHaveAttribute("role", "status");
|
||||
await expect(alert).toHaveAttribute("aria-live", "polite");
|
||||
const input = page.getByRole("textbox");
|
||||
await input.fill("Keep this unsent draft / 保留草稿");
|
||||
await expect(input).toBeFocused();
|
||||
await alert.getByRole("button").first().click();
|
||||
await expect(page.getByLabel("Fixture action")).toHaveText("settings");
|
||||
await expect(input).toHaveValue("Keep this unsent draft / 保留草稿");
|
||||
await page.screenshot({ path: info.outputPath("sandbox-notice.png") });
|
||||
}
|
||||
if (notice === "recovery") {
|
||||
await expect(alert).toContainText(width === 390 ? "模型提供商验证失败" : "Model provider authorization failed");
|
||||
await alert.getByRole("button").first().click();
|
||||
|
||||
+18
-1
@@ -28,7 +28,7 @@ import { ComposerDraftStore, clearStoredComposerDrafts } from "@/lib/composer-dr
|
||||
import { activateReloadCache, clearReloadCache } from "@/lib/reload-cache";
|
||||
import { webuiThreadCache } from "@/lib/webui-thread-cache";
|
||||
import { ThreadVisibilityContext } from "@/hooks/useThreadVisibility";
|
||||
import type { SettingsExitGuard } from "@/components/settings/contracts";
|
||||
import type { SettingsExitGuard, SettingsFocusTarget } from "@/components/settings/contracts";
|
||||
import { PaneWorkbench } from "@/components/workbench/PaneWorkbench";
|
||||
import {
|
||||
MAX_WORKBENCH_PANES,
|
||||
@@ -140,6 +140,7 @@ type ShellRoute = {
|
||||
view: ShellView;
|
||||
activeKey: string | null;
|
||||
settingsSection: SettingsSectionKey;
|
||||
settingsFocus?: SettingsFocusTarget;
|
||||
temporary?: boolean;
|
||||
};
|
||||
const loadThreadShell = () => import("@/components/thread/ThreadShell");
|
||||
@@ -259,11 +260,13 @@ function readShellRoute(): ShellRoute {
|
||||
const temporary = Boolean(returnChat && "temporary" in returnChat && returnChat.temporary === true);
|
||||
|
||||
if (path === "/settings") {
|
||||
const focus = params.get("focus");
|
||||
return {
|
||||
view: shellViewForSettingsSection(settingsSection),
|
||||
activeKey,
|
||||
temporary,
|
||||
settingsSection,
|
||||
settingsFocus: settingsSection === "advanced" && (focus === "sandbox" || focus === "sandbox-launcher") ? focus : undefined,
|
||||
};
|
||||
}
|
||||
if (path === "/apps") {
|
||||
@@ -324,6 +327,7 @@ function shellRouteHash(route: ShellRoute): string {
|
||||
const params = new URLSearchParams();
|
||||
if (route.view === "settings" && route.settingsSection !== "overview") {
|
||||
params.set("section", route.settingsSection);
|
||||
if (route.settingsSection === "advanced" && route.settingsFocus) params.set("focus", route.settingsFocus);
|
||||
}
|
||||
const query = params.toString();
|
||||
return `#/${route.view}${query ? `?${query}` : ""}`;
|
||||
@@ -889,6 +893,7 @@ function Shell({
|
||||
const [temporaryChatEnabled, setTemporaryChatEnabled] = useState(false);
|
||||
const [settingsInitialSection, setSettingsInitialSection] =
|
||||
useState<SettingsSectionKey>(initialRouteRef.current.settingsSection);
|
||||
const [settingsFocus, setSettingsFocus] = useState<SettingsFocusTarget | undefined>(initialRouteRef.current.settingsFocus);
|
||||
const [hostSidebarOpen, setHostSidebarOpen] =
|
||||
useState<boolean>(readSidebarOpen);
|
||||
const [sidebarWidth, setSidebarWidth] = useState(readSidebarWidth);
|
||||
@@ -948,6 +953,7 @@ function Shell({
|
||||
const currentShellRouteRef = useRef<ShellRoute>({ view, activeKey, settingsSection: settingsInitialSection });
|
||||
currentShellRouteRef.current = {
|
||||
view, activeKey, settingsSection: settingsInitialSection,
|
||||
settingsFocus,
|
||||
temporary: Boolean(activeKey && temporarySessions[activeKey]),
|
||||
};
|
||||
const registerSettingsExitGuard = useCallback((guard: SettingsExitGuard | null) => {
|
||||
@@ -1007,6 +1013,7 @@ function Shell({
|
||||
setActiveKey(route.activeKey);
|
||||
setView(route.view);
|
||||
setSettingsInitialSection(route.settingsSection);
|
||||
setSettingsFocus(route.settingsFocus);
|
||||
writeShellRoute({
|
||||
...route,
|
||||
temporary: route.temporary || Boolean(route.activeKey && temporarySessionsRef.current[route.activeKey]),
|
||||
@@ -1034,6 +1041,7 @@ function Shell({
|
||||
setActiveKey(route.activeKey);
|
||||
setView(route.view);
|
||||
setSettingsInitialSection(route.settingsSection);
|
||||
setSettingsFocus(route.settingsFocus);
|
||||
writeShellRoute(route, true);
|
||||
setWorkspaceError(null);
|
||||
if (route.view === "chat" && !route.activeKey) setDraftWorkspaceScope(null);
|
||||
@@ -1043,6 +1051,7 @@ function Shell({
|
||||
setActiveKey(route.activeKey);
|
||||
setView(route.view);
|
||||
setSettingsInitialSection(route.settingsSection);
|
||||
setSettingsFocus(route.settingsFocus);
|
||||
setWorkspaceError(null);
|
||||
if (route.view === "chat" && !route.activeKey) {
|
||||
setDraftWorkspaceScope(null);
|
||||
@@ -1763,6 +1772,11 @@ function Shell({
|
||||
const onOpenModelSettings = useCallback(() => {
|
||||
onOpenSettings("models");
|
||||
}, [onOpenSettings]);
|
||||
const onOpenSandboxSettings = useCallback((target: SettingsFocusTarget) => {
|
||||
setSessionSearchOpen(false);
|
||||
navigate({ view: "settings", activeKey, settingsSection: "advanced", settingsFocus: target });
|
||||
setMobileSidebarOpen(false);
|
||||
}, [activeKey, navigate]);
|
||||
|
||||
const onOpenApps = useCallback(() => {
|
||||
setSessionSearchOpen(false);
|
||||
@@ -2596,6 +2610,7 @@ function Shell({
|
||||
settingsSnapshot={settingsSnapshot}
|
||||
settingsLoading={settingsLoading}
|
||||
onOpenModelSettings={onOpenModelSettings}
|
||||
onOpenSandboxSettings={onOpenSandboxSettings}
|
||||
skills={skills}
|
||||
/>
|
||||
);
|
||||
@@ -2662,6 +2677,7 @@ function Shell({
|
||||
settingsSnapshot={settingsSnapshot}
|
||||
settingsLoading={settingsLoading}
|
||||
onOpenModelSettings={onOpenModelSettings}
|
||||
onOpenSandboxSettings={onOpenSandboxSettings}
|
||||
skills={skills}
|
||||
/>
|
||||
);
|
||||
@@ -2681,6 +2697,7 @@ function Shell({
|
||||
registerExitGuard={registerSettingsExitGuard}
|
||||
themePreference={themePreference}
|
||||
initialSection={settingsInitialSection}
|
||||
focusTarget={settingsFocus}
|
||||
initialSettings={settingsSnapshot}
|
||||
showSidebar={view === "settings"}
|
||||
mainNavigationExpanded={showMainSidebar && hostSidebarOpen}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ChevronLeft } from "lucide-react";
|
||||
import { useCallback, useEffect, useRef, useState, type ReactNode } from "react";
|
||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogLayoutContext, DialogTitle } from "@/components/ui/dialog";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import type { SettingsExitGuard } from "@/components/settings/contracts";
|
||||
import type { SettingsExitGuard, SettingsFocusTarget } from "@/components/settings/contracts";
|
||||
import { isCapabilitySection, type SettingsSectionKey } from "@/components/settings/contracts";
|
||||
import { SettingsFeature } from "@/components/settings/shared/SettingsFeature";
|
||||
import type { EditCompletion } from "@/components/settings/shared/useEditCompletion";
|
||||
@@ -53,6 +53,7 @@ import { cn } from "@/lib/utils";
|
||||
|
||||
interface SettingsPageProps {
|
||||
registerExitGuard?: (guard: SettingsExitGuard | null) => void;
|
||||
focusTarget?: SettingsFocusTarget;
|
||||
controller: SettingsController;
|
||||
themePreference: ThemePreference;
|
||||
showSidebar: boolean;
|
||||
@@ -77,6 +78,7 @@ interface SettingsPageProps {
|
||||
|
||||
export function SettingsPage({
|
||||
registerExitGuard,
|
||||
focusTarget,
|
||||
controller,
|
||||
themePreference,
|
||||
showSidebar,
|
||||
@@ -196,6 +198,7 @@ export function SettingsPage({
|
||||
|
||||
const runtimeConfiguration = (page: RuntimeConfigPage) => settings && (
|
||||
<RuntimeConfigSettings page={page} settings={settings} state={controller.runtimeConfigState} client={client}
|
||||
focusTarget={page === "advanced" ? focusTarget : undefined}
|
||||
sandboxSupported={webuiCapabilities.includes("webui.sandbox-settings.v1")}
|
||||
onRestart={showSidebar ? undefined : restartViaSettingsSurface} isRestarting={restartInProgress}
|
||||
remoteBrowserAccess={remoteBrowserAccess}>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { SettingsPage } from "@/components/settings/SettingsPage";
|
||||
import type { SettingsExitGuard, SettingsSectionKey } from "@/components/settings/contracts";
|
||||
import type { SettingsExitGuard, SettingsFocusTarget, SettingsSectionKey } from "@/components/settings/contracts";
|
||||
import { useSettingsController } from "@/components/settings/useSettingsController";
|
||||
import type { SendAttachment, SendOptions } from "@/hooks/useNanobotStream";
|
||||
import type { ThemePreference } from "@/hooks/useTheme";
|
||||
@@ -11,6 +11,7 @@ interface SettingsViewProps {
|
||||
registerExitGuard?: (guard: SettingsExitGuard | null) => void;
|
||||
themePreference: ThemePreference;
|
||||
initialSection?: SettingsSectionKey;
|
||||
focusTarget?: SettingsFocusTarget;
|
||||
initialSettings?: SettingsPayload | null;
|
||||
showSidebar?: boolean;
|
||||
mainNavigationExpanded?: boolean;
|
||||
@@ -41,6 +42,7 @@ export function SettingsView({
|
||||
registerExitGuard,
|
||||
themePreference,
|
||||
initialSection = "overview",
|
||||
focusTarget,
|
||||
initialSettings = null,
|
||||
showSidebar = true,
|
||||
mainNavigationExpanded = false,
|
||||
@@ -74,6 +76,7 @@ export function SettingsView({
|
||||
return (
|
||||
<SettingsPage
|
||||
registerExitGuard={registerExitGuard}
|
||||
focusTarget={focusTarget}
|
||||
controller={controller}
|
||||
themePreference={themePreference}
|
||||
showSidebar={showSidebar}
|
||||
|
||||
@@ -40,3 +40,4 @@ export type ApplySettingsPayload = (
|
||||
) => void;
|
||||
|
||||
export type MaybeRestartHostEngine = (payload: RestartAwarePayload) => Promise<void>;
|
||||
export type SettingsFocusTarget = "sandbox" | "sandbox-launcher";
|
||||
@@ -6,10 +6,11 @@ import { SettingsGroup, SettingsRow } from "@/components/settings/shared/Setting
|
||||
import { Dialog, DialogContent, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
|
||||
import { Disclosure } from "@/components/ui/disclosure";
|
||||
|
||||
export function SettingsAdvancedOptions({ children }: { children: ReactNode }) {
|
||||
export function SettingsAdvancedOptions({ children, initialOpen = false }: { children: ReactNode; initialOpen?: boolean }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Disclosure
|
||||
initialOpen={initialOpen}
|
||||
summaryClassName="settings-list-inset flex min-h-12 cursor-pointer items-center justify-between gap-4 rounded-xl text-[13px] leading-5 text-muted-foreground settings-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
||||
summary={<>
|
||||
{t("settings.runtimeConfig.advancedOptions")}
|
||||
|
||||
@@ -17,7 +17,7 @@ import { updateRuntimeConfigSettings } from "@/lib/api";
|
||||
import { invalidateToolsCatalog } from "@/lib/tools-catalog-cache";
|
||||
import type { NanobotClient } from "@/lib/nanobot-client";
|
||||
import type { RuntimeConfigValue, SettingsPayload } from "@/lib/types";
|
||||
import type { ApplySettingsPayload } from "@/components/settings/contracts";
|
||||
import type { ApplySettingsPayload, SettingsFocusTarget } from "@/components/settings/contracts";
|
||||
|
||||
type Draft = string | boolean;
|
||||
|
||||
@@ -172,13 +172,14 @@ export function useRuntimeConfigSettings(
|
||||
export type RuntimeConfigController = ReturnType<typeof useRuntimeConfigSettings>;
|
||||
|
||||
export function RuntimeConfigSettings({
|
||||
page, settings, state, client, sandboxSupported = false, onRestart, isRestarting, remoteBrowserAccess, children,
|
||||
page, settings, state, client, sandboxSupported = false, onRestart, isRestarting, remoteBrowserAccess, children, focusTarget,
|
||||
}: {
|
||||
page: RuntimeConfigPage;
|
||||
settings: SettingsPayload;
|
||||
state: RuntimeConfigController;
|
||||
client?: NanobotClient;
|
||||
sandboxSupported?: boolean;
|
||||
focusTarget?: SettingsFocusTarget;
|
||||
onRestart?: () => void;
|
||||
isRestarting: boolean;
|
||||
remoteBrowserAccess: boolean;
|
||||
@@ -310,6 +311,7 @@ export function RuntimeConfigSettings({
|
||||
</section>
|
||||
);
|
||||
return sandbox ? <SandboxSettings key={group.id} settings={settings} state={state}
|
||||
focusTarget={focusTarget}
|
||||
client={client!} isRestarting={isRestarting}>{section}</SandboxSettings> : section;
|
||||
})}
|
||||
</div>
|
||||
|
||||
@@ -13,14 +13,16 @@ import { checkSandboxSettings } from "@/lib/api";
|
||||
import type { NanobotClient } from "@/lib/nanobot-client";
|
||||
import type { SandboxCheck, SettingsPayload } from "@/lib/types";
|
||||
import type { RuntimeConfigController } from "./RuntimeConfigSettings";
|
||||
import type { SettingsFocusTarget } from "@/components/settings/contracts";
|
||||
import { RUNTIME_CONFIG_FIELDS } from "./runtime-config-fields";
|
||||
|
||||
export function SandboxSettings({ settings, state, client, isRestarting, children }: {
|
||||
export function SandboxSettings({ settings, state, client, isRestarting, children, focusTarget }: {
|
||||
settings: SettingsPayload;
|
||||
state: RuntimeConfigController;
|
||||
client: NanobotClient;
|
||||
isRestarting: boolean;
|
||||
children: ReactNode;
|
||||
focusTarget?: SettingsFocusTarget;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const tx = (key: string) => t(`settings.sandbox.${key}`);
|
||||
@@ -30,6 +32,15 @@ export function SandboxSettings({ settings, state, client, isRestarting, childre
|
||||
const [checkError, setCheckError] = useState(false);
|
||||
const [confirmDisable, setConfirmDisable] = useState(false);
|
||||
const generation = useRef(0);
|
||||
const section = useRef<HTMLElement>(null);
|
||||
const launcherInput = useRef<HTMLInputElement>(null);
|
||||
useEffect(() => {
|
||||
if (!focusTarget) return;
|
||||
section.current?.scrollIntoView({ block: "start" });
|
||||
const target = focusTarget === "sandbox-launcher" && launcherInput.current && !launcherInput.current.disabled
|
||||
? launcherInput.current : section.current;
|
||||
target?.focus({ preventScroll: true });
|
||||
}, [focusTarget]);
|
||||
useEffect(() => {
|
||||
generation.current += 1;
|
||||
setResult(null);
|
||||
@@ -68,7 +79,7 @@ export function SandboxSettings({ settings, state, client, isRestarting, childre
|
||||
if (id === generation.current) setChecking(false);
|
||||
}
|
||||
};
|
||||
return <section aria-label={tx("title")}>
|
||||
return <section ref={section} tabIndex={-1} className="scroll-mt-6" aria-label={tx("title")}>
|
||||
<SettingsSectionTitle>{tx("title")}</SettingsSectionTitle>
|
||||
<SettingsGroup>
|
||||
<SettingsRow title={t("settings.runtimeConfig.fields.tools_exec_enable.label")}>
|
||||
@@ -98,12 +109,12 @@ export function SandboxSettings({ settings, state, client, isRestarting, childre
|
||||
{checkError ? <p role="alert" className="mt-2 text-caption text-destructive">{tx("checkError")}</p> : null}
|
||||
{error ? <p id="sandbox-settings-error" role="alert" className="mt-2 text-caption text-destructive">{error}</p> : null}
|
||||
</div>
|
||||
<SettingsAdvancedOptions>
|
||||
<SettingsAdvancedOptions initialOpen={focusTarget === "sandbox-launcher"}>
|
||||
{saved.supported_backend ? <div className="settings-list-inset pb-4 pt-2">
|
||||
<label htmlFor="runtime-tools.exec.sandbox_launcher" className="text-control-label">{tx("path")}</label>
|
||||
<p id="sandbox-launcher-help" className="mb-3 mt-1 text-caption leading-5 text-muted-foreground">{tx("pathHelp")}</p>
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<Input id="runtime-tools.exec.sandbox_launcher" className="min-w-0 flex-1 basis-56 text-ui" value={String(state.value(launcherField.path))}
|
||||
<Input ref={launcherInput} id="runtime-tools.exec.sandbox_launcher" className="min-w-0 flex-1 basis-56 text-ui" value={String(state.value(launcherField.path))}
|
||||
aria-invalid={state.invalidField === launcherField.path || undefined}
|
||||
aria-describedby={state.invalidField === launcherField.path ? "sandbox-launcher-help sandbox-settings-error" : "sandbox-launcher-help"}
|
||||
placeholder={tx("automatic")} disabled={busy} onChange={(event) => state.change(launcherField, event.target.value)} />
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import { ArrowRight, ShieldAlert, X } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
export type SandboxIssue = "missing" | "path" | "permissions" | "startup";
|
||||
|
||||
/** A command needs attention; the conversation itself is still usable. */
|
||||
export function SandboxNotice({ issue, onOpenSettings, onDismiss }: {
|
||||
issue: SandboxIssue;
|
||||
onOpenSettings: () => void;
|
||||
onDismiss: () => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
return <div role="status" aria-live="polite" aria-atomic="true"
|
||||
className="thread-composer-notice mb-2 flex items-start gap-3 rounded-control border border-border/60 bg-muted/40 px-3 py-3 text-caption text-foreground animate-in fade-in-0 slide-in-from-bottom-1 motion-reduce:animate-none">
|
||||
<ShieldAlert className="mt-0.5 h-4 w-4 shrink-0 text-muted-foreground" aria-hidden />
|
||||
<div className="flex min-w-0 flex-1 flex-wrap items-center gap-x-4 gap-y-2">
|
||||
<div className="min-w-0 flex-1 basis-64 leading-5">
|
||||
<p className="font-medium">{t("settings.sandbox.notice.title")}</p>
|
||||
<p className="mt-0.5 break-words text-muted-foreground">{t(`settings.sandbox.notice.${issue}`)}</p>
|
||||
</div>
|
||||
<Button variant="outline" size="sm" className="shrink-0 gap-1.5 rounded-full" onClick={onOpenSettings}>
|
||||
{t("settings.sandbox.notice.openSettings")}<ArrowRight className="h-3.5 w-3.5" aria-hidden />
|
||||
</Button>
|
||||
</div>
|
||||
<Button variant="ghost" size="icon" className="h-6 w-6 shrink-0 rounded-full text-muted-foreground"
|
||||
aria-label={t("common.dismiss")} onClick={onDismiss}><X className="h-3.5 w-3.5" aria-hidden /></Button>
|
||||
</div>;
|
||||
}
|
||||
@@ -13,6 +13,8 @@ import { SessionHandleLabel } from "@/components/SessionHandleLabel";
|
||||
import { PromptNavigator } from "@/components/thread/PromptNavigator";
|
||||
import { usePromptHistory } from "@/hooks/usePromptHistory";
|
||||
import { ModelFallbackNotice } from "@/components/thread/ModelFallbackNotice";
|
||||
import { SandboxNotice } from "@/components/thread/SandboxNotice";
|
||||
import { useSandboxNotice } from "@/components/thread/useSandboxNotice";
|
||||
import { RecoveryNotice } from "@/components/thread/RecoveryNotice";
|
||||
import { SubagentTasksProvider } from "@/components/thread/SubagentTasks";
|
||||
import { SubagentTaskDock } from "@/components/thread/SubagentTaskDock";
|
||||
@@ -254,6 +256,7 @@ interface ThreadShellProps {
|
||||
settingsSnapshot?: SettingsPayload | null;
|
||||
settingsLoading?: boolean;
|
||||
onOpenModelSettings?: () => void;
|
||||
onOpenSandboxSettings?: (target: "sandbox" | "sandbox-launcher") => void;
|
||||
skills?: SkillSummary[];
|
||||
}
|
||||
|
||||
@@ -476,6 +479,7 @@ export function ThreadShell({
|
||||
settingsSnapshot = null,
|
||||
settingsLoading = false,
|
||||
onOpenModelSettings,
|
||||
onOpenSandboxSettings,
|
||||
skills = [],
|
||||
}: ThreadShellProps) {
|
||||
const { t } = useTranslation();
|
||||
@@ -534,6 +538,7 @@ export function ThreadShell({
|
||||
reauthProvider?: string;
|
||||
dismissed: boolean;
|
||||
} | null>(null);
|
||||
const sandboxNotice = useSandboxNotice(client, chatId, webuiCapabilities.includes("webui.sandbox-settings.v1"));
|
||||
const [heroGreetingKey, setHeroGreetingKey] = useState(randomHeroGreetingKey);
|
||||
const [submittedViewportTurnId, setSubmittedViewportTurnId] = useState<string | null>(null);
|
||||
const { state: previewState, openFile, resolveFile, selectTab, closeTab, close: closePreview, setWidth: setFilePreviewWidth } =
|
||||
@@ -1353,6 +1358,12 @@ export function ThreadShell({
|
||||
onOpenSettings={onOpenModelSettings}
|
||||
/>
|
||||
) : null}
|
||||
{sandboxNotice.issue && onOpenSandboxSettings && !streamError && !recoveryState ? (
|
||||
<SandboxNotice issue={sandboxNotice.issue} onDismiss={sandboxNotice.dismiss}
|
||||
onOpenSettings={() => onOpenSandboxSettings(
|
||||
sandboxNotice.issue === "missing" || sandboxNotice.issue === "path" ? "sandbox-launcher" : "sandbox",
|
||||
)} />
|
||||
) : null}
|
||||
{restoredFirstDraft?.chatId === chatId && restoredFirstDraft.error ? (
|
||||
<p role="alert" className="px-3 text-sm text-destructive">{restoredFirstDraft.error}</p>
|
||||
) : null}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
|
||||
import type { NanobotClient } from "@/lib/nanobot-client";
|
||||
import { normalizeToolProgressEvents } from "@/lib/tool-traces";
|
||||
import type { SandboxIssue } from "./SandboxNotice";
|
||||
|
||||
const issues = new Map<string, SandboxIssue>([
|
||||
["sandbox_launcher_missing", "missing"],
|
||||
["sandbox_path_not_absolute", "path"],
|
||||
["sandbox_not_executable", "path"],
|
||||
["sandbox_path_unavailable", "path"],
|
||||
["sandbox_agent_writable", "permissions"],
|
||||
["sandbox_unprotected_installation", "permissions"],
|
||||
["sandbox_start_failed", "startup"],
|
||||
]);
|
||||
|
||||
/** Observe live execution only; opening history must not replay old warnings. */
|
||||
export function useSandboxNotice(client: NanobotClient, chatId: string | null, enabled: boolean) {
|
||||
const scope = useMemo(() => ({ client, chatId, enabled }), [client, chatId, enabled]);
|
||||
const [notice, setNotice] = useState<{
|
||||
scope: typeof scope;
|
||||
issue: SandboxIssue;
|
||||
turnId: string | null;
|
||||
dismissed: boolean;
|
||||
} | null>(null);
|
||||
useEffect(() => {
|
||||
setNotice(null);
|
||||
if (!enabled || !chatId) return;
|
||||
return client.onChat(chatId, (event) => {
|
||||
if ((event.event === "message_accepted" || event.event === "user_message") && event.starts_turn) {
|
||||
setNotice(null);
|
||||
return;
|
||||
}
|
||||
if (event.event !== "message") return;
|
||||
const latestTurn = client.getRunState(chatId).latestTurnId;
|
||||
if (event.turn_id && latestTurn && event.turn_id !== latestTurn) return;
|
||||
const turnId = event.turn_id ?? latestTurn;
|
||||
for (const tool of normalizeToolProgressEvents(event.tool_events)) {
|
||||
if (tool.name !== "exec") continue;
|
||||
if (tool.phase === "end") {
|
||||
setNotice(null);
|
||||
} else if (tool.phase === "error" && typeof tool.error_code === "string") {
|
||||
const issue = issues.get(tool.error_code);
|
||||
if (!issue) continue;
|
||||
setNotice((current) => current?.scope === scope && current.issue === issue && current.turnId === turnId
|
||||
? current : { scope, issue, turnId, dismissed: false });
|
||||
}
|
||||
}
|
||||
});
|
||||
}, [client, chatId, enabled, scope]);
|
||||
return {
|
||||
issue: enabled && notice?.scope === scope && !notice.dismissed ? notice.issue : null,
|
||||
dismiss: () => setNotice((current) => current?.scope === scope ? { ...current, dismissed: true } : current),
|
||||
};
|
||||
}
|
||||
@@ -47,15 +47,16 @@ export function DisclosureContent({
|
||||
}
|
||||
|
||||
export function Disclosure({
|
||||
summary, children, className, summaryClassName, contentClassName,
|
||||
summary, children, className, summaryClassName, contentClassName, initialOpen = false,
|
||||
}: {
|
||||
summary: ReactNode;
|
||||
children: ReactNode;
|
||||
className?: string;
|
||||
summaryClassName?: string;
|
||||
contentClassName?: string;
|
||||
initialOpen?: boolean;
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [open, setOpen] = useState(initialOpen);
|
||||
const id = useId();
|
||||
return (
|
||||
<div className={className}>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { ComposerUsagePopover, type ComposerRoundUsage } from "@/components/thre
|
||||
import type { ContextSnapshot } from "@/lib/types";
|
||||
import { ContextCompactionNotice } from "@/components/thread/ContextCompactionNotice";
|
||||
import { ModelFallbackNotice } from "@/components/thread/ModelFallbackNotice";
|
||||
import { SandboxNotice, type SandboxIssue } from "@/components/thread/SandboxNotice";
|
||||
import { ModelPresetBadge, type ModelPresetOption } from "@/components/thread/ModelPresetBadge";
|
||||
import { PromptNavigator } from "@/components/thread/PromptNavigator";
|
||||
import { RecoveryNotice } from "@/components/thread/RecoveryNotice";
|
||||
@@ -238,6 +239,26 @@ function RecoveryPreview() {
|
||||
</div>;
|
||||
}
|
||||
|
||||
function SandboxPreview() {
|
||||
const { t } = useGalleryTranslation();
|
||||
const [issue, setIssue] = useState<SandboxIssue>("missing");
|
||||
const [dismissed, setDismissed] = useState(false);
|
||||
const [opened, setOpened] = useState(false);
|
||||
return <div className="space-y-4">
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{(["missing", "permissions", "startup"] as const).map((value) => <Button key={value}
|
||||
variant={issue === value ? "secondary" : "outline"} size="sm" className="rounded-full"
|
||||
onClick={() => { setIssue(value); setDismissed(false); setOpened(false); }}>{t(`previews.sandbox.${value}`)}</Button>)}
|
||||
</div>
|
||||
<div className="thread-composer-stack">
|
||||
{!dismissed ? <SandboxNotice issue={issue} onDismiss={() => setDismissed(true)} onOpenSettings={() => setOpened(true)} /> : null}
|
||||
<ThreadComposer workspaceControlsHidden onSend={() => false} onStop={() => {}} />
|
||||
</div>
|
||||
<Button variant="outline" size="sm" onClick={() => setDismissed(false)}>{t("previews.fallback.showAgain")}</Button>
|
||||
<p role="status" className="text-caption text-muted-foreground">{t(`previews.sandbox.${opened ? "settingsAction" : "hint"}`)}</p>
|
||||
</div>;
|
||||
}
|
||||
|
||||
function FallbackPreview() {
|
||||
const { t } = useGalleryTranslation();
|
||||
const [mode, setMode] = useState<"fallback" | "reauth">("fallback");
|
||||
@@ -351,6 +372,9 @@ export const conversationExamples: ComponentExample[] = [
|
||||
{ title: "previews.fallback.title", files: ["thread/ModelFallbackNotice"], Preview: FallbackPreview,
|
||||
description: "previews.fallback.description", options: "previews.fallback.options",
|
||||
code: '<ModelFallbackNotice model="gpt-4.1" onDismiss={dismiss} onOpenSettings={openModelSettings} />' },
|
||||
{ title: "previews.sandbox.title", files: ["thread/SandboxNotice"], Preview: SandboxPreview,
|
||||
description: "previews.sandbox.description", options: "previews.sandbox.options",
|
||||
code: '<SandboxNotice issue="missing" onDismiss={dismiss} onOpenSettings={openSandboxSettings} />' },
|
||||
{ title: "previews.compaction.title", files: ["thread/ContextCompactionNotice"], Preview: CompactionPreview,
|
||||
description: "previews.compaction.description", options: "previews.compaction.options",
|
||||
code: '<ContextCompactionNotice compaction={{ id: "compaction-1", phase: "succeeded", announce: true }} />' },
|
||||
|
||||
@@ -179,6 +179,16 @@
|
||||
"reset": "Reset preview",
|
||||
"hint": "Select a recovery state, then try continuing or dismissing."
|
||||
},
|
||||
"sandbox": {
|
||||
"title": "Command notice",
|
||||
"description": "Use the production notice to compare missing components, unprotected installations, and startup failures.",
|
||||
"options": "The notice does not take focus or retry commands. Change its state, dismiss it, and keep typing.",
|
||||
"missing": "Component not found",
|
||||
"permissions": "Installation needs attention",
|
||||
"startup": "Startup unavailable",
|
||||
"hint": "Component demo only. No commands run and no settings change.",
|
||||
"settingsAction": "Requested sandbox settings (demo)."
|
||||
},
|
||||
"fallback": {
|
||||
"title": "ModelFallbackNotice · Model fallback",
|
||||
"description": "View fallback-model and expired-authorization notices, settings and dismissal.",
|
||||
|
||||
@@ -179,6 +179,16 @@
|
||||
"reset": "Restablecer vista previa",
|
||||
"hint": "Elige un estado de recuperación y prueba a continuar o cerrar."
|
||||
},
|
||||
"sandbox": {
|
||||
"title": "Aviso de comandos",
|
||||
"description": "Compara componentes ausentes, instalaciones sin protección y errores de inicio con el componente real.",
|
||||
"options": "El aviso no toma el foco ni reintenta comandos. Cambia el estado, ciérralo y sigue escribiendo.",
|
||||
"missing": "Componente no encontrado",
|
||||
"permissions": "Revisar instalación",
|
||||
"startup": "Inicio no disponible",
|
||||
"hint": "Solo demostración. No se ejecutan comandos ni se cambian ajustes.",
|
||||
"settingsAction": "Se solicitaron los ajustes del sandbox (demostración)."
|
||||
},
|
||||
"fallback": {
|
||||
"title": "ModelFallbackNotice · Modelo alternativo",
|
||||
"description": "Consulta avisos de modelo alternativo y autorización caducada, configuración y cierre.",
|
||||
|
||||
@@ -179,6 +179,16 @@
|
||||
"reset": "Réinitialiser l’aperçu",
|
||||
"hint": "Sélectionnez un état de reprise, puis essayez de continuer ou de fermer."
|
||||
},
|
||||
"sandbox": {
|
||||
"title": "Avis de commande",
|
||||
"description": "Comparez les composants manquants, les installations non protégées et les échecs de démarrage avec le composant réel.",
|
||||
"options": "L’avis ne prend pas le focus et ne relance aucune commande. Changez son état, fermez-le et continuez à saisir.",
|
||||
"missing": "Composant introuvable",
|
||||
"permissions": "Installation à vérifier",
|
||||
"startup": "Démarrage indisponible",
|
||||
"hint": "Démonstration uniquement. Aucune commande ni modification des paramètres.",
|
||||
"settingsAction": "Paramètres du bac à sable demandés (démonstration)."
|
||||
},
|
||||
"fallback": {
|
||||
"title": "ModelFallbackNotice · Modèle de secours",
|
||||
"description": "Consultez les avis de modèle de secours et d’autorisation expirée, puis les actions associées.",
|
||||
|
||||
@@ -179,6 +179,16 @@
|
||||
"reset": "Atur ulang pratinjau",
|
||||
"hint": "Pilih status pemulihan, lalu coba lanjutkan atau tutup."
|
||||
},
|
||||
"sandbox": {
|
||||
"title": "Pemberitahuan perintah",
|
||||
"description": "Bandingkan komponen yang hilang, pemasangan tidak terlindungi, dan kegagalan awal dengan komponen produksi.",
|
||||
"options": "Pemberitahuan tidak mengambil fokus atau mengulang perintah. Ubah status, tutup, lalu lanjutkan mengetik.",
|
||||
"missing": "Komponen tidak ditemukan",
|
||||
"permissions": "Pemasangan perlu diperiksa",
|
||||
"startup": "Tidak dapat dimulai",
|
||||
"hint": "Hanya demo komponen. Tidak ada perintah atau perubahan pengaturan.",
|
||||
"settingsAction": "Pengaturan sandbox diminta (demo)."
|
||||
},
|
||||
"fallback": {
|
||||
"title": "ModelFallbackNotice · Model cadangan",
|
||||
"description": "Lihat pemberitahuan model cadangan dan otorisasi kedaluwarsa, lalu coba pengaturan atau tutup.",
|
||||
|
||||
@@ -179,6 +179,16 @@
|
||||
"reset": "プレビューをリセット",
|
||||
"hint": "復旧状態を選び、続行または閉じる操作を試してください。"
|
||||
},
|
||||
"sandbox": {
|
||||
"title": "コマンドの通知",
|
||||
"description": "実際のコンポーネントで、コンポーネントの欠落、保護されていないインストール、起動失敗を比較します。",
|
||||
"options": "通知はフォーカスを奪わず、コマンドを再実行しません。状態を切り替え、閉じて入力を続けられます。",
|
||||
"missing": "コンポーネントが見つからない",
|
||||
"permissions": "インストールの確認が必要",
|
||||
"startup": "起動できない",
|
||||
"hint": "コンポーネントのデモです。コマンドの実行や設定の変更は行いません。",
|
||||
"settingsAction": "サンドボックス設定を開く操作(デモ)。"
|
||||
},
|
||||
"fallback": {
|
||||
"title": "ModelFallbackNotice · 代替モデル",
|
||||
"description": "代替モデルや認証期限切れの通知、設定と閉じる操作を確認できます。",
|
||||
|
||||
@@ -179,6 +179,16 @@
|
||||
"reset": "미리보기 초기화",
|
||||
"hint": "복구 상태를 선택한 후 계속하거나 닫아 보세요."
|
||||
},
|
||||
"sandbox": {
|
||||
"title": "명령 알림",
|
||||
"description": "실제 구성 요소로 누락된 구성 요소, 보호되지 않은 설치 위치, 시작 실패를 비교합니다.",
|
||||
"options": "알림은 포커스를 가져오거나 명령을 재시도하지 않습니다. 상태를 바꾸고 닫은 후 계속 입력할 수 있습니다.",
|
||||
"missing": "구성 요소 없음",
|
||||
"permissions": "설치 확인 필요",
|
||||
"startup": "시작 불가",
|
||||
"hint": "구성 요소 데모입니다. 명령 실행이나 설정 변경은 없습니다.",
|
||||
"settingsAction": "샌드박스 설정 열기 요청(데모)."
|
||||
},
|
||||
"fallback": {
|
||||
"title": "ModelFallbackNotice · 대체 모델",
|
||||
"description": "대체 모델과 인증 만료 알림, 설정 열기, 닫기를 확인합니다.",
|
||||
|
||||
@@ -179,6 +179,16 @@
|
||||
"reset": "Redefinir prévia",
|
||||
"hint": "Selecione um estado de recuperação e teste continuar ou fechar."
|
||||
},
|
||||
"sandbox": {
|
||||
"title": "Aviso de comandos",
|
||||
"description": "Compare componentes ausentes, instalações desprotegidas e falhas de inicialização com o componente real.",
|
||||
"options": "O aviso não toma o foco nem repete comandos. Mude o estado, feche-o e continue digitando.",
|
||||
"missing": "Componente não encontrado",
|
||||
"permissions": "Verificar instalação",
|
||||
"startup": "Inicialização indisponível",
|
||||
"hint": "Apenas demonstração. Nenhum comando é executado ou ajuste alterado.",
|
||||
"settingsAction": "Configurações do sandbox solicitadas (demonstração)."
|
||||
},
|
||||
"fallback": {
|
||||
"title": "ModelFallbackNotice · Modelo alternativo",
|
||||
"description": "Veja avisos de modelo alternativo e autorização expirada, configurações e fechamento.",
|
||||
|
||||
@@ -179,6 +179,16 @@
|
||||
"reset": "Đặt lại bản xem trước",
|
||||
"hint": "Chọn trạng thái khôi phục, rồi thử tiếp tục hoặc đóng."
|
||||
},
|
||||
"sandbox": {
|
||||
"title": "Thông báo lệnh",
|
||||
"description": "So sánh thành phần bị thiếu, vị trí cài đặt không được bảo vệ và lỗi khởi động bằng thành phần thực tế.",
|
||||
"options": "Thông báo không chiếm tiêu điểm hay tự chạy lại lệnh. Đổi trạng thái, đóng thông báo rồi tiếp tục nhập.",
|
||||
"missing": "Không tìm thấy thành phần",
|
||||
"permissions": "Cần kiểm tra cài đặt",
|
||||
"startup": "Không thể khởi động",
|
||||
"hint": "Chỉ minh họa thành phần. Không chạy lệnh hay thay đổi cài đặt.",
|
||||
"settingsAction": "Đã yêu cầu mở cài đặt sandbox (minh họa)."
|
||||
},
|
||||
"fallback": {
|
||||
"title": "ModelFallbackNotice · Mô hình dự phòng",
|
||||
"description": "Xem thông báo mô hình dự phòng, ủy quyền hết hạn và thử mở cài đặt hoặc đóng.",
|
||||
|
||||
@@ -179,6 +179,16 @@
|
||||
"reset": "重置预览",
|
||||
"hint": "选择恢复状态,再试用继续或关闭。"
|
||||
},
|
||||
"sandbox": {
|
||||
"title": "命令提示",
|
||||
"description": "使用正式提示组件,体验缺失组件、安装位置受限和启动异常三种状态。",
|
||||
"options": "提示不抢焦点,也不自动重试命令。可切换状态、关闭提示并继续输入。",
|
||||
"missing": "找不到组件",
|
||||
"permissions": "安装位置受限",
|
||||
"startup": "启动异常",
|
||||
"hint": "这里只演示组件,不会执行命令或修改设置。",
|
||||
"settingsAction": "已请求打开沙箱设置(演示)。"
|
||||
},
|
||||
"fallback": {
|
||||
"title": "ModelFallbackNotice · 模型回退",
|
||||
"description": "查看模型回退和授权失效提示。",
|
||||
|
||||
@@ -179,6 +179,16 @@
|
||||
"reset": "重設預覽",
|
||||
"hint": "選擇復原狀態,再試用繼續或關閉。"
|
||||
},
|
||||
"sandbox": {
|
||||
"title": "指令提示",
|
||||
"description": "使用正式提示元件,體驗缺少元件、安裝位置受限與啟動異常三種狀態。",
|
||||
"options": "提示不會搶焦點,也不會自動重試指令。可切換狀態、關閉提示並繼續輸入。",
|
||||
"missing": "找不到元件",
|
||||
"permissions": "安裝位置受限",
|
||||
"startup": "啟動異常",
|
||||
"hint": "這裡僅示範元件,不會執行指令或修改設定。",
|
||||
"settingsAction": "已要求開啟沙箱設定(示範)。"
|
||||
},
|
||||
"fallback": {
|
||||
"title": "ModelFallbackNotice · 模型備援",
|
||||
"description": "查看備援模型與授權失效提示。",
|
||||
|
||||
@@ -486,7 +486,7 @@
|
||||
"checking": "Checking…",
|
||||
"scope": "Checks the saved launcher with temporary test files only. This is not a full security audit. Restart the gateway to apply saved changes to command execution.",
|
||||
"path": "Trusted launcher path",
|
||||
"pathHelp": "Optional absolute path to a launcher from a trusted publisher. The file and its parent directories must be root-owned and not group- or world-writable, and outside writable agent paths. Leave blank for system lookup.",
|
||||
"pathHelp": "Usually leave this blank for system lookup. For a custom installation, ask the package maintainer for the full launcher path. The file and its parent directories must be root-owned and not group- or world-writable, and outside writable agent paths.",
|
||||
"automatic": "System lookup",
|
||||
"checkError": "Could not complete the check. Reopen settings and try again.",
|
||||
"saveError": "Could not save. Keep your draft and try again.",
|
||||
@@ -494,6 +494,14 @@
|
||||
"disableHelp": "After restart, commands run with the gateway account’s permissions. File tools also lose the workspace restriction supplied by this sandbox; independently configured restrictions still apply.",
|
||||
"keep": "Keep isolation",
|
||||
"disable": "Turn off isolation",
|
||||
"notice": {
|
||||
"title": "Commands need attention",
|
||||
"missing": "The command component could not be found. Check its installation; you can keep chatting.",
|
||||
"path": "The configured command component is unavailable. Check its location and access permissions.",
|
||||
"permissions": "The command component is not in a protected location. Contact the package maintainer or administrator.",
|
||||
"startup": "The isolation environment could not start. Check the installation and system restrictions.",
|
||||
"openSettings": "Check settings"
|
||||
},
|
||||
"states": {
|
||||
"disabled": "Commands disabled",
|
||||
"off": "Isolation off",
|
||||
|
||||
@@ -486,7 +486,7 @@
|
||||
"checking": "Comprobando…",
|
||||
"scope": "Solo prueba el lanzador guardado con archivos temporales. No es una auditoría de seguridad completa. Reinicia la puerta de enlace para aplicar los cambios a los comandos.",
|
||||
"path": "Ruta del lanzador de confianza",
|
||||
"pathHelp": "Ruta absoluta opcional de un lanzador de confianza. El archivo y sus directorios padre deben ser de root, sin escritura para grupos u otros usuarios, y estar fuera de las rutas de escritura del agente. Déjala vacía para buscar en el sistema.",
|
||||
"pathHelp": "Normalmente, déjala vacía para buscar en el sistema. Para una instalación personalizada, pide la ruta completa del lanzador al responsable del paquete. El archivo y sus directorios padre deben ser de root, sin escritura para grupos u otros usuarios, y estar fuera de las rutas de escritura del agente.",
|
||||
"automatic": "Búsqueda del sistema",
|
||||
"checkError": "No se pudo completar la prueba. Abre los ajustes de nuevo y reinténtalo.",
|
||||
"saveError": "No se pudo guardar. El borrador se conserva; vuelve a intentarlo.",
|
||||
@@ -494,6 +494,14 @@
|
||||
"disableHelp": "Tras reiniciar, los comandos usarán los permisos de la cuenta de la puerta de enlace. Las herramientas de archivos también perderán la restricción de espacio de trabajo de este sandbox; las restricciones independientes se mantienen.",
|
||||
"keep": "Mantener aislamiento",
|
||||
"disable": "Desactivar aislamiento",
|
||||
"notice": {
|
||||
"title": "Los comandos requieren atención",
|
||||
"missing": "No se encontró el componente de ejecución. Revisa su instalación; puedes seguir chateando.",
|
||||
"path": "El componente configurado no está disponible. Revisa su ubicación y permisos de acceso.",
|
||||
"permissions": "El componente no está en una ubicación protegida. Contacta al responsable del paquete o al administrador.",
|
||||
"startup": "El entorno de aislamiento no pudo iniciarse. Revisa la instalación y las restricciones del sistema.",
|
||||
"openSettings": "Revisar ajustes"
|
||||
},
|
||||
"states": {
|
||||
"disabled": "Comandos desactivados",
|
||||
"off": "Sin aislamiento",
|
||||
|
||||
@@ -486,7 +486,7 @@
|
||||
"checking": "Vérification…",
|
||||
"scope": "Teste uniquement le lanceur enregistré avec des fichiers temporaires. Ce n’est pas un audit de sécurité complet. Redémarrez la passerelle pour appliquer les changements aux commandes.",
|
||||
"path": "Chemin du lanceur de confiance",
|
||||
"pathHelp": "Chemin absolu facultatif d’un lanceur de confiance. Le fichier et ses dossiers parents doivent appartenir à root, sans écriture pour le groupe ou les autres utilisateurs, hors des chemins modifiables par l’agent. Laissez vide pour la recherche système.",
|
||||
"pathHelp": "Laissez généralement ce champ vide pour la recherche système. Pour une installation personnalisée, demandez le chemin complet du lanceur au responsable du paquet. Le fichier et ses dossiers parents doivent appartenir à root, sans écriture pour le groupe ou les autres utilisateurs, hors des chemins modifiables par l’agent.",
|
||||
"automatic": "Recherche système",
|
||||
"checkError": "La vérification a échoué. Rouvrez les paramètres et réessayez.",
|
||||
"saveError": "Enregistrement impossible. Le brouillon est conservé ; réessayez.",
|
||||
@@ -494,6 +494,14 @@
|
||||
"disableHelp": "Après redémarrage, les commandes utiliseront les droits du compte de la passerelle. Les outils de fichiers perdront aussi la restriction d’espace de travail fournie par ce bac à sable ; les restrictions indépendantes restent actives.",
|
||||
"keep": "Garder l’isolation",
|
||||
"disable": "Désactiver l’isolation",
|
||||
"notice": {
|
||||
"title": "Les commandes nécessitent une vérification",
|
||||
"missing": "Le composant d’exécution est introuvable. Vérifiez son installation ; vous pouvez continuer à discuter.",
|
||||
"path": "Le composant configuré est indisponible. Vérifiez son emplacement et ses droits d’accès.",
|
||||
"permissions": "Le composant n’est pas dans un emplacement protégé. Contactez le responsable du paquet ou l’administrateur.",
|
||||
"startup": "L’environnement isolé n’a pas pu démarrer. Vérifiez l’installation et les restrictions du système.",
|
||||
"openSettings": "Vérifier les paramètres"
|
||||
},
|
||||
"states": {
|
||||
"disabled": "Commandes désactivées",
|
||||
"off": "Sans isolation",
|
||||
|
||||
@@ -486,7 +486,7 @@
|
||||
"checking": "Memeriksa…",
|
||||
"scope": "Hanya menguji peluncur tersimpan dengan berkas sementara. Ini bukan audit keamanan lengkap. Mulai ulang gateway untuk menerapkan perubahan ke eksekusi perintah.",
|
||||
"path": "Jalur peluncur tepercaya",
|
||||
"pathHelp": "Jalur absolut opsional ke peluncur dari penerbit tepercaya. Berkas dan direktori induk harus dimiliki root, tidak dapat ditulis grup/pengguna lain, dan di luar jalur tulis agen. Kosongkan untuk pencarian sistem.",
|
||||
"pathHelp": "Biasanya biarkan kosong untuk pencarian sistem. Untuk instalasi khusus, minta jalur lengkap peluncur kepada pengelola paket. Berkas dan direktori induk harus dimiliki root, tidak dapat ditulis grup/pengguna lain, dan di luar jalur tulis agen.",
|
||||
"automatic": "Pencarian sistem",
|
||||
"checkError": "Pemeriksaan gagal. Buka ulang pengaturan dan coba lagi.",
|
||||
"saveError": "Gagal menyimpan. Draf tetap tersimpan; coba lagi.",
|
||||
@@ -494,6 +494,14 @@
|
||||
"disableHelp": "Setelah mulai ulang, perintah berjalan dengan izin akun gateway. Alat berkas juga kehilangan pembatasan ruang kerja dari sandbox ini; pembatasan yang diatur terpisah tetap berlaku.",
|
||||
"keep": "Pertahankan isolasi",
|
||||
"disable": "Nonaktifkan isolasi",
|
||||
"notice": {
|
||||
"title": "Perintah perlu diperiksa",
|
||||
"missing": "Komponen eksekusi tidak ditemukan. Periksa pemasangannya; Anda tetap dapat mengobrol.",
|
||||
"path": "Komponen yang dikonfigurasi tidak tersedia. Periksa lokasi dan izin aksesnya.",
|
||||
"permissions": "Komponen tidak berada di lokasi terlindungi. Hubungi pengelola paket atau administrator.",
|
||||
"startup": "Lingkungan isolasi tidak dapat dimulai. Periksa pemasangan dan pembatasan sistem.",
|
||||
"openSettings": "Periksa pengaturan"
|
||||
},
|
||||
"states": {
|
||||
"disabled": "Perintah nonaktif",
|
||||
"off": "Isolasi nonaktif",
|
||||
|
||||
@@ -486,7 +486,7 @@
|
||||
"checking": "確認中…",
|
||||
"scope": "一時ファイルのみで保存済みのランチャーを確認します。完全なセキュリティ監査ではありません。コマンドに設定を適用するにはゲートウェイを再起動してください。",
|
||||
"path": "信頼するランチャーのパス",
|
||||
"pathHelp": "信頼する提供元のランチャーの絶対パス(任意)。ファイルと親ディレクトリは root 所有で、グループや他のユーザーが書き込めず、Agent の書き込み範囲外である必要があります。空欄はシステム検索です。",
|
||||
"pathHelp": "通常は空欄のままシステム検索を使います。独自のインストールでは、パッケージ管理者にランチャーの完全なパスを確認してください。ファイルと親ディレクトリは root 所有で、グループや他のユーザーが書き込めず、Agent の書き込み範囲外である必要があります。",
|
||||
"automatic": "システム検索",
|
||||
"checkError": "確認できませんでした。設定を開き直して再試行してください。",
|
||||
"saveError": "保存できませんでした。下書きを保持しています。再試行してください。",
|
||||
@@ -494,6 +494,14 @@
|
||||
"disableHelp": "再起動後、コマンドはゲートウェイのアカウント権限で実行されます。ファイルツールも、このサンドボックスによる作業領域の制限を失います。個別に設定した制限は引き続き適用されます。",
|
||||
"keep": "隔離を維持",
|
||||
"disable": "隔離を無効化",
|
||||
"notice": {
|
||||
"title": "コマンドの設定を確認してください",
|
||||
"missing": "コマンド実行コンポーネントが見つかりません。インストール先を確認してください。チャットは続けられます。",
|
||||
"path": "設定された実行コンポーネントを利用できません。場所とアクセス権を確認してください。",
|
||||
"permissions": "実行コンポーネントが保護された場所にありません。パッケージの管理者またはシステム管理者に連絡してください。",
|
||||
"startup": "隔離環境を起動できませんでした。インストールとシステムの制限を確認してください。",
|
||||
"openSettings": "設定を確認"
|
||||
},
|
||||
"states": {
|
||||
"disabled": "コマンド無効",
|
||||
"off": "隔離なし",
|
||||
|
||||
@@ -486,7 +486,7 @@
|
||||
"checking": "확인 중…",
|
||||
"scope": "임시 파일만 사용해 저장된 실행기를 확인합니다. 전체 보안 감사가 아닙니다. 명령 실행에 저장된 설정을 적용하려면 게이트웨이를 다시 시작하세요.",
|
||||
"path": "신뢰할 실행기 경로",
|
||||
"pathHelp": "신뢰하는 배포자의 실행기 절대 경로(선택 사항). 파일과 상위 폴더는 root 소유여야 하며 그룹·다른 사용자가 쓸 수 없고 Agent 쓰기 범위 밖이어야 합니다. 비워 두면 시스템에서 찾습니다.",
|
||||
"pathHelp": "보통은 비워 두고 시스템에서 찾도록 합니다. 사용자 지정 설치는 패키지 관리자에게 실행기의 전체 경로를 문의하세요. 파일과 상위 폴더는 root 소유여야 하며 그룹·다른 사용자가 쓸 수 없고 Agent 쓰기 범위 밖이어야 합니다.",
|
||||
"automatic": "시스템에서 찾기",
|
||||
"checkError": "확인하지 못했습니다. 설정을 다시 열고 재시도하세요.",
|
||||
"saveError": "저장하지 못했습니다. 초안을 유지했습니다. 다시 시도하세요.",
|
||||
@@ -494,6 +494,14 @@
|
||||
"disableHelp": "다시 시작하면 게이트웨이 계정 권한으로 명령을 실행합니다. 파일 도구도 이 샌드박스가 제공한 작업 영역 제한을 잃습니다. 별도로 설정한 제한은 유지됩니다.",
|
||||
"keep": "격리 유지",
|
||||
"disable": "격리 끄기",
|
||||
"notice": {
|
||||
"title": "명령 설정을 확인해 주세요",
|
||||
"missing": "명령 실행 구성 요소를 찾을 수 없습니다. 설치 위치를 확인해 주세요. 대화는 계속할 수 있습니다.",
|
||||
"path": "설정된 실행 구성 요소를 사용할 수 없습니다. 위치와 접근 권한을 확인해 주세요.",
|
||||
"permissions": "실행 구성 요소가 보호된 위치에 없습니다. 패키지 관리자나 시스템 관리자에게 문의해 주세요.",
|
||||
"startup": "격리 환경을 시작할 수 없습니다. 설치와 시스템 제한을 확인해 주세요.",
|
||||
"openSettings": "설정 확인"
|
||||
},
|
||||
"states": {
|
||||
"disabled": "명령 비활성화",
|
||||
"off": "격리 꺼짐",
|
||||
|
||||
@@ -486,7 +486,7 @@
|
||||
"checking": "Verificando…",
|
||||
"scope": "Testa apenas o iniciador salvo com arquivos temporários. Não é uma auditoria completa de segurança. Reinicie o gateway para aplicar as alterações aos comandos.",
|
||||
"path": "Caminho do iniciador confiável",
|
||||
"pathHelp": "Caminho absoluto opcional de um iniciador confiável. O arquivo e as pastas superiores devem pertencer ao root, sem escrita por grupos ou outros usuários, fora dos caminhos graváveis pelo agente. Deixe vazio para busca no sistema.",
|
||||
"pathHelp": "Normalmente, deixe vazio para busca no sistema. Para uma instalação personalizada, peça o caminho completo do iniciador ao mantenedor do pacote. O arquivo e as pastas superiores devem pertencer ao root, sem escrita por grupos ou outros usuários, fora dos caminhos graváveis pelo agente.",
|
||||
"automatic": "Busca no sistema",
|
||||
"checkError": "Não foi possível verificar. Reabra as configurações e tente novamente.",
|
||||
"saveError": "Não foi possível salvar. O rascunho foi mantido; tente novamente.",
|
||||
@@ -494,6 +494,14 @@
|
||||
"disableHelp": "Após reiniciar, os comandos usarão as permissões da conta do gateway. As ferramentas de arquivos também perderão a restrição de espaço de trabalho deste sandbox; as restrições independentes continuam ativas.",
|
||||
"keep": "Manter isolamento",
|
||||
"disable": "Desativar isolamento",
|
||||
"notice": {
|
||||
"title": "Os comandos precisam de atenção",
|
||||
"missing": "O componente de execução não foi encontrado. Verifique a instalação; você pode continuar conversando.",
|
||||
"path": "O componente configurado está indisponível. Verifique o local e as permissões de acesso.",
|
||||
"permissions": "O componente não está em um local protegido. Entre em contato com o responsável pelo pacote ou administrador.",
|
||||
"startup": "O ambiente de isolamento não pôde iniciar. Verifique a instalação e as restrições do sistema.",
|
||||
"openSettings": "Verificar configurações"
|
||||
},
|
||||
"states": {
|
||||
"disabled": "Comandos desativados",
|
||||
"off": "Isolamento desativado",
|
||||
|
||||
@@ -486,7 +486,7 @@
|
||||
"checking": "Đang kiểm tra…",
|
||||
"scope": "Chỉ kiểm tra trình khởi chạy đã lưu bằng tệp tạm. Đây không phải kiểm toán bảo mật đầy đủ. Khởi động lại gateway để áp dụng thay đổi cho lệnh.",
|
||||
"path": "Đường dẫn trình khởi chạy tin cậy",
|
||||
"pathHelp": "Đường dẫn tuyệt đối tùy chọn từ nhà phát hành tin cậy. Tệp và thư mục cha phải thuộc root, không cho nhóm/người khác ghi, và nằm ngoài vùng ghi của Agent. Để trống để tìm trong hệ thống.",
|
||||
"pathHelp": "Thông thường hãy để trống để tìm trong hệ thống. Với cài đặt tùy chỉnh, hãy hỏi người duy trì gói về đường dẫn đầy đủ của trình khởi chạy. Tệp và thư mục cha phải thuộc root, không cho nhóm/người khác ghi, và nằm ngoài vùng ghi của Agent.",
|
||||
"automatic": "Tìm trong hệ thống",
|
||||
"checkError": "Chưa kiểm tra được. Mở lại cài đặt và thử lại.",
|
||||
"saveError": "Không lưu được. Bản nháp được giữ lại; hãy thử lại.",
|
||||
@@ -494,6 +494,14 @@
|
||||
"disableHelp": "Sau khi khởi động lại, lệnh chạy với quyền tài khoản gateway. Công cụ tệp cũng mất giới hạn vùng làm việc do sandbox này cung cấp; các giới hạn được đặt riêng vẫn có hiệu lực.",
|
||||
"keep": "Giữ cô lập",
|
||||
"disable": "Tắt cô lập",
|
||||
"notice": {
|
||||
"title": "Cần kiểm tra lệnh",
|
||||
"missing": "Không tìm thấy thành phần thực thi lệnh. Hãy kiểm tra cài đặt; bạn vẫn có thể trò chuyện.",
|
||||
"path": "Không thể sử dụng thành phần đã cấu hình. Hãy kiểm tra vị trí và quyền truy cập.",
|
||||
"permissions": "Thành phần thực thi không nằm ở vị trí được bảo vệ. Hãy liên hệ người bảo trì gói hoặc quản trị viên.",
|
||||
"startup": "Không thể khởi động môi trường cách ly. Hãy kiểm tra cài đặt và các hạn chế của hệ thống.",
|
||||
"openSettings": "Kiểm tra cài đặt"
|
||||
},
|
||||
"states": {
|
||||
"disabled": "Đã tắt lệnh",
|
||||
"off": "Không cô lập",
|
||||
|
||||
@@ -486,7 +486,7 @@
|
||||
"checking": "检测中…",
|
||||
"scope": "仅使用临时文件检测已保存的启动器,不代表完整安全审计。保存后需重启网关,命令执行才会使用新配置。",
|
||||
"path": "可信启动器路径",
|
||||
"pathHelp": "可选,填写可信来源启动器的绝对路径。文件及上级目录须归 root 所有、不可被组或其他用户写入,且不在 Agent 可写范围内。留空则使用系统查找。",
|
||||
"pathHelp": "通常留空,由系统自动查找。特殊安装请向安装包维护者索取启动器的完整路径。文件及上级目录须归 root 所有、不可被组或其他用户写入,且不在 Agent 可写范围内。",
|
||||
"automatic": "系统自动查找",
|
||||
"checkError": "检测未完成,请重新打开设置后重试。",
|
||||
"saveError": "保存失败,草稿已保留,请重试。",
|
||||
@@ -494,6 +494,14 @@
|
||||
"disableHelp": "重启后,命令将以网关账号的权限直接运行。文件工具也会失去此沙箱附带的目录限制;单独设置的目录限制仍然保留。",
|
||||
"keep": "保留隔离",
|
||||
"disable": "关闭隔离",
|
||||
"notice": {
|
||||
"title": "命令暂时不可用",
|
||||
"missing": "未找到命令运行组件。请检查安装位置,聊天仍可继续。",
|
||||
"path": "配置的运行组件路径不可用。请检查位置和访问权限。",
|
||||
"permissions": "运行组件所在位置不符合安全要求。请联系安装包维护者或管理员。",
|
||||
"startup": "隔离环境未能启动。请检查安装和系统限制。",
|
||||
"openSettings": "检查设置"
|
||||
},
|
||||
"states": {
|
||||
"disabled": "命令已停用",
|
||||
"off": "未隔离",
|
||||
|
||||
@@ -486,7 +486,7 @@
|
||||
"checking": "檢測中…",
|
||||
"scope": "僅使用暫存檔檢測已儲存的啟動器,不代表完整安全稽核。儲存後須重新啟動閘道,命令執行才會使用新設定。",
|
||||
"path": "可信啟動器路徑",
|
||||
"pathHelp": "選填可信來源啟動器的絕對路徑。檔案及上層目錄須由 root 擁有、不可供群組或其他使用者寫入,且不在 Agent 可寫範圍內。留空則使用系統查找。",
|
||||
"pathHelp": "通常留空,由系統自動查找。特殊安裝請向安裝套件維護者索取啟動器的完整路徑。檔案及上層目錄須由 root 擁有、不可供群組或其他使用者寫入,且不在 Agent 可寫範圍內。",
|
||||
"automatic": "系統自動查找",
|
||||
"checkError": "檢測未完成,請重新開啟設定後再試。",
|
||||
"saveError": "儲存失敗,草稿已保留,請再試。",
|
||||
@@ -494,6 +494,14 @@
|
||||
"disableHelp": "重新啟動後,命令將以閘道帳號的權限直接執行。檔案工具也會失去此沙箱附帶的目錄限制;獨立設定的目錄限制仍然保留。",
|
||||
"keep": "保留隔離",
|
||||
"disable": "關閉隔離",
|
||||
"notice": {
|
||||
"title": "指令暫時無法使用",
|
||||
"missing": "找不到指令執行元件。請檢查安裝位置,仍可繼續聊天。",
|
||||
"path": "設定的執行元件路徑無法使用。請檢查位置與存取權限。",
|
||||
"permissions": "執行元件所在位置不符合安全要求。請聯絡安裝套件維護者或管理員。",
|
||||
"startup": "無法啟動隔離環境。請檢查安裝與系統限制。",
|
||||
"openSettings": "檢查設定"
|
||||
},
|
||||
"states": {
|
||||
"disabled": "命令已停用",
|
||||
"off": "未隔離",
|
||||
|
||||
@@ -453,6 +453,8 @@ export interface ToolProgressEvent {
|
||||
arguments?: unknown;
|
||||
result?: unknown;
|
||||
error?: unknown;
|
||||
/** Gateway-owned classification; never inferred from command output. */
|
||||
error_code?: string;
|
||||
files?: unknown[];
|
||||
embeds?: unknown[];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
import { act, fireEvent, render, screen } from "@testing-library/react";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { SandboxNotice } from "@/components/thread/SandboxNotice";
|
||||
import { useSandboxNotice } from "@/components/thread/useSandboxNotice";
|
||||
import type { NanobotClient } from "@/lib/nanobot-client";
|
||||
import type { InboundEvent, ToolProgressEvent } from "@/lib/types";
|
||||
import { createStreamClient } from "./stream-client";
|
||||
|
||||
function Harness({ client, chatId = "sandbox-chat", enabled = true, onOpen = () => {} }: {
|
||||
client: NanobotClient;
|
||||
chatId?: string;
|
||||
enabled?: boolean;
|
||||
onOpen?: () => void;
|
||||
}) {
|
||||
const notice = useSandboxNotice(client, chatId, enabled);
|
||||
return <>
|
||||
<input aria-label="Draft" defaultValue="Keep my draft" />
|
||||
{notice.issue ? <SandboxNotice issue={notice.issue} onDismiss={notice.dismiss} onOpenSettings={onOpen} /> : null}
|
||||
</>;
|
||||
}
|
||||
|
||||
function start(receive: (event: InboundEvent) => void, turnId = "turn-one") {
|
||||
receive({ event: "user_message", chat_id: "sandbox-chat", turn_id: turnId, starts_turn: true, text: "Run a command" });
|
||||
}
|
||||
|
||||
function tool(receive: (event: InboundEvent) => void, values: Partial<ToolProgressEvent> = {}, turnId = "turn-one") {
|
||||
receive({ event: "message", chat_id: "sandbox-chat", turn_id: turnId, text: "", kind: "progress",
|
||||
tool_events: [{ name: "exec", phase: "error", call_id: "command-one", error_code: "sandbox_launcher_missing", ...values }] });
|
||||
}
|
||||
|
||||
describe("Live sandbox guidance", () => {
|
||||
it.each([
|
||||
["sandbox_path_unavailable", "Check its location and access permissions"],
|
||||
["sandbox_start_failed", "Check the installation and system restrictions"],
|
||||
])("explains the known launcher failure %s", (error_code, copy) => {
|
||||
const { client, receive } = createStreamClient();
|
||||
render(<Harness client={client} />);
|
||||
act(() => { start(receive); tool(receive, { error_code }); });
|
||||
expect(screen.getByRole("status")).toHaveTextContent(copy);
|
||||
});
|
||||
it("uses structured errors, keeps input focus, and offers one explicit recovery action", () => {
|
||||
const { client, receive } = createStreamClient();
|
||||
const onOpen = vi.fn();
|
||||
render(<Harness client={client} onOpen={onOpen} />);
|
||||
const draft = screen.getByRole("textbox", { name: "Draft" });
|
||||
draft.focus();
|
||||
act(() => {
|
||||
start(receive);
|
||||
tool(receive, { error_code: undefined, error: "Error: sandbox launcher not found: bwrap" });
|
||||
tool(receive, { error_code: "__proto__" });
|
||||
tool(receive, { name: "write_file" });
|
||||
});
|
||||
expect(screen.queryByRole("status")).not.toBeInTheDocument();
|
||||
act(() => tool(receive));
|
||||
expect(screen.getByRole("status")).toHaveAttribute("aria-live", "polite");
|
||||
expect(draft).toHaveFocus();
|
||||
expect(draft).toHaveValue("Keep my draft");
|
||||
expect(onOpen).not.toHaveBeenCalled();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Check settings" }));
|
||||
expect(onOpen).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("keeps a repeated failure dismissed for the turn and clears it after a real successful command", () => {
|
||||
const { client, receive } = createStreamClient();
|
||||
render(<Harness client={client} />);
|
||||
act(() => { start(receive); tool(receive); });
|
||||
fireEvent.click(screen.getByRole("button", { name: "Dismiss" }));
|
||||
act(() => tool(receive, { call_id: "command-two" }));
|
||||
expect(screen.queryByRole("status")).not.toBeInTheDocument();
|
||||
act(() => {
|
||||
receive({ event: "turn_end", chat_id: "sandbox-chat", turn_id: "turn-one" });
|
||||
start(receive, "turn-two");
|
||||
tool(receive, { call_id: "command-three" }, "turn-two");
|
||||
});
|
||||
expect(screen.getByRole("status")).toBeVisible();
|
||||
act(() => tool(receive, { phase: "end", error_code: undefined }, "turn-two"));
|
||||
expect(screen.queryByRole("status")).not.toBeInTheDocument();
|
||||
act(() => tool(receive, { call_id: "late-command" }));
|
||||
expect(screen.queryByRole("status")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("does not replay old failures when opening a chat or enable controls for old hosts", () => {
|
||||
const { client, receive } = createStreamClient();
|
||||
start(receive);
|
||||
tool(receive);
|
||||
const view = render(<Harness client={client} enabled={false} />);
|
||||
expect(screen.queryByRole("status")).not.toBeInTheDocument();
|
||||
view.rerender(<Harness client={client} />);
|
||||
expect(screen.queryByRole("status")).not.toBeInTheDocument();
|
||||
act(() => tool(receive));
|
||||
expect(screen.getByRole("status")).toBeVisible();
|
||||
});
|
||||
|
||||
it("does not carry a notice or its action into another host or chat", () => {
|
||||
const first = createStreamClient();
|
||||
const second = createStreamClient();
|
||||
const view = render(<Harness client={first.client} />);
|
||||
act(() => { start(first.receive); tool(first.receive); });
|
||||
expect(screen.getByRole("status")).toBeVisible();
|
||||
view.rerender(<Harness client={second.client} />);
|
||||
expect(screen.queryByRole("status")).not.toBeInTheDocument();
|
||||
act(() => tool(first.receive, { error_code: "sandbox_unprotected_installation" }));
|
||||
expect(screen.queryByRole("status")).not.toBeInTheDocument();
|
||||
act(() => { start(second.receive); tool(second.receive, { error_code: "sandbox_unprotected_installation" }); });
|
||||
expect(screen.getByRole("status")).toHaveTextContent(/protected location/);
|
||||
view.rerender(<Harness client={second.client} chatId="other-chat" />);
|
||||
expect(screen.queryByRole("status")).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -37,6 +37,16 @@ describe("Saved sandbox settings", () => {
|
||||
expect(sandbox.getByText(/Restart the gateway/)).toBeVisible();
|
||||
});
|
||||
|
||||
it("opens the launcher editor from a recovery link without editing or checking automatically", () => {
|
||||
renderSettingsView({ initialSection: "advanced", initialSettings: payload(), webuiCapabilities: capability,
|
||||
focusTarget: "sandbox-launcher" });
|
||||
const sandbox = within(screen.getByRole("region", { name: "Command sandbox" }));
|
||||
expect(sandbox.getByRole("button", { name: "Advanced options" })).toHaveAttribute("aria-expanded", "true");
|
||||
expect(sandbox.getByRole("textbox", { name: "Trusted launcher path" })).toHaveFocus();
|
||||
expect(sandbox.getByRole("textbox", { name: "Trusted launcher path" })).toHaveValue("");
|
||||
expect(requestMutationMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("retains rejected path drafts and localizes errors", async () => {
|
||||
const sandbox = open();
|
||||
fireEvent.click(sandbox.getByRole("button", { name: "Advanced options" }));
|
||||
@@ -120,4 +130,22 @@ describe("Saved sandbox settings", () => {
|
||||
await waitFor(() => expect(screen.getByRole("button", { name: "Check sandbox" })).not.toBeDisabled());
|
||||
expect(screen.queryByText("Basic check passed")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("does not refocus the launcher when restart state changes", () => {
|
||||
const settings = payload();
|
||||
const client = { requestMutation: vi.fn() } as unknown as NanobotClient;
|
||||
function Harness({ restarting }: { restarting: boolean }) {
|
||||
const state = useRuntimeConfigSettings(settings, client, () => {});
|
||||
return <><button>Keep focus here</button><RuntimeConfigSettings page="advanced" settings={settings} state={state}
|
||||
client={client} sandboxSupported isRestarting={restarting} remoteBrowserAccess={false} focusTarget="sandbox-launcher" /></>;
|
||||
}
|
||||
const { rerender } = render(<Harness restarting={false} />);
|
||||
expect(screen.getByRole("textbox", { name: "Trusted launcher path" })).toHaveFocus();
|
||||
const other = screen.getByRole("button", { name: "Keep focus here" });
|
||||
other.focus();
|
||||
rerender(<Harness restarting />);
|
||||
expect(other).toHaveFocus();
|
||||
rerender(<Harness restarting={false} />);
|
||||
expect(other).toHaveFocus();
|
||||
});
|
||||
});
|
||||
@@ -128,6 +128,7 @@ export function settingsPayload(): SettingsPayload {
|
||||
type SettingsViewTestOptions = Partial<Pick<
|
||||
React.ComponentProps<typeof SettingsView>,
|
||||
| "initialSection"
|
||||
| "focusTarget"
|
||||
| "initialSettings"
|
||||
| "themePreference"
|
||||
| "onChangeTheme"
|
||||
@@ -155,6 +156,7 @@ export function renderSettingsView(options: SettingsViewTestOptions = {}) {
|
||||
<SettingsView
|
||||
themePreference={options.themePreference ?? "light"}
|
||||
initialSection={options.initialSection ?? "apps"}
|
||||
focusTarget={options.focusTarget}
|
||||
initialSettings={options.initialSettings}
|
||||
skills={options.skills}
|
||||
skillsLoading={options.skillsLoading}
|
||||
|
||||
Reference in new issue
Block a user