alita-sdk 0.3.257__py3-none-any.whl → 0.3.584__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.
- alita_sdk/cli/__init__.py +10 -0
- alita_sdk/cli/__main__.py +17 -0
- alita_sdk/cli/agent/__init__.py +5 -0
- alita_sdk/cli/agent/default.py +258 -0
- alita_sdk/cli/agent_executor.py +155 -0
- alita_sdk/cli/agent_loader.py +215 -0
- alita_sdk/cli/agent_ui.py +228 -0
- alita_sdk/cli/agents.py +3794 -0
- alita_sdk/cli/callbacks.py +647 -0
- alita_sdk/cli/cli.py +168 -0
- alita_sdk/cli/config.py +306 -0
- alita_sdk/cli/context/__init__.py +30 -0
- alita_sdk/cli/context/cleanup.py +198 -0
- alita_sdk/cli/context/manager.py +731 -0
- alita_sdk/cli/context/message.py +285 -0
- alita_sdk/cli/context/strategies.py +289 -0
- alita_sdk/cli/context/token_estimation.py +127 -0
- alita_sdk/cli/formatting.py +182 -0
- alita_sdk/cli/input_handler.py +419 -0
- alita_sdk/cli/inventory.py +1073 -0
- alita_sdk/cli/mcp_loader.py +315 -0
- alita_sdk/cli/toolkit.py +327 -0
- alita_sdk/cli/toolkit_loader.py +85 -0
- alita_sdk/cli/tools/__init__.py +43 -0
- alita_sdk/cli/tools/approval.py +224 -0
- alita_sdk/cli/tools/filesystem.py +1751 -0
- alita_sdk/cli/tools/planning.py +389 -0
- alita_sdk/cli/tools/terminal.py +414 -0
- alita_sdk/community/__init__.py +72 -12
- alita_sdk/community/inventory/__init__.py +236 -0
- alita_sdk/community/inventory/config.py +257 -0
- alita_sdk/community/inventory/enrichment.py +2137 -0
- alita_sdk/community/inventory/extractors.py +1469 -0
- alita_sdk/community/inventory/ingestion.py +3172 -0
- alita_sdk/community/inventory/knowledge_graph.py +1457 -0
- alita_sdk/community/inventory/parsers/__init__.py +218 -0
- alita_sdk/community/inventory/parsers/base.py +295 -0
- alita_sdk/community/inventory/parsers/csharp_parser.py +907 -0
- alita_sdk/community/inventory/parsers/go_parser.py +851 -0
- alita_sdk/community/inventory/parsers/html_parser.py +389 -0
- alita_sdk/community/inventory/parsers/java_parser.py +593 -0
- alita_sdk/community/inventory/parsers/javascript_parser.py +629 -0
- alita_sdk/community/inventory/parsers/kotlin_parser.py +768 -0
- alita_sdk/community/inventory/parsers/markdown_parser.py +362 -0
- alita_sdk/community/inventory/parsers/python_parser.py +604 -0
- alita_sdk/community/inventory/parsers/rust_parser.py +858 -0
- alita_sdk/community/inventory/parsers/swift_parser.py +832 -0
- alita_sdk/community/inventory/parsers/text_parser.py +322 -0
- alita_sdk/community/inventory/parsers/yaml_parser.py +370 -0
- alita_sdk/community/inventory/patterns/__init__.py +61 -0
- alita_sdk/community/inventory/patterns/ast_adapter.py +380 -0
- alita_sdk/community/inventory/patterns/loader.py +348 -0
- alita_sdk/community/inventory/patterns/registry.py +198 -0
- alita_sdk/community/inventory/presets.py +535 -0
- alita_sdk/community/inventory/retrieval.py +1403 -0
- alita_sdk/community/inventory/toolkit.py +173 -0
- alita_sdk/community/inventory/toolkit_utils.py +176 -0
- alita_sdk/community/inventory/visualize.py +1370 -0
- alita_sdk/configurations/__init__.py +11 -0
- alita_sdk/configurations/ado.py +148 -2
- alita_sdk/configurations/azure_search.py +1 -1
- alita_sdk/configurations/bigquery.py +1 -1
- alita_sdk/configurations/bitbucket.py +94 -2
- alita_sdk/configurations/browser.py +18 -0
- alita_sdk/configurations/carrier.py +19 -0
- alita_sdk/configurations/confluence.py +130 -1
- alita_sdk/configurations/delta_lake.py +1 -1
- alita_sdk/configurations/figma.py +76 -5
- alita_sdk/configurations/github.py +65 -1
- alita_sdk/configurations/gitlab.py +81 -0
- alita_sdk/configurations/google_places.py +17 -0
- alita_sdk/configurations/jira.py +103 -0
- alita_sdk/configurations/openapi.py +323 -0
- alita_sdk/configurations/postman.py +1 -1
- alita_sdk/configurations/qtest.py +72 -3
- alita_sdk/configurations/report_portal.py +115 -0
- alita_sdk/configurations/salesforce.py +19 -0
- alita_sdk/configurations/service_now.py +1 -12
- alita_sdk/configurations/sharepoint.py +167 -0
- alita_sdk/configurations/sonar.py +18 -0
- alita_sdk/configurations/sql.py +20 -0
- alita_sdk/configurations/testio.py +101 -0
- alita_sdk/configurations/testrail.py +88 -0
- alita_sdk/configurations/xray.py +94 -1
- alita_sdk/configurations/zephyr_enterprise.py +94 -1
- alita_sdk/configurations/zephyr_essential.py +95 -0
- alita_sdk/runtime/clients/artifact.py +21 -4
- alita_sdk/runtime/clients/client.py +458 -67
- alita_sdk/runtime/clients/mcp_discovery.py +342 -0
- alita_sdk/runtime/clients/mcp_manager.py +262 -0
- alita_sdk/runtime/clients/sandbox_client.py +352 -0
- alita_sdk/runtime/langchain/_constants_bkup.py +1318 -0
- alita_sdk/runtime/langchain/assistant.py +183 -43
- alita_sdk/runtime/langchain/constants.py +647 -1
- alita_sdk/runtime/langchain/document_loaders/AlitaDocxMammothLoader.py +315 -3
- alita_sdk/runtime/langchain/document_loaders/AlitaExcelLoader.py +209 -31
- alita_sdk/runtime/langchain/document_loaders/AlitaImageLoader.py +1 -1
- alita_sdk/runtime/langchain/document_loaders/AlitaJSONLinesLoader.py +77 -0
- alita_sdk/runtime/langchain/document_loaders/AlitaJSONLoader.py +10 -3
- alita_sdk/runtime/langchain/document_loaders/AlitaMarkdownLoader.py +66 -0
- alita_sdk/runtime/langchain/document_loaders/AlitaPDFLoader.py +79 -10
- alita_sdk/runtime/langchain/document_loaders/AlitaPowerPointLoader.py +52 -15
- alita_sdk/runtime/langchain/document_loaders/AlitaPythonLoader.py +9 -0
- alita_sdk/runtime/langchain/document_loaders/AlitaTableLoader.py +1 -4
- alita_sdk/runtime/langchain/document_loaders/AlitaTextLoader.py +15 -2
- alita_sdk/runtime/langchain/document_loaders/ImageParser.py +30 -0
- alita_sdk/runtime/langchain/document_loaders/constants.py +189 -41
- alita_sdk/runtime/langchain/interfaces/llm_processor.py +4 -2
- alita_sdk/runtime/langchain/langraph_agent.py +493 -105
- alita_sdk/runtime/langchain/utils.py +118 -8
- alita_sdk/runtime/llms/preloaded.py +2 -6
- alita_sdk/runtime/models/mcp_models.py +61 -0
- alita_sdk/runtime/skills/__init__.py +91 -0
- alita_sdk/runtime/skills/callbacks.py +498 -0
- alita_sdk/runtime/skills/discovery.py +540 -0
- alita_sdk/runtime/skills/executor.py +610 -0
- alita_sdk/runtime/skills/input_builder.py +371 -0
- alita_sdk/runtime/skills/models.py +330 -0
- alita_sdk/runtime/skills/registry.py +355 -0
- alita_sdk/runtime/skills/skill_runner.py +330 -0
- alita_sdk/runtime/toolkits/__init__.py +28 -0
- alita_sdk/runtime/toolkits/application.py +14 -4
- alita_sdk/runtime/toolkits/artifact.py +25 -9
- alita_sdk/runtime/toolkits/datasource.py +13 -6
- alita_sdk/runtime/toolkits/mcp.py +782 -0
- alita_sdk/runtime/toolkits/planning.py +178 -0
- alita_sdk/runtime/toolkits/skill_router.py +238 -0
- alita_sdk/runtime/toolkits/subgraph.py +11 -6
- alita_sdk/runtime/toolkits/tools.py +314 -70
- alita_sdk/runtime/toolkits/vectorstore.py +11 -5
- alita_sdk/runtime/tools/__init__.py +24 -0
- alita_sdk/runtime/tools/application.py +16 -4
- alita_sdk/runtime/tools/artifact.py +367 -33
- alita_sdk/runtime/tools/data_analysis.py +183 -0
- alita_sdk/runtime/tools/function.py +100 -4
- alita_sdk/runtime/tools/graph.py +81 -0
- alita_sdk/runtime/tools/image_generation.py +218 -0
- alita_sdk/runtime/tools/llm.py +1032 -177
- alita_sdk/runtime/tools/loop.py +3 -1
- alita_sdk/runtime/tools/loop_output.py +3 -1
- alita_sdk/runtime/tools/mcp_inspect_tool.py +284 -0
- alita_sdk/runtime/tools/mcp_remote_tool.py +181 -0
- alita_sdk/runtime/tools/mcp_server_tool.py +3 -1
- alita_sdk/runtime/tools/planning/__init__.py +36 -0
- alita_sdk/runtime/tools/planning/models.py +246 -0
- alita_sdk/runtime/tools/planning/wrapper.py +607 -0
- alita_sdk/runtime/tools/router.py +2 -1
- alita_sdk/runtime/tools/sandbox.py +375 -0
- alita_sdk/runtime/tools/skill_router.py +776 -0
- alita_sdk/runtime/tools/tool.py +3 -1
- alita_sdk/runtime/tools/vectorstore.py +69 -65
- alita_sdk/runtime/tools/vectorstore_base.py +163 -90
- alita_sdk/runtime/utils/AlitaCallback.py +137 -21
- alita_sdk/runtime/utils/constants.py +5 -1
- alita_sdk/runtime/utils/mcp_client.py +492 -0
- alita_sdk/runtime/utils/mcp_oauth.py +361 -0
- alita_sdk/runtime/utils/mcp_sse_client.py +434 -0
- alita_sdk/runtime/utils/mcp_tools_discovery.py +124 -0
- alita_sdk/runtime/utils/streamlit.py +41 -14
- alita_sdk/runtime/utils/toolkit_utils.py +28 -9
- alita_sdk/runtime/utils/utils.py +48 -0
- alita_sdk/tools/__init__.py +135 -37
- alita_sdk/tools/ado/__init__.py +2 -2
- alita_sdk/tools/ado/repos/__init__.py +16 -19
- alita_sdk/tools/ado/repos/repos_wrapper.py +12 -20
- alita_sdk/tools/ado/test_plan/__init__.py +27 -8
- alita_sdk/tools/ado/test_plan/test_plan_wrapper.py +56 -28
- alita_sdk/tools/ado/wiki/__init__.py +28 -12
- alita_sdk/tools/ado/wiki/ado_wrapper.py +114 -40
- alita_sdk/tools/ado/work_item/__init__.py +28 -12
- alita_sdk/tools/ado/work_item/ado_wrapper.py +95 -11
- alita_sdk/tools/advanced_jira_mining/__init__.py +13 -8
- alita_sdk/tools/aws/delta_lake/__init__.py +15 -11
- alita_sdk/tools/aws/delta_lake/tool.py +5 -1
- alita_sdk/tools/azure_ai/search/__init__.py +14 -8
- alita_sdk/tools/base/tool.py +5 -1
- alita_sdk/tools/base_indexer_toolkit.py +454 -110
- alita_sdk/tools/bitbucket/__init__.py +28 -19
- alita_sdk/tools/bitbucket/api_wrapper.py +285 -27
- alita_sdk/tools/bitbucket/cloud_api_wrapper.py +5 -5
- alita_sdk/tools/browser/__init__.py +41 -16
- alita_sdk/tools/browser/crawler.py +3 -1
- alita_sdk/tools/browser/utils.py +15 -6
- alita_sdk/tools/carrier/__init__.py +18 -17
- alita_sdk/tools/carrier/backend_reports_tool.py +8 -4
- alita_sdk/tools/carrier/excel_reporter.py +8 -4
- alita_sdk/tools/chunkers/__init__.py +3 -1
- alita_sdk/tools/chunkers/code/codeparser.py +1 -1
- alita_sdk/tools/chunkers/sematic/json_chunker.py +2 -1
- alita_sdk/tools/chunkers/sematic/markdown_chunker.py +97 -6
- alita_sdk/tools/chunkers/sematic/proposal_chunker.py +1 -1
- alita_sdk/tools/chunkers/universal_chunker.py +270 -0
- alita_sdk/tools/cloud/aws/__init__.py +12 -7
- alita_sdk/tools/cloud/azure/__init__.py +12 -7
- alita_sdk/tools/cloud/gcp/__init__.py +12 -7
- alita_sdk/tools/cloud/k8s/__init__.py +12 -7
- alita_sdk/tools/code/linter/__init__.py +10 -8
- alita_sdk/tools/code/loaders/codesearcher.py +3 -2
- alita_sdk/tools/code/sonar/__init__.py +21 -13
- alita_sdk/tools/code_indexer_toolkit.py +199 -0
- alita_sdk/tools/confluence/__init__.py +22 -14
- alita_sdk/tools/confluence/api_wrapper.py +197 -58
- alita_sdk/tools/confluence/loader.py +14 -2
- alita_sdk/tools/custom_open_api/__init__.py +12 -5
- alita_sdk/tools/elastic/__init__.py +11 -8
- alita_sdk/tools/elitea_base.py +546 -64
- alita_sdk/tools/figma/__init__.py +60 -11
- alita_sdk/tools/figma/api_wrapper.py +1400 -167
- alita_sdk/tools/figma/figma_client.py +73 -0
- alita_sdk/tools/figma/toon_tools.py +2748 -0
- alita_sdk/tools/github/__init__.py +18 -17
- alita_sdk/tools/github/api_wrapper.py +9 -26
- alita_sdk/tools/github/github_client.py +81 -12
- alita_sdk/tools/github/schemas.py +2 -1
- alita_sdk/tools/github/tool.py +5 -1
- alita_sdk/tools/gitlab/__init__.py +19 -13
- alita_sdk/tools/gitlab/api_wrapper.py +256 -80
- alita_sdk/tools/gitlab_org/__init__.py +14 -10
- alita_sdk/tools/google/bigquery/__init__.py +14 -13
- alita_sdk/tools/google/bigquery/tool.py +5 -1
- alita_sdk/tools/google_places/__init__.py +21 -11
- alita_sdk/tools/jira/__init__.py +22 -11
- alita_sdk/tools/jira/api_wrapper.py +315 -168
- alita_sdk/tools/keycloak/__init__.py +11 -8
- alita_sdk/tools/localgit/__init__.py +9 -3
- alita_sdk/tools/localgit/local_git.py +62 -54
- alita_sdk/tools/localgit/tool.py +5 -1
- alita_sdk/tools/memory/__init__.py +38 -14
- alita_sdk/tools/non_code_indexer_toolkit.py +7 -2
- alita_sdk/tools/ocr/__init__.py +11 -8
- alita_sdk/tools/openapi/__init__.py +491 -106
- alita_sdk/tools/openapi/api_wrapper.py +1357 -0
- alita_sdk/tools/openapi/tool.py +20 -0
- alita_sdk/tools/pandas/__init__.py +20 -12
- alita_sdk/tools/pandas/api_wrapper.py +40 -45
- alita_sdk/tools/pandas/dataframe/generator/base.py +3 -1
- alita_sdk/tools/postman/__init__.py +11 -11
- alita_sdk/tools/postman/api_wrapper.py +19 -8
- alita_sdk/tools/postman/postman_analysis.py +8 -1
- alita_sdk/tools/pptx/__init__.py +11 -10
- alita_sdk/tools/qtest/__init__.py +22 -14
- alita_sdk/tools/qtest/api_wrapper.py +1784 -88
- alita_sdk/tools/rally/__init__.py +13 -10
- alita_sdk/tools/report_portal/__init__.py +23 -16
- alita_sdk/tools/salesforce/__init__.py +22 -16
- alita_sdk/tools/servicenow/__init__.py +21 -16
- alita_sdk/tools/servicenow/api_wrapper.py +1 -1
- alita_sdk/tools/sharepoint/__init__.py +17 -14
- alita_sdk/tools/sharepoint/api_wrapper.py +179 -39
- alita_sdk/tools/sharepoint/authorization_helper.py +191 -1
- alita_sdk/tools/sharepoint/utils.py +8 -2
- alita_sdk/tools/slack/__init__.py +13 -8
- alita_sdk/tools/sql/__init__.py +22 -19
- alita_sdk/tools/sql/api_wrapper.py +71 -23
- alita_sdk/tools/testio/__init__.py +21 -13
- alita_sdk/tools/testrail/__init__.py +13 -11
- alita_sdk/tools/testrail/api_wrapper.py +214 -46
- alita_sdk/tools/utils/__init__.py +28 -4
- alita_sdk/tools/utils/content_parser.py +241 -55
- alita_sdk/tools/utils/text_operations.py +254 -0
- alita_sdk/tools/vector_adapters/VectorStoreAdapter.py +83 -27
- alita_sdk/tools/xray/__init__.py +18 -14
- alita_sdk/tools/xray/api_wrapper.py +58 -113
- alita_sdk/tools/yagmail/__init__.py +9 -3
- alita_sdk/tools/zephyr/__init__.py +12 -7
- alita_sdk/tools/zephyr_enterprise/__init__.py +16 -9
- alita_sdk/tools/zephyr_enterprise/api_wrapper.py +30 -15
- alita_sdk/tools/zephyr_essential/__init__.py +16 -10
- alita_sdk/tools/zephyr_essential/api_wrapper.py +297 -54
- alita_sdk/tools/zephyr_essential/client.py +6 -4
- alita_sdk/tools/zephyr_scale/__init__.py +13 -8
- alita_sdk/tools/zephyr_scale/api_wrapper.py +39 -31
- alita_sdk/tools/zephyr_squad/__init__.py +12 -7
- {alita_sdk-0.3.257.dist-info → alita_sdk-0.3.584.dist-info}/METADATA +184 -37
- alita_sdk-0.3.584.dist-info/RECORD +452 -0
- alita_sdk-0.3.584.dist-info/entry_points.txt +2 -0
- alita_sdk/tools/bitbucket/tools.py +0 -304
- alita_sdk-0.3.257.dist-info/RECORD +0 -343
- {alita_sdk-0.3.257.dist-info → alita_sdk-0.3.584.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.257.dist-info → alita_sdk-0.3.584.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.257.dist-info → alita_sdk-0.3.584.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Agent UI and display utilities.
|
|
3
|
+
|
|
4
|
+
Rich console formatting for agent interactions.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from rich.console import Console, Group
|
|
8
|
+
from rich.panel import Panel
|
|
9
|
+
from rich.table import Table
|
|
10
|
+
from rich.markdown import Markdown
|
|
11
|
+
from rich import box
|
|
12
|
+
from rich.text import Text
|
|
13
|
+
from rich.align import Align
|
|
14
|
+
from rich.columns import Columns
|
|
15
|
+
from rich.rule import Rule
|
|
16
|
+
|
|
17
|
+
console = Console()
|
|
18
|
+
|
|
19
|
+
# ALITA ASCII Art Logo - block letters
|
|
20
|
+
ALITA_LOGO = [
|
|
21
|
+
" █████╗ ██╗ ██╗████████╗ █████╗ ",
|
|
22
|
+
"██╔══██╗██║ ██║╚══██╔══╝██╔══██╗",
|
|
23
|
+
"███████║██║ ██║ ██║ ███████║",
|
|
24
|
+
"██╔══██║██║ ██║ ██║ ██╔══██║",
|
|
25
|
+
"██║ ██║███████╗██║ ██║ ██║ ██║",
|
|
26
|
+
"╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def get_version():
|
|
31
|
+
"""Get CLI version from package."""
|
|
32
|
+
try:
|
|
33
|
+
from importlib.metadata import version
|
|
34
|
+
return version('alita_sdk')
|
|
35
|
+
except Exception:
|
|
36
|
+
return "0.3.x"
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def print_banner(agent_name: str, agent_type: str = "Local Agent"):
|
|
40
|
+
"""Print a cool banner for the chat session with ASCII art."""
|
|
41
|
+
|
|
42
|
+
version = get_version()
|
|
43
|
+
|
|
44
|
+
# Create the main banner content
|
|
45
|
+
banner_text = Text()
|
|
46
|
+
|
|
47
|
+
# Add logo lines with cyan styling
|
|
48
|
+
for line in ALITA_LOGO:
|
|
49
|
+
banner_text.append(" " + line + "\n", style="bold cyan")
|
|
50
|
+
|
|
51
|
+
banner_text.append("\n")
|
|
52
|
+
banner_text.append(" CLI ", style="dim")
|
|
53
|
+
banner_text.append(f"v{version}\n\n", style="bold white")
|
|
54
|
+
|
|
55
|
+
# Agent info
|
|
56
|
+
banner_text.append(" ● ", style="bold green")
|
|
57
|
+
banner_text.append("Agent: ", style="bold white")
|
|
58
|
+
banner_text.append(f"{agent_name}\n", style="bold cyan")
|
|
59
|
+
banner_text.append(" ● ", style="bold green")
|
|
60
|
+
banner_text.append("Type: ", style="bold white")
|
|
61
|
+
banner_text.append(f"{agent_type}\n", style="cyan")
|
|
62
|
+
|
|
63
|
+
console.print()
|
|
64
|
+
console.print(Panel(
|
|
65
|
+
banner_text,
|
|
66
|
+
box=box.DOUBLE,
|
|
67
|
+
border_style="cyan",
|
|
68
|
+
padding=(0, 2),
|
|
69
|
+
))
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def print_help():
|
|
73
|
+
"""Print help message with commands using rich table."""
|
|
74
|
+
table = Table(
|
|
75
|
+
show_header=True,
|
|
76
|
+
header_style="bold cyan",
|
|
77
|
+
border_style="dim",
|
|
78
|
+
box=box.SIMPLE,
|
|
79
|
+
padding=(0, 1),
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
table.add_column("Command", style="bold yellow", no_wrap=True, width=16)
|
|
83
|
+
table.add_column("Description", style="white")
|
|
84
|
+
|
|
85
|
+
table.add_row("/clear", "Clear conversation history")
|
|
86
|
+
table.add_row("/history", "Show conversation history")
|
|
87
|
+
table.add_row("/save", "Save conversation to file")
|
|
88
|
+
table.add_row("/agent", "Switch to a different agent or direct chat")
|
|
89
|
+
table.add_row("/model", "Switch to a different model (preserves history)")
|
|
90
|
+
table.add_row("/reload", "Reload agent from file (hot reload)")
|
|
91
|
+
table.add_row("/mode", "Set approval mode: always, auto, yolo")
|
|
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")
|
|
94
|
+
table.add_row("/session", "List or resume previous sessions with plans")
|
|
95
|
+
table.add_row("/add_mcp", "Add an MCP server (preserves history)")
|
|
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")
|
|
99
|
+
table.add_row("/help", "Show this help")
|
|
100
|
+
table.add_row("exit", "End conversation")
|
|
101
|
+
|
|
102
|
+
console.print(table)
|
|
103
|
+
console.print()
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def print_welcome(agent_name: str, model: str = "gpt-4o", temperature: float = 0.1, mode: str = "always"):
|
|
107
|
+
"""Print combined welcome banner with logo, agent info, and help in two columns."""
|
|
108
|
+
|
|
109
|
+
version = get_version()
|
|
110
|
+
|
|
111
|
+
# Mode display with color
|
|
112
|
+
mode_colors = {'always': 'yellow', 'auto': 'green', 'yolo': 'red'}
|
|
113
|
+
mode_color = mode_colors.get(mode, 'white')
|
|
114
|
+
|
|
115
|
+
# Left column: Logo + version + agent info
|
|
116
|
+
left_content = Text()
|
|
117
|
+
for line in ALITA_LOGO:
|
|
118
|
+
left_content.append(line + "\n", style="bold cyan")
|
|
119
|
+
left_content.append(" CLI ", style="dim")
|
|
120
|
+
left_content.append(f"v{version}\n\n", style="bold white")
|
|
121
|
+
left_content.append("● ", style="bold green")
|
|
122
|
+
left_content.append("Agent: ", style="bold white")
|
|
123
|
+
left_content.append(f"{agent_name}\n", style="bold cyan")
|
|
124
|
+
left_content.append("● ", style="bold green")
|
|
125
|
+
left_content.append("Model: ", style="bold white")
|
|
126
|
+
left_content.append(f"{model}", style="cyan")
|
|
127
|
+
left_content.append(" | ", style="dim")
|
|
128
|
+
left_content.append("Temp: ", style="bold white")
|
|
129
|
+
left_content.append(f"{temperature}\n", style="cyan")
|
|
130
|
+
left_content.append("● ", style="bold green")
|
|
131
|
+
left_content.append("Mode: ", style="bold white")
|
|
132
|
+
left_content.append(f"{mode}\n", style=f"bold {mode_color}")
|
|
133
|
+
|
|
134
|
+
# Right column: Commands
|
|
135
|
+
right_content = Text()
|
|
136
|
+
right_content.append("\n") # Align with logo
|
|
137
|
+
right_content.append("/help", style="bold yellow")
|
|
138
|
+
right_content.append(" Show all commands\n", style="dim")
|
|
139
|
+
right_content.append("/agent", style="bold yellow")
|
|
140
|
+
right_content.append(" Switch agent\n", style="dim")
|
|
141
|
+
right_content.append("/model", style="bold yellow")
|
|
142
|
+
right_content.append(" Switch model\n", style="dim")
|
|
143
|
+
right_content.append("/reload", style="bold yellow")
|
|
144
|
+
right_content.append(" Reload agent file\n", style="dim")
|
|
145
|
+
right_content.append("/mode", style="bold yellow")
|
|
146
|
+
right_content.append(" Set approval mode\n", style="dim")
|
|
147
|
+
right_content.append("/dir", style="bold yellow")
|
|
148
|
+
right_content.append(" Add/list directories\n", style="dim")
|
|
149
|
+
right_content.append("/session", style="bold yellow")
|
|
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")
|
|
153
|
+
right_content.append("/add_mcp", style="bold yellow")
|
|
154
|
+
right_content.append(" Add MCP server\n", style="dim")
|
|
155
|
+
right_content.append("/add_toolkit", style="bold yellow")
|
|
156
|
+
right_content.append(" Add toolkit\n", style="dim")
|
|
157
|
+
right_content.append("exit", style="bold yellow")
|
|
158
|
+
right_content.append(" End conversation\n", style="dim")
|
|
159
|
+
|
|
160
|
+
# Create two-column layout
|
|
161
|
+
columns = Columns([left_content, right_content], padding=(0, 4), expand=False)
|
|
162
|
+
|
|
163
|
+
console.print()
|
|
164
|
+
console.print(Panel(
|
|
165
|
+
columns,
|
|
166
|
+
box=box.DOUBLE,
|
|
167
|
+
border_style="cyan",
|
|
168
|
+
padding=(1, 2),
|
|
169
|
+
))
|
|
170
|
+
console.print()
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def render_plan(plan_state) -> None:
|
|
174
|
+
"""Render a plan with checkboxes."""
|
|
175
|
+
if not plan_state or not plan_state.steps:
|
|
176
|
+
return
|
|
177
|
+
|
|
178
|
+
console.print(plan_state.render())
|
|
179
|
+
console.print()
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def render_approval_prompt(tool_name: str, tool_args: dict, truncate: int = 60) -> str:
|
|
183
|
+
"""
|
|
184
|
+
Render an approval prompt for a tool call.
|
|
185
|
+
|
|
186
|
+
Returns the formatted string for display in the input box.
|
|
187
|
+
"""
|
|
188
|
+
# Format args as a compact string
|
|
189
|
+
args_str = ", ".join(f"{k}={repr(v)[:truncate]}" for k, v in tool_args.items())
|
|
190
|
+
if len(args_str) > 80:
|
|
191
|
+
args_str = args_str[:77] + "..."
|
|
192
|
+
|
|
193
|
+
return f"🔧 {tool_name}: {args_str}"
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def display_output(agent_name: str, message: str, output: str):
|
|
197
|
+
"""Display agent output with markdown rendering if applicable."""
|
|
198
|
+
console.print(f"\n[bold cyan]🤖 Agent: {agent_name}[/bold cyan]\n")
|
|
199
|
+
console.print(f"[bold]Message:[/bold] {message}\n")
|
|
200
|
+
console.print("[bold]Response:[/bold]")
|
|
201
|
+
|
|
202
|
+
# Ensure output is a string
|
|
203
|
+
if not isinstance(output, str):
|
|
204
|
+
output = str(output)
|
|
205
|
+
|
|
206
|
+
if any(marker in output for marker in ['```', '**', '##', '- ', '* ']):
|
|
207
|
+
console.print(Markdown(output))
|
|
208
|
+
else:
|
|
209
|
+
console.print(output)
|
|
210
|
+
console.print()
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def extract_output_from_result(result) -> str:
|
|
214
|
+
"""Extract output string from agent result (handles multiple formats)."""
|
|
215
|
+
if isinstance(result, dict):
|
|
216
|
+
# Try different keys that might contain the response
|
|
217
|
+
output = result.get('output')
|
|
218
|
+
if output is None and 'messages' in result:
|
|
219
|
+
# LangGraph format - get last message
|
|
220
|
+
messages = result['messages']
|
|
221
|
+
if messages and len(messages) > 0:
|
|
222
|
+
last_msg = messages[-1]
|
|
223
|
+
output = last_msg.content if hasattr(last_msg, 'content') else str(last_msg)
|
|
224
|
+
if output is None:
|
|
225
|
+
output = str(result)
|
|
226
|
+
else:
|
|
227
|
+
output = str(result)
|
|
228
|
+
return output
|