({ agent, startupConfig, initialMessage, onExit }: AppProps)
| 595 | } |
| 596 | |
| 597 | export function App({ agent, startupConfig, initialMessage, onExit }: AppProps) { |
| 598 | const t = dark; |
| 599 | const renderer = useRenderer(); |
| 600 | const initialHasApiKey = agent.hasApiKey(); |
| 601 | const [hasApiKey, setHasApiKey] = useState(initialHasApiKey); |
| 602 | const [messages, setMessages] = useState<ChatEntry[]>(() => agent.getChatEntries()); |
| 603 | const [streamContent, setStreamContent] = useState(""); |
| 604 | const [_streamReasoning, setStreamReasoning] = useState(""); |
| 605 | const [isProcessing, setIsProcessing] = useState(false); |
| 606 | const [liveTurnSourceLabel, setLiveTurnSourceLabel] = useState<string | null>(null); |
| 607 | const [model, setModel] = useState(agent.getModel()); |
| 608 | const [sandboxMode, setSandboxModeState] = useState<SandboxMode>(agent.getSandboxMode()); |
| 609 | const [mode, setModeState] = useState<AgentMode>(agent.getMode()); |
| 610 | const [showModelPicker, setShowModelPicker] = useState(false); |
| 611 | const [modelPickerIndex, setModelPickerIndex] = useState(0); |
| 612 | const [modelSearchQuery, setModelSearchQuery] = useState(""); |
| 613 | const [showSandboxPicker, setShowSandboxPicker] = useState(false); |
| 614 | const [sandboxSettings, setSandboxSettingsState] = useState<SandboxSettings>(() => agent.getSandboxSettings()); |
| 615 | const [sandboxSettingsFocusIndex, setSandboxSettingsFocusIndex] = useState(0); |
| 616 | const [sandboxSettingsEditing, setSandboxSettingsEditing] = useState<string | null>(null); |
| 617 | const [sandboxSettingsEditBuffer, setSandboxSettingsEditBuffer] = useState(""); |
| 618 | const [showRecapPicker, setShowRecapPicker] = useState(false); |
| 619 | const [recapsEnabled, setRecapsEnabledState] = useState(() => agent.getRecapsEnabled()); |
| 620 | const [showWalletPicker, setShowWalletPicker] = useState(false); |
| 621 | const [walletSettings, setWalletSettings] = useState<Required<PaymentSettings>>(() => loadPaymentSettings()); |
| 622 | const [walletFocusIndex, setWalletFocusIndex] = useState(0); |
| 623 | const [walletDisplayInfo, setWalletDisplayInfo] = useState<WalletDisplayInfo>({ |
| 624 | address: null, |
| 625 | ethBalance: null, |
| 626 | usdcBalance: null, |
| 627 | }); |
| 628 | const [pendingPaymentApproval, setPendingPaymentApproval] = useState<{ |
| 629 | url: string; |
| 630 | description: string; |
| 631 | security: string; |
| 632 | securityLabel: string; |
| 633 | securityUrl: string; |
| 634 | amount: string; |
| 635 | network: string; |
| 636 | asset: string; |
| 637 | approvalId?: string; |
| 638 | selected: number; |
| 639 | } | null>(null); |
| 640 | const [activeToolCalls, setActiveToolCalls] = useState<ToolCall[]>([]); |
| 641 | const [sessionTitle, setSessionTitle] = useState<string | null>(() => agent.getSessionTitle()); |
| 642 | const [sessionId, setSessionId] = useState<string | null>(() => agent.getSessionId()); |
| 643 | const [sessionRecap, setSessionRecap] = useState<string | null>(() => agent.getSessionRecap()); |
| 644 | const [showApiKeyModal, setShowApiKeyModal] = useState(() => !initialHasApiKey); |
| 645 | const [apiKeyError, setApiKeyError] = useState<string | null>(null); |
| 646 | const [showSlashMenu, setShowSlashMenu] = useState(false); |
| 647 | const [slashMenuIndex, setSlashMenuIndex] = useState(0); |
| 648 | const [slashSearchQuery, setSlashSearchQuery] = useState(""); |
| 649 | const [btwState, setBtwState] = useState<BtwState | null>(null); |
| 650 | const btwAbortRef = useRef<AbortController | null>(null); |
| 651 | const btwStateRef = useRef<BtwState | null>(null); |
| 652 | const [reasoningEffortByModel, setReasoningEffortByModel] = useState<Record<string, ReasoningEffort>>(() => |
| 653 | Object.fromEntries( |
| 654 | Object.entries(loadUserSettings().reasoningEffortByModel ?? {}).map(([modelId, effort]) => [ |
nothing calls this directly
no test coverage detected