import { invoke } from "@tauri-apps/api/core";
import { useState } from "react";
import { errorMessage } from "../lib/errorMessage";
import type { BootstrapStatus } from "../types/bootstrap";
export type SettingsChatSlot = "companion" | "operations";
export function DesktopBehaviorPage({
bubbleTarget,
quickTarget,
onBubbleTargetChange,
onQuickTargetChange,
onOpenQuickChat,
}: {
bubbleTarget: "main" | "quick";
quickTarget: SettingsChatSlot;
onBubbleTargetChange: (value: "main" | "quick") => void;
onQuickTargetChange: (value: SettingsChatSlot) => void;
onOpenQuickChat: () => void;
}) {
const [quietHours, setQuietHours] = useState(
() => localStorage.getItem("astrbot.quietHours") ?? "off",
);
return (
气泡状态显示已预留
Desktop companion
后续桌面能力
托盘与单实例
窗口置顶开关
多显示器策略
游戏模式靠边活动
这些能力先保留为独立设置区,后续接入 Rust
本机能力层,不会与聊天状态混在一起。
);
}
function DiagnosticsTools() {
const [result, setResult] = useState("");
const [busy, setBusy] = useState(false);
const [host, setHost] = useState("127.0.0.1");
const [port, setPort] = useState("80");
const [processId, setProcessId] = useState("0");
const run = async (command: string, request?: Record) => {
setBusy(true);
try {
const value = await invoke(
command,
request ? { request } : undefined,
);
setResult(JSON.stringify(value, null, 2));
} catch (reason) {
setResult(errorMessage(reason));
} finally {
setBusy(false);
}
};
return (
<>
{result ? (
{result}
) : null}
>
);
}
export function DiagnosticsPage({
status,
onRefresh,
}: {
status: BootstrapStatus;
onRefresh: () => void;
}) {
return (
Security boundary
本机能力保持可审计
- 凭据只在 Rust 与 Windows 安全存储之间流动。
- 两个 REST/SSE 槽位保持独立状态、会话、消息与未读数。
- 本机操作必须经过白名单、角色、路径和用户授权。
- 文件事务默认保留源文件,不静默覆盖目标。
);
}
export function SettingCard({
title,
description,
children,
}: {
title: string;
description: string;
children: React.ReactNode;
}) {
return (
Settings
{title}
{description}
{children}
);
}
interface StatusCardProps {
label: string;
value: string;
}
function StatusCard({ label, value }: StatusCardProps) {
return (
{label}
{value}
);
}