MCPcopy Create free account
hub / github.com/OpenOSINT/OpenOSINT / run

Method run

openosint/repl.py:348–425  ·  view source on GitHub ↗

Start the interactive REPL loop.

(self)

Source from the content-addressed store, hash-verified

346 logger.debug("Session save failed.", exc_info=True)
347
348 async def run(self) -> None:
349 """Start the interactive REPL loop."""
350 if self._provider == "anthropic" and not self._api_key:
351 _print_error(
352 "ANTHROPIC_API_KEY is not set.\n"
353 " Export it: [bold]export ANTHROPIC_API_KEY=sk-ant-...[/]\n"
354 " Or use a local model: [bold]openosint --provider ollama[/]"
355 )
356 sys.exit(1)
357
358 _print_banner(self._provider, self._display_model)
359
360 from openosint.session_history import count_sessions
361
362 n = count_sessions()
363 if n > 0:
364 s = "s" if n != 1 else ""
365 console.print(f" [dim]💾 {n} session{s} saved — type 'history' to browse[/]\n")
366
367 try:
368 while True:
369 try:
370 raw = await self._session.prompt_async(
371 self._get_prompt_tokens,
372 style=PROMPT_STYLE,
373 )
374 except (EOFError, KeyboardInterrupt):
375 console.print("\n[dim]Goodbye.[/]\n")
376 break
377
378 user_input = raw.strip()
379 if not user_input:
380 continue
381
382 if user_input.lower() in ("exit", "quit", "q"):
383 console.print("\n[dim]Goodbye.[/]\n")
384 break
385
386 if user_input.lower() == "help":
387 _print_help()
388 continue
389
390 if user_input.lower() == "tools":
391 _print_tools()
392 continue
393
394 if user_input.lower() == "clear":
395 self._agent.clear_history()
396 console.print(" [dim]Conversation memory cleared.[/]\n")
397 continue
398
399 if user_input.lower() == "config":
400 _print_config(
401 self._api_key,
402 self._provider,
403 self._display_model,
404 self._ollama_host,
405 self._is_pdf_disabled,

Callers 3

run_replFunction · 0.95
_async_mainFunction · 0.95
_run_investigationMethod · 0.45

Calls 12

_run_investigationMethod · 0.95
_save_sessionMethod · 0.95
count_sessionsFunction · 0.90
display_history_tableFunction · 0.90
load_sessionsFunction · 0.90
_print_errorFunction · 0.85
_print_helpFunction · 0.85
_print_toolsFunction · 0.85
_print_configFunction · 0.85
_save_reportFunction · 0.85
_print_bannerFunction · 0.70
clear_historyMethod · 0.45

Tested by

no test coverage detected