({
initialView,
initialPrompt,
initialSession,
systemPromptOverride,
updateCheck,
}: {
initialView?: "login" | "chat";
initialPrompt?: string;
initialSession?: SessionData;
/** Optional override replacing the default system prompt (from `-s`). */
systemPromptOverride?: string;
/** Promise resolving to the latest-npm-version comparison; resolved after first paint. */
updateCheck?: Promise<UpdateInfo>;
})
| 292 | : never; |
| 293 | |
| 294 | export function App({ |
| 295 | initialView, |
| 296 | initialPrompt, |
| 297 | initialSession, |
| 298 | systemPromptOverride, |
| 299 | updateCheck, |
| 300 | }: { |
| 301 | initialView?: "login" | "chat"; |
| 302 | initialPrompt?: string; |
| 303 | initialSession?: SessionData; |
| 304 | /** Optional override replacing the default system prompt (from `-s`). */ |
| 305 | systemPromptOverride?: string; |
| 306 | /** Promise resolving to the latest-npm-version comparison; resolved after first paint. */ |
| 307 | updateCheck?: Promise<UpdateInfo>; |
| 308 | }) { |
| 309 | const { exit } = useApp(); |
| 310 | const [settings, setSettings] = useState<OrbCodeSettings>(() => |
| 311 | loadSettings(), |
| 312 | ); |
| 313 | const [view, setView] = useState<"login" | "chat">( |
| 314 | initialView ?? (getAuthToken(settings) ? "chat" : "login"), |
| 315 | ); |
| 316 | const [updateInfo, setUpdateInfo] = useState<UpdateInfo | null>(null); |
| 317 | |
| 318 | const [rows, setRows] = useState<Row[]>(() => [ |
| 319 | { |
| 320 | kind: "header", |
| 321 | id: "header", |
| 322 | cwd: process.cwd(), |
| 323 | modelName: getModel(loadSettings().model).name, |
| 324 | }, |
| 325 | ]); |
| 326 | const [busy, setBusy] = useState(false); |
| 327 | const [busyLabel, setBusyLabel] = useState("Thinking"); |
| 328 | const [streamingReasoning, setStreamingReasoning] = useState(""); |
| 329 | const [streamingText, setStreamingText] = useState(""); |
| 330 | const [pendingApproval, setPendingApproval] = |
| 331 | useState<PendingApproval | null>(null); |
| 332 | const [pendingFollowup, setPendingFollowup] = |
| 333 | useState<PendingFollowup | null>(null); |
| 334 | // Set when the current project defines hooks that haven't been trusted yet; |
| 335 | // gates input until the user decides (project hooks run shell commands). |
| 336 | const [pendingHookTrust, setPendingHookTrust] = useState<{ |
| 337 | commands: string[]; |
| 338 | } | null>(null); |
| 339 | // FIFO queue of messages the user typed while the LLM was still streaming. |
| 340 | // Drained one-per-turn on each `turn-end` event so multi-step work can |
| 341 | // keep flowing without making the user wait for the previous response. |
| 342 | const [queuedMessages, setQueuedMessages] = useState<string[]>([]); |
| 343 | const [modelPickerOpen, setModelPickerOpen] = useState(false); |
| 344 | const [resumableSessions, setResumableSessions] = useState< |
| 345 | SessionData[] | null |
| 346 | >(null); |
| 347 | const [taskPickerSessions, setTaskPickerSessions] = useState< |
| 348 | SessionData[] | null |
| 349 | >(null); |
| 350 | const [linkManagerOpen, setLinkManagerOpen] = useState(false); |
| 351 | const [links, setLinks] = useState<LinkedRepo[]>([]); |
nothing calls this directly
no test coverage detected