cite-agent 1.2.13__tar.gz → 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cite-agent might be problematic. Click here for more details.

Files changed (94) hide show
  1. {cite_agent-1.2.13/cite_agent.egg-info → cite_agent-1.3.0}/PKG-INFO +1 -1
  2. cite_agent-1.3.0/cite_agent/__version__.py +1 -0
  3. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/enhanced_ai_agent.py +86 -116
  4. {cite_agent-1.2.13 → cite_agent-1.3.0/cite_agent.egg-info}/PKG-INFO +1 -1
  5. {cite_agent-1.2.13 → cite_agent-1.3.0}/setup.py +1 -1
  6. cite_agent-1.2.13/cite_agent/__version__.py +0 -1
  7. {cite_agent-1.2.13 → cite_agent-1.3.0}/LICENSE +0 -0
  8. {cite_agent-1.2.13 → cite_agent-1.3.0}/MANIFEST.in +0 -0
  9. {cite_agent-1.2.13 → cite_agent-1.3.0}/README.md +0 -0
  10. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/__init__.py +0 -0
  11. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/__main__.py +0 -0
  12. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/account_client.py +0 -0
  13. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/agent_backend_only.py +0 -0
  14. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/ascii_plotting.py +0 -0
  15. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/auth.py +0 -0
  16. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/backend_only_client.py +0 -0
  17. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/cli.py +0 -0
  18. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/cli_conversational.py +0 -0
  19. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/cli_enhanced.py +0 -0
  20. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/cli_workflow.py +0 -0
  21. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/dashboard.py +0 -0
  22. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/rate_limiter.py +0 -0
  23. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/session_manager.py +0 -0
  24. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/setup_config.py +0 -0
  25. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/streaming_ui.py +0 -0
  26. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/telemetry.py +0 -0
  27. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/ui.py +0 -0
  28. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/updater.py +0 -0
  29. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/web_search.py +0 -0
  30. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/workflow.py +0 -0
  31. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent/workflow_integration.py +0 -0
  32. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent.egg-info/SOURCES.txt +0 -0
  33. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent.egg-info/dependency_links.txt +0 -0
  34. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent.egg-info/entry_points.txt +0 -0
  35. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent.egg-info/requires.txt +0 -0
  36. {cite_agent-1.2.13 → cite_agent-1.3.0}/cite_agent.egg-info/top_level.txt +0 -0
  37. {cite_agent-1.2.13 → cite_agent-1.3.0}/docs/BETA_LAUNCH_CHECKLIST.md +0 -0
  38. {cite_agent-1.2.13 → cite_agent-1.3.0}/docs/BETA_RELEASE_CHECKLIST.md +0 -0
  39. {cite_agent-1.2.13 → cite_agent-1.3.0}/docs/ENHANCED_CAPABILITIES.md +0 -0
  40. {cite_agent-1.2.13 → cite_agent-1.3.0}/docs/GROQ_RATE_LIMITS.md +0 -0
  41. {cite_agent-1.2.13 → cite_agent-1.3.0}/docs/INSTALL.md +0 -0
  42. {cite_agent-1.2.13 → cite_agent-1.3.0}/docs/PUBLISHING_PYPI.md +0 -0
  43. {cite_agent-1.2.13 → cite_agent-1.3.0}/docs/SECURE_PACKAGING_GUIDE.md +0 -0
  44. {cite_agent-1.2.13 → cite_agent-1.3.0}/docs/SECURITY_AUDIT.md +0 -0
  45. {cite_agent-1.2.13 → cite_agent-1.3.0}/docs/USER_GETTING_STARTED.md +0 -0
  46. {cite_agent-1.2.13 → cite_agent-1.3.0}/docs/playbooks/BETA_LAUNCH_PLAYBOOK.md +0 -0
  47. {cite_agent-1.2.13 → cite_agent-1.3.0}/requirements.txt +0 -0
  48. {cite_agent-1.2.13 → cite_agent-1.3.0}/setup.cfg +0 -0
  49. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/__init__.py +0 -0
  50. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/__init__.py +0 -0
  51. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/auth_service/__init__.py +0 -0
  52. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/auth_service/auth_manager.py +0 -0
  53. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/graph/__init__.py +0 -0
  54. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/graph/knowledge_graph.py +0 -0
  55. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/llm_service/__init__.py +0 -0
  56. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/llm_service/llm_manager.py +0 -0
  57. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/paper_service/__init__.py +0 -0
  58. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/paper_service/openalex.py +0 -0
  59. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/performance_service/__init__.py +0 -0
  60. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/performance_service/rust_performance.py +0 -0
  61. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/research_service/__init__.py +0 -0
  62. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/research_service/chatbot.py +0 -0
  63. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/research_service/citation_manager.py +0 -0
  64. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/research_service/context_manager.py +0 -0
  65. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/research_service/conversation_manager.py +0 -0
  66. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/research_service/critical_paper_detector.py +0 -0
  67. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/research_service/enhanced_research.py +0 -0
  68. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/research_service/enhanced_synthesizer.py +0 -0
  69. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/research_service/query_generator.py +0 -0
  70. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/research_service/synthesizer.py +0 -0
  71. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/search_service/__init__.py +0 -0
  72. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/search_service/indexer.py +0 -0
  73. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/search_service/search_engine.py +0 -0
  74. {cite_agent-1.2.13 → cite_agent-1.3.0}/src/services/simple_enhanced_main.py +0 -0
  75. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/beta_launch_test_suite.py +0 -0
  76. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/enhanced/test_account_client.py +0 -0
  77. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/enhanced/test_archive_agent.py +0 -0
  78. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/enhanced/test_enhanced_agent_runtime.py +0 -0
  79. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/enhanced/test_reasoning_engine.py +0 -0
  80. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/enhanced/test_setup_config.py +0 -0
  81. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/enhanced/test_tool_framework.py +0 -0
  82. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/integration_test.py +0 -0
  83. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/test_truth_seeking_comprehensive.py +0 -0
  84. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/validation/test_accuracy_system.py +0 -0
  85. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/validation/test_agent_live.py +0 -0
  86. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/validation/test_backend_local.py +0 -0
  87. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/validation/test_cerebras_comparison.py +0 -0
  88. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/validation/test_improved_prompt.py +0 -0
  89. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/validation/test_qualitative_robustness.py +0 -0
  90. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/validation/test_qualitative_system.py +0 -0
  91. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/validation/test_truth_seeking_chinese.py +0 -0
  92. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/validation/test_truth_seeking_comprehensive.py +0 -0
  93. {cite_agent-1.2.13 → cite_agent-1.3.0}/tests/validation/test_truth_seeking_real.py +0 -0
  94. {cite_agent-1.2.13 → cite_agent-1.3.0}/tools/security_audit.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cite-agent
3
- Version: 1.2.13
3
+ Version: 1.3.0
4
4
  Summary: Terminal AI assistant for academic research with citation verification
5
5
  Home-page: https://github.com/Spectating101/cite-agent
6
6
  Author: Cite-Agent Team
@@ -0,0 +1 @@
1
+ __version__ = "1.3.0"
@@ -2705,140 +2705,110 @@ class EnhancedNocturnalAgent:
2705
2705
  if debug_mode:
2706
2706
  print(f"🔍 Web search failed: {e}")
2707
2707
 
2708
- # PRODUCTION MODE: Check for shell/code execution needs FIRST
2708
+ # PRODUCTION MODE: Use small LLM to plan shell commands (smarter than hardcoded patterns)
2709
2709
  if self.client is None:
2710
- # Check if query needs directory/file info or exploration
2710
+ # Ask small LLM: What shell command should we run?
2711
+ planner_prompt = f"""You are a shell command planner. Given the user's query, determine what shell command(s) to run.
2712
+
2713
+ User query: "{request.question}"
2714
+ Previous conversation context: {json.dumps(self.conversation_history[-2:]) if self.conversation_history else "None"}
2715
+
2716
+ Respond with JSON:
2717
+ {{
2718
+ "action": "pwd|ls|find|none",
2719
+ "search_target": "directory/file name to search for (if action=find)",
2720
+ "search_path": "~/Downloads or ~/Documents or ~ (if action=find)",
2721
+ "target_path": "/full/path (if referring to previous result)"
2722
+ }}
2723
+
2724
+ Examples:
2725
+ Query: "where am i?" → {{"action": "pwd"}}
2726
+ Query: "what files are here?" → {{"action": "ls"}}
2727
+ Query: "find cm522 in downloads" → {{"action": "find", "search_target": "cm522", "search_path": "~/Downloads"}}
2728
+ Query: "can you look into it?" + Previous: "Found /home/user/Downloads/cm522-main" → {{"action": "ls", "target_path": "/home/user/Downloads/cm522-main"}}
2729
+ Query: "what's the capital of France?" → {{"action": "none"}}
2730
+
2731
+ JSON:"""
2732
+
2711
2733
  question_lower = request.question.lower()
2712
-
2713
- # Basic info queries
2714
- needs_shell_info = any(phrase in question_lower for phrase in [
2715
- 'directory', 'folder', 'where am i', 'pwd', 'current location',
2716
- 'list files', 'what files', 'ls', 'files in', 'show files',
2717
- 'data files', 'csv files', 'check if file', 'file exists'
2718
- ])
2719
-
2720
- # Fuzzy search queries (find similar directories/files)
2721
- needs_find = any(phrase in question_lower for phrase in [
2722
- 'looking for', 'find', 'search for', 'similar to',
2723
- 'go to', 'cd to', 'navigate to', 'or something', 'forgot the name',
2724
- 'look into', 'check what', 'what\'s in'
2734
+ needs_shell = any(word in question_lower for word in [
2735
+ 'directory', 'folder', 'where', 'find', 'list', 'files', 'look', 'search', 'check'
2725
2736
  ])
2726
2737
 
2727
- if (needs_shell_info or needs_find) and self.shell_session:
2728
- # Execute exploration commands
2738
+ if needs_shell and self.shell_session:
2729
2739
  try:
2740
+ # Use small LLM to plan shell command (smarter than regex)
2741
+ plan_response = await self.call_backend_query(
2742
+ query=planner_prompt,
2743
+ conversation_history=[],
2744
+ api_results={},
2745
+ tools_used=[]
2746
+ )
2747
+
2748
+ # Parse JSON plan
2749
+ import json as json_module
2750
+ plan_text = plan_response.response.strip()
2751
+ # Extract JSON if wrapped in markdown
2752
+ if '```' in plan_text:
2753
+ plan_text = plan_text.split('```')[1].replace('json', '').strip()
2754
+
2755
+ plan = json_module.loads(plan_text)
2756
+
2757
+ debug_mode = os.getenv("NOCTURNAL_DEBUG", "").lower() == "1"
2758
+ if debug_mode:
2759
+ print(f"🔍 LLM PLAN: {plan}")
2760
+
2730
2761
  api_results["shell_info"] = {}
2731
2762
 
2732
- # Always include current location
2733
- pwd_output = self.execute_command("pwd")
2734
- api_results["shell_info"]["current_directory"] = pwd_output.strip()
2763
+ # Execute based on plan
2764
+ action = plan.get("action", "none")
2735
2765
 
2736
- if needs_shell_info and not needs_find:
2737
- # Just list current directory
2738
- ls_output = self.execute_command("ls -lah")
2766
+ if action == "pwd":
2767
+ pwd_output = self.execute_command("pwd")
2768
+ api_results["shell_info"]["current_directory"] = pwd_output.strip()
2769
+ tools_used.append("shell_execution")
2770
+
2771
+ elif action == "ls":
2772
+ target = plan.get("target_path")
2773
+ if target:
2774
+ # List specific directory
2775
+ ls_output = self.execute_command(f"ls -lah {target}")
2776
+ else:
2777
+ # List current directory
2778
+ ls_output = self.execute_command("ls -lah")
2739
2779
  api_results["shell_info"]["directory_contents"] = ls_output
2780
+ if target:
2781
+ api_results["shell_info"]["target_path"] = target
2782
+ tools_used.append("shell_execution")
2740
2783
 
2741
- if needs_find:
2742
- # Smart search: extract directory name and location hints
2743
- import re
2744
-
2745
- # Check if user is referring to previous context ("it", "there")
2746
- has_pronoun = any(word in question_lower for word in ['it', 'there', 'that folder', 'that directory'])
2747
- pronoun_resolved = False
2748
-
2749
- if has_pronoun and len(self.conversation_history) > 0:
2750
- # Look for directory path in last assistant message
2751
- last_assistant = None
2752
- for msg in reversed(self.conversation_history):
2753
- if msg.get('role') == 'assistant':
2754
- last_assistant = msg.get('content', '')
2755
- break
2756
-
2757
- if last_assistant:
2758
- # Extract paths like /home/user/Downloads/cm522-main
2759
- paths = re.findall(r'(/[\w/.-]+)', last_assistant)
2760
- if paths:
2761
- # List contents of the first path found
2762
- target_path = paths[0]
2763
- ls_output = self.execute_command(f"ls -lah {target_path}")
2764
- api_results["shell_info"]["directory_contents"] = ls_output
2765
- api_results["shell_info"]["target_path"] = target_path
2766
- tools_used.append("shell_execution")
2767
- pronoun_resolved = True
2784
+ elif action == "find":
2785
+ search_target = plan.get("search_target", "")
2786
+ search_path = plan.get("search_path", "~")
2768
2787
 
2769
- # Generic search if no pronoun or pronoun not resolved
2770
- if not pronoun_resolved:
2771
- # SMART EXTRACTION: Use pattern matching + common sense
2772
- import re
2788
+ if search_target:
2789
+ find_cmd = f"find {search_path} -maxdepth 4 -type d -iname '*{search_target}*' 2>/dev/null | head -20"
2790
+ find_output = self.execute_command(find_cmd)
2773
2791
 
2774
- # Strategy: Look for quoted strings or alphanumeric codes
2775
- # Priority 1: Quoted strings ("cm522", 'my_folder')
2776
- quoted = re.findall(r'["\']([^"\']+)["\']', request.question)
2777
-
2778
- if quoted:
2779
- search_terms = quoted
2780
- else:
2781
- # Priority 2: Alphanumeric codes/IDs (cm522, hw03, proj_2024)
2782
- # Pattern: letters + numbers mixed, or underscores/dashes
2783
- codes = re.findall(r'\b([a-zA-Z]*\d+[a-zA-Z0-9_-]*|[a-zA-Z0-9]*[_-]+[a-zA-Z0-9]+)\b', request.question)
2784
-
2785
- # Priority 3: Capitalize words (likely proper nouns: GitHub, MyProject)
2786
- capitalized = re.findall(r'\b([A-Z][a-zA-Z0-9_-]+)\b', request.question)
2787
-
2788
- # Priority 4: Long words (≥ 6 chars, likely meaningful)
2789
- long_words = re.findall(r'\b([a-zA-Z]{6,})\b', request.question)
2790
-
2791
- # Combine and dedupe
2792
- search_terms = list(dict.fromkeys(codes + capitalized + long_words))
2793
-
2794
- # Filter out common words
2795
- common = {
2796
- 'looking', 'folder', 'directory', 'called', 'something',
2797
- 'downloads', 'documents', 'computer', 'somewhere'
2798
- }
2799
- search_terms = [t for t in search_terms if t.lower() not in common][:2]
2800
-
2801
- debug_mode = os.getenv("NOCTURNAL_DEBUG", "").lower() == "1"
2802
2792
  if debug_mode:
2803
- print(f"🔍 EXTRACTED SEARCH TERMS: {search_terms}")
2804
-
2805
- if not search_terms:
2806
- search_terms = [''] # Empty search to show "no target found"
2793
+ print(f"🔍 FIND EXECUTED: {find_cmd}")
2794
+ print(f"🔍 FIND OUTPUT: {repr(find_output)}")
2807
2795
 
2808
- # Detect location hints
2809
- search_path = "~" # Default to home
2810
- if 'downloads' in question_lower:
2811
- search_path = "~/Downloads"
2812
- elif 'documents' in question_lower:
2813
- search_path = "~/Documents"
2814
-
2815
- search_results = []
2816
-
2817
- for name in search_terms:
2818
- if not name:
2819
- continue
2820
-
2821
- # Search with increasing depth
2822
- find_cmd = f"find {search_path} -maxdepth 4 -type d -iname '*{name}*' 2>/dev/null | head -20"
2823
- find_output = self.execute_command(find_cmd)
2824
-
2825
- debug_mode = os.getenv("NOCTURNAL_DEBUG", "").lower() == "1"
2826
- if debug_mode:
2827
- print(f"🔍 FIND EXECUTED: {find_cmd}")
2828
- print(f"🔍 FIND OUTPUT: {repr(find_output)}")
2829
-
2830
- if find_output.strip():
2831
- search_results.append(f"Searched for '*{name}*' in {search_path}:\n{find_output}")
2832
-
2833
- if search_results:
2834
- api_results["shell_info"]["search_results"] = "\n\n".join(search_results)
2796
+ if find_output.strip():
2797
+ api_results["shell_info"]["search_results"] = f"Searched for '*{search_target}*' in {search_path}:\n{find_output}"
2835
2798
  else:
2836
- api_results["shell_info"]["search_results"] = f"No directories found matching query in {search_path}"
2799
+ api_results["shell_info"]["search_results"] = f"No directories matching '{search_target}' found in {search_path}"
2800
+ tools_used.append("shell_execution")
2837
2801
 
2838
- tools_used.append("shell_execution")
2802
+ # Always include current directory
2803
+ pwd_output = self.execute_command("pwd")
2804
+ api_results["shell_info"]["current_directory"] = pwd_output.strip()
2805
+
2839
2806
  except Exception as e:
2807
+ # LLM planner failed, skip shell execution
2808
+ debug_mode = os.getenv("NOCTURNAL_DEBUG", "").lower() == "1"
2840
2809
  if debug_mode:
2841
- print(f"🔍 Shell execution failed: {e}")
2810
+ print(f"🔍 Shell planner failed: {e}")
2811
+
2842
2812
 
2843
2813
  # DEBUG: Log exactly what we're sending to backend
2844
2814
  debug_mode = os.getenv("NOCTURNAL_DEBUG", "").lower() == "1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cite-agent
3
- Version: 1.2.13
3
+ Version: 1.3.0
4
4
  Summary: Terminal AI assistant for academic research with citation verification
5
5
  Home-page: https://github.com/Spectating101/cite-agent
6
6
  Author: Cite-Agent Team
@@ -7,7 +7,7 @@ long_description = readme_path.read_text() if readme_path.exists() else "Termina
7
7
 
8
8
  setup(
9
9
  name="cite-agent",
10
- version="1.2.13",
10
+ version="1.3.0",
11
11
  author="Cite-Agent Team",
12
12
  author_email="contact@citeagent.dev",
13
13
  description="Terminal AI assistant for academic research with citation verification",
@@ -1 +0,0 @@
1
- __version__ = "1.2.13"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes