alita-sdk 0.3.465__py3-none-any.whl → 0.3.486__py3-none-any.whl

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 alita-sdk might be problematic. Click here for more details.

Files changed (90) hide show
  1. alita_sdk/cli/agent/__init__.py +5 -0
  2. alita_sdk/cli/agent/default.py +83 -1
  3. alita_sdk/cli/agent_loader.py +6 -9
  4. alita_sdk/cli/agent_ui.py +13 -3
  5. alita_sdk/cli/agents.py +1866 -185
  6. alita_sdk/cli/callbacks.py +96 -25
  7. alita_sdk/cli/cli.py +10 -1
  8. alita_sdk/cli/config.py +151 -9
  9. alita_sdk/cli/context/__init__.py +30 -0
  10. alita_sdk/cli/context/cleanup.py +198 -0
  11. alita_sdk/cli/context/manager.py +731 -0
  12. alita_sdk/cli/context/message.py +285 -0
  13. alita_sdk/cli/context/strategies.py +289 -0
  14. alita_sdk/cli/context/token_estimation.py +127 -0
  15. alita_sdk/cli/input_handler.py +167 -4
  16. alita_sdk/cli/inventory.py +1256 -0
  17. alita_sdk/cli/toolkit.py +14 -17
  18. alita_sdk/cli/toolkit_loader.py +35 -5
  19. alita_sdk/cli/tools/__init__.py +8 -1
  20. alita_sdk/cli/tools/filesystem.py +815 -55
  21. alita_sdk/cli/tools/planning.py +143 -157
  22. alita_sdk/cli/tools/terminal.py +154 -20
  23. alita_sdk/community/__init__.py +64 -8
  24. alita_sdk/community/inventory/__init__.py +224 -0
  25. alita_sdk/community/inventory/config.py +257 -0
  26. alita_sdk/community/inventory/enrichment.py +2137 -0
  27. alita_sdk/community/inventory/extractors.py +1469 -0
  28. alita_sdk/community/inventory/ingestion.py +3172 -0
  29. alita_sdk/community/inventory/knowledge_graph.py +1457 -0
  30. alita_sdk/community/inventory/parsers/__init__.py +218 -0
  31. alita_sdk/community/inventory/parsers/base.py +295 -0
  32. alita_sdk/community/inventory/parsers/csharp_parser.py +907 -0
  33. alita_sdk/community/inventory/parsers/go_parser.py +851 -0
  34. alita_sdk/community/inventory/parsers/html_parser.py +389 -0
  35. alita_sdk/community/inventory/parsers/java_parser.py +593 -0
  36. alita_sdk/community/inventory/parsers/javascript_parser.py +629 -0
  37. alita_sdk/community/inventory/parsers/kotlin_parser.py +768 -0
  38. alita_sdk/community/inventory/parsers/markdown_parser.py +362 -0
  39. alita_sdk/community/inventory/parsers/python_parser.py +604 -0
  40. alita_sdk/community/inventory/parsers/rust_parser.py +858 -0
  41. alita_sdk/community/inventory/parsers/swift_parser.py +832 -0
  42. alita_sdk/community/inventory/parsers/text_parser.py +322 -0
  43. alita_sdk/community/inventory/parsers/yaml_parser.py +370 -0
  44. alita_sdk/community/inventory/patterns/__init__.py +61 -0
  45. alita_sdk/community/inventory/patterns/ast_adapter.py +380 -0
  46. alita_sdk/community/inventory/patterns/loader.py +348 -0
  47. alita_sdk/community/inventory/patterns/registry.py +198 -0
  48. alita_sdk/community/inventory/presets.py +535 -0
  49. alita_sdk/community/inventory/retrieval.py +1403 -0
  50. alita_sdk/community/inventory/toolkit.py +169 -0
  51. alita_sdk/community/inventory/visualize.py +1370 -0
  52. alita_sdk/configurations/bitbucket.py +0 -3
  53. alita_sdk/runtime/clients/client.py +84 -26
  54. alita_sdk/runtime/langchain/assistant.py +4 -2
  55. alita_sdk/runtime/langchain/langraph_agent.py +122 -31
  56. alita_sdk/runtime/llms/preloaded.py +2 -6
  57. alita_sdk/runtime/toolkits/__init__.py +2 -0
  58. alita_sdk/runtime/toolkits/application.py +1 -1
  59. alita_sdk/runtime/toolkits/mcp.py +46 -36
  60. alita_sdk/runtime/toolkits/planning.py +171 -0
  61. alita_sdk/runtime/toolkits/tools.py +39 -6
  62. alita_sdk/runtime/tools/llm.py +185 -8
  63. alita_sdk/runtime/tools/planning/__init__.py +36 -0
  64. alita_sdk/runtime/tools/planning/models.py +246 -0
  65. alita_sdk/runtime/tools/planning/wrapper.py +607 -0
  66. alita_sdk/runtime/tools/vectorstore_base.py +41 -6
  67. alita_sdk/runtime/utils/mcp_oauth.py +80 -0
  68. alita_sdk/runtime/utils/streamlit.py +6 -10
  69. alita_sdk/runtime/utils/toolkit_utils.py +19 -4
  70. alita_sdk/tools/__init__.py +54 -27
  71. alita_sdk/tools/ado/repos/repos_wrapper.py +1 -2
  72. alita_sdk/tools/base_indexer_toolkit.py +98 -19
  73. alita_sdk/tools/bitbucket/__init__.py +2 -2
  74. alita_sdk/tools/chunkers/__init__.py +3 -1
  75. alita_sdk/tools/chunkers/sematic/markdown_chunker.py +95 -6
  76. alita_sdk/tools/chunkers/universal_chunker.py +269 -0
  77. alita_sdk/tools/code_indexer_toolkit.py +55 -22
  78. alita_sdk/tools/elitea_base.py +86 -21
  79. alita_sdk/tools/jira/__init__.py +1 -1
  80. alita_sdk/tools/jira/api_wrapper.py +91 -40
  81. alita_sdk/tools/non_code_indexer_toolkit.py +1 -0
  82. alita_sdk/tools/qtest/__init__.py +1 -1
  83. alita_sdk/tools/vector_adapters/VectorStoreAdapter.py +8 -2
  84. alita_sdk/tools/zephyr_essential/api_wrapper.py +12 -13
  85. {alita_sdk-0.3.465.dist-info → alita_sdk-0.3.486.dist-info}/METADATA +2 -1
  86. {alita_sdk-0.3.465.dist-info → alita_sdk-0.3.486.dist-info}/RECORD +90 -50
  87. {alita_sdk-0.3.465.dist-info → alita_sdk-0.3.486.dist-info}/WHEEL +0 -0
  88. {alita_sdk-0.3.465.dist-info → alita_sdk-0.3.486.dist-info}/entry_points.txt +0 -0
  89. {alita_sdk-0.3.465.dist-info → alita_sdk-0.3.486.dist-info}/licenses/LICENSE +0 -0
  90. {alita_sdk-0.3.465.dist-info → alita_sdk-0.3.486.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,5 @@
1
+ """Default agent prompts for Alita CLI."""
2
+
3
+ from .default import DEFAULT_PROMPT
4
+
5
+ __all__ = ['DEFAULT_PROMPT']
@@ -61,6 +61,22 @@ Use `update_plan` when:
61
61
  - Ambiguity requires breaking down the approach
62
62
  - The user requests step-wise execution
63
63
 
64
+ ### Resuming existing plans
65
+
66
+ **Important**: Before creating a new plan, check if there's already an existing plan in progress:
67
+
68
+ - If the user says "continue" or similar, look at the current plan state shown in tool results
69
+ - If steps are already marked as completed (☑), **do not create a new plan** — continue executing the remaining uncompleted steps
70
+ - Only use `update_plan` to create a **new** plan when starting a fresh task
71
+ - Use `complete_step` to mark steps done as you finish them
72
+
73
+ When resuming after interruption (e.g., tool limit reached):
74
+
75
+ 1. Review which steps are already completed (☑)
76
+ 2. Identify the next uncompleted step (☐)
77
+ 3. Continue execution from that step — do NOT recreate the plan
78
+ 4. Mark steps complete as you go
79
+
64
80
  Example of a **high-quality test-oriented plan**:
65
81
 
66
82
  1. Reproduce failure locally
@@ -69,7 +85,7 @@ Example of a **high-quality test-oriented plan**:
69
85
  4. Patch locator + stabilize assertions
70
86
  5. Run whole suite to confirm no regressions
71
87
 
72
- Low-quality plans (run tests → fix things → done) are not acceptable.
88
+ Low-quality plans ("run tests → fix things → done") are not acceptable.
73
89
 
74
90
  ---
75
91
 
@@ -101,6 +117,72 @@ Common use cases include:
101
117
 
102
118
  ---
103
119
 
120
+ ## Handling files
121
+
122
+ ### CRITICAL: File creation and modification rules
123
+
124
+ **NEVER output entire file contents in your response.** Always use tools to write files.
125
+
126
+ When creating or modifying files:
127
+
128
+ 1. **Use incremental writes for new files**: Create files in logical sections using multiple tool calls:
129
+ - First call: Create file with initial structure (imports, class definition header)
130
+ - Subsequent calls: Add methods, functions, or sections one at a time using edit/append
131
+ - This prevents context overflow and ensures each part is properly written
132
+
133
+ 2. **Use edit tools for modifications**: Use `filesystem_edit_file` for precise text replacement instead of rewriting entire files
134
+
135
+ 3. **Never dump code in chat**: If you find yourself about to write a large code block in your response, STOP and use a file tool instead
136
+
137
+ Example - creating a test file correctly:
138
+ ```
139
+ # Call 1: Create file with structure
140
+ filesystem_write_file("test_api.py", "import pytest\\nimport requests\\n\\n")
141
+
142
+ # Call 2: Append first test class/method
143
+ filesystem_append_file("test_api.py", "class TestAPI:\\n def test_health(self):\\n assert requests.get('/health').status_code == 200\\n")
144
+
145
+ # Call 3: Append second test method
146
+ filesystem_append_file("test_api.py", "\\n def test_auth(self):\\n assert requests.get('/protected').status_code == 401\\n")
147
+ ```
148
+
149
+ **Why this matters**: Large file outputs can exceed token limits, cause truncation, or fail silently. Incremental writes are reliable and verifiable.
150
+
151
+ ### Reading large files
152
+
153
+ When working with large files (logs, test reports, data files, source code):
154
+
155
+ - **Read in chunks**: Use offset and limit parameters to read files in manageable sections (e.g., 500-1000 lines at a time)
156
+ - **Start with structure**: First scan the file to understand its layout before diving into specific sections
157
+ - **Target relevant sections**: Once you identify the area of interest, read only that portion in detail
158
+ - **Avoid full loads**: Loading entire large files into context can cause models to return empty or incomplete responses due to context limitations
159
+
160
+ Example approach:
161
+ 1. Read first 100 lines to understand file structure
162
+ 2. Search/grep for relevant patterns to locate target sections
163
+ 3. Read specific line ranges where issues or relevant code exist
164
+
165
+ ### Writing and updating files
166
+
167
+ When modifying files, especially large ones:
168
+
169
+ - **Update in pieces**: Make targeted edits to specific sections, paragraphs, or functions rather than rewriting entire files
170
+ - **Use precise replacements**: Replace exact strings with sufficient context (3-5 lines before/after) to ensure unique matches
171
+ - **Batch related changes**: Group logically related edits together, but keep each edit focused and minimal
172
+ - **Preserve structure**: Maintain existing formatting, indentation, and file organization
173
+ - **Avoid full rewrites**: Never regenerate an entire file when only a portion needs changes
174
+
175
+ ### Context limitations warning
176
+
177
+ **Important**: When context becomes too large (many files, long outputs, extensive history), some models may return empty or truncated responses. If you notice this:
178
+
179
+ - Summarize previous findings before continuing
180
+ - Focus on one file or task at a time
181
+ - Clear irrelevant context from consideration
182
+ - Break complex operations into smaller, sequential steps
183
+
184
+ ---
185
+
104
186
  ## Sandbox and approvals
105
187
 
106
188
  Sandboxing and approval rules are identical to coding agents, but framed around testing actions:
@@ -128,12 +128,12 @@ def build_agent_data_structure(agent_def: Dict[str, Any], toolkit_configs: list,
128
128
  if hasattr(toolkit_class, 'toolkit_config_schema'):
129
129
  schema = toolkit_class.toolkit_config_schema()
130
130
  validated_config = schema(**toolkit_config)
131
- validated_dict = validated_config.model_dump()
132
- validated_dict['type'] = toolkit_config.get('type')
133
- validated_dict['toolkit_name'] = toolkit_config.get('toolkit_name')
134
- validated_toolkit_configs.append(validated_dict)
135
- else:
136
- validated_toolkit_configs.append(toolkit_config)
131
+ # validated_dict = validated_config.model_dump()
132
+ # validated_dict['type'] = toolkit_config.get('type')
133
+ # validated_dict['toolkit_name'] = toolkit_config.get('toolkit_name')
134
+ # validated_toolkit_configs.append(validated_dict)
135
+
136
+ validated_toolkit_configs.append(toolkit_config)
137
137
  else:
138
138
  validated_toolkit_configs.append(toolkit_config)
139
139
  except Exception:
@@ -168,7 +168,6 @@ def build_agent_data_structure(agent_def: Dict[str, Any], toolkit_configs: list,
168
168
  'settings': toolkit_config,
169
169
  'selected_tools': toolkit_config.get('selected_tools', [])
170
170
  })
171
-
172
171
  return {
173
172
  'instructions': agent_def.get('system_prompt', ''),
174
173
  'tools': tools,
@@ -181,8 +180,6 @@ def build_agent_data_structure(agent_def: Dict[str, Any], toolkit_configs: list,
181
180
  'model_name': llm_model,
182
181
  'max_tokens': llm_max_tokens,
183
182
  'temperature': llm_temperature,
184
- 'top_p': 1.0,
185
- 'top_k': 0,
186
183
  'integration_uid': None,
187
184
  'indexer_config': {
188
185
  'ai_model': 'langchain_openai.ChatOpenAI',
alita_sdk/cli/agent_ui.py CHANGED
@@ -79,7 +79,7 @@ def print_help():
79
79
  padding=(0, 1),
80
80
  )
81
81
 
82
- table.add_column("Command", style="bold yellow", no_wrap=True, width=14)
82
+ table.add_column("Command", style="bold yellow", no_wrap=True, width=16)
83
83
  table.add_column("Description", style="white")
84
84
 
85
85
  table.add_row("/clear", "Clear conversation history")
@@ -89,10 +89,13 @@ def print_help():
89
89
  table.add_row("/model", "Switch to a different model (preserves history)")
90
90
  table.add_row("/reload", "Reload agent from file (hot reload)")
91
91
  table.add_row("/mode", "Set approval mode: always, auto, yolo")
92
- table.add_row("/dir <path>", "Mount workspace directory for terminal access")
92
+ table.add_row("/dir [add|rm] <path>", "Add/remove/list allowed directories")
93
+ table.add_row("/inventory <path>", "Load inventory/knowledge graph from JSON file")
93
94
  table.add_row("/session", "List or resume previous sessions with plans")
94
95
  table.add_row("/add_mcp", "Add an MCP server (preserves history)")
95
96
  table.add_row("/add_toolkit", "Add a toolkit (preserves history)")
97
+ table.add_row("/rm_mcp", "Remove an MCP server")
98
+ table.add_row("/rm_toolkit", "Remove a toolkit")
96
99
  table.add_row("/help", "Show this help")
97
100
  table.add_row("exit", "End conversation")
98
101
 
@@ -142,9 +145,11 @@ def print_welcome(agent_name: str, model: str = "gpt-4o", temperature: float = 0
142
145
  right_content.append("/mode", style="bold yellow")
143
146
  right_content.append(" Set approval mode\n", style="dim")
144
147
  right_content.append("/dir", style="bold yellow")
145
- right_content.append(" Mount directory\n", style="dim")
148
+ right_content.append(" Add/list directories\n", style="dim")
146
149
  right_content.append("/session", style="bold yellow")
147
150
  right_content.append(" List/resume sessions\n", style="dim")
151
+ right_content.append("/inventory", style="bold yellow")
152
+ right_content.append(" Load knowledge graph\n", style="dim")
148
153
  right_content.append("/add_mcp", style="bold yellow")
149
154
  right_content.append(" Add MCP server\n", style="dim")
150
155
  right_content.append("/add_toolkit", style="bold yellow")
@@ -193,6 +198,11 @@ def display_output(agent_name: str, message: str, output: str):
193
198
  console.print(f"\n[bold cyan]🤖 Agent: {agent_name}[/bold cyan]\n")
194
199
  console.print(f"[bold]Message:[/bold] {message}\n")
195
200
  console.print("[bold]Response:[/bold]")
201
+
202
+ # Ensure output is a string
203
+ if not isinstance(output, str):
204
+ output = str(output)
205
+
196
206
  if any(marker in output for marker in ['```', '**', '##', '- ', '* ']):
197
207
  console.print(Markdown(output))
198
208
  else: