connectonion 0.5.9__py3-none-any.whl → 0.6.0__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.
- connectonion/__init__.py +16 -16
- connectonion/cli/commands/copy_commands.py +24 -1
- connectonion/cli/commands/deploy_commands.py +15 -0
- connectonion/cli/commands/project_cmd_lib.py +1 -1
- connectonion/core/__init__.py +53 -0
- connectonion/{agent.py → core/agent.py} +5 -5
- connectonion/{tool_executor.py → core/tool_executor.py} +3 -2
- connectonion/{tool_factory.py → core/tool_factory.py} +3 -1
- connectonion/debug/__init__.py +51 -0
- connectonion/{interactive_debugger.py → debug/auto_debug.py} +7 -7
- connectonion/{auto_debug_exception.py → debug/auto_debug_exception.py} +3 -3
- connectonion/{debugger_ui.py → debug/auto_debug_ui.py} +1 -1
- connectonion/{debug_explainer → debug/debug_explainer}/explain_agent.py +1 -1
- connectonion/{debug_explainer → debug/debug_explainer}/explain_context.py +1 -1
- connectonion/{execution_analyzer → debug/execution_analyzer}/execution_analysis.py +1 -1
- connectonion/debug/runtime_inspector/__init__.py +13 -0
- connectonion/{debug_agent → debug/runtime_inspector}/agent.py +1 -1
- connectonion/{xray.py → debug/xray.py} +1 -1
- connectonion/llm_do.py +1 -1
- connectonion/network/__init__.py +34 -0
- connectonion/{announce.py → network/announce.py} +1 -1
- connectonion/{connect.py → network/connect.py} +1 -1
- connectonion/{host.py → network/host.py} +47 -17
- connectonion/{trust.py → network/trust.py} +1 -1
- connectonion/tui/__init__.py +22 -0
- connectonion/tui/chat.py +647 -0
- connectonion/useful_events_handlers/reflect.py +2 -2
- connectonion/useful_plugins/calendar_plugin.py +2 -2
- connectonion/useful_plugins/eval.py +2 -2
- connectonion/useful_plugins/gmail_plugin.py +2 -2
- connectonion/useful_plugins/image_result_formatter.py +2 -2
- connectonion/useful_plugins/re_act.py +2 -2
- connectonion/useful_plugins/shell_approval.py +2 -2
- {connectonion-0.5.9.dist-info → connectonion-0.6.0.dist-info}/METADATA +4 -3
- {connectonion-0.5.9.dist-info → connectonion-0.6.0.dist-info}/RECORD +53 -49
- connectonion/debug_agent/__init__.py +0 -13
- /connectonion/{events.py → core/events.py} +0 -0
- /connectonion/{llm.py → core/llm.py} +0 -0
- /connectonion/{tool_registry.py → core/tool_registry.py} +0 -0
- /connectonion/{usage.py → core/usage.py} +0 -0
- /connectonion/{debug_explainer → debug/debug_explainer}/__init__.py +0 -0
- /connectonion/{debug_explainer → debug/debug_explainer}/explainer_prompt.md +0 -0
- /connectonion/{debug_explainer → debug/debug_explainer}/root_cause_analysis_prompt.md +0 -0
- /connectonion/{decorators.py → debug/decorators.py} +0 -0
- /connectonion/{execution_analyzer → debug/execution_analyzer}/__init__.py +0 -0
- /connectonion/{execution_analyzer → debug/execution_analyzer}/execution_analysis_prompt.md +0 -0
- /connectonion/{debug_agent → debug/runtime_inspector}/prompts/debug_assistant.md +0 -0
- /connectonion/{debug_agent → debug/runtime_inspector}/runtime_inspector.py +0 -0
- /connectonion/{asgi.py → network/asgi.py} +0 -0
- /connectonion/{relay.py → network/relay.py} +0 -0
- /connectonion/{trust_agents.py → network/trust_agents.py} +0 -0
- /connectonion/{trust_functions.py → network/trust_functions.py} +0 -0
- {connectonion-0.5.9.dist-info → connectonion-0.6.0.dist-info}/WHEEL +0 -0
- {connectonion-0.5.9.dist-info → connectonion-0.6.0.dist-info}/entry_points.txt +0 -0
connectonion/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""ConnectOnion - A simple agent framework with behavior tracking."""
|
|
2
2
|
|
|
3
|
-
__version__ = "0.
|
|
3
|
+
__version__ = "0.6.0"
|
|
4
4
|
|
|
5
5
|
# Auto-load .env files for the entire framework
|
|
6
6
|
from dotenv import load_dotenv
|
|
@@ -10,20 +10,8 @@ from pathlib import Path as _Path
|
|
|
10
10
|
# NOT from the module's location (framework directory)
|
|
11
11
|
load_dotenv(_Path.cwd() / ".env")
|
|
12
12
|
|
|
13
|
-
from .
|
|
14
|
-
from .
|
|
15
|
-
from .llm import LLM
|
|
16
|
-
from .logger import Logger
|
|
17
|
-
from .llm_do import llm_do
|
|
18
|
-
from .transcribe import transcribe
|
|
19
|
-
from .prompts import load_system_prompt
|
|
20
|
-
from .xray import xray
|
|
21
|
-
from .decorators import replay, xray_replay
|
|
22
|
-
from .useful_tools import send_email, get_emails, mark_read, mark_unread, Memory, Gmail, GoogleCalendar, Outlook, MicrosoftCalendar, WebFetch, Shell, DiffWriter, pick, yes_no, autocomplete, TodoList, SlashCommand
|
|
23
|
-
from .auto_debug_exception import auto_debug_exception
|
|
24
|
-
from .connect import connect, RemoteAgent
|
|
25
|
-
from .host import host, create_app
|
|
26
|
-
from .events import (
|
|
13
|
+
from .core import Agent, LLM, create_tool_from_function
|
|
14
|
+
from .core import (
|
|
27
15
|
after_user_input,
|
|
28
16
|
before_llm,
|
|
29
17
|
after_llm,
|
|
@@ -32,8 +20,17 @@ from .events import (
|
|
|
32
20
|
after_each_tool,
|
|
33
21
|
after_tools,
|
|
34
22
|
on_error,
|
|
35
|
-
on_complete
|
|
23
|
+
on_complete,
|
|
36
24
|
)
|
|
25
|
+
from .logger import Logger
|
|
26
|
+
from .llm_do import llm_do
|
|
27
|
+
from .transcribe import transcribe
|
|
28
|
+
from .prompts import load_system_prompt
|
|
29
|
+
from .debug import xray, auto_debug_exception, replay, xray_replay
|
|
30
|
+
from .useful_tools import send_email, get_emails, mark_read, mark_unread, Memory, Gmail, GoogleCalendar, Outlook, MicrosoftCalendar, WebFetch, Shell, DiffWriter, pick, yes_no, autocomplete, TodoList, SlashCommand
|
|
31
|
+
from .network import connect, RemoteAgent, host, create_app
|
|
32
|
+
from .network import relay, announce
|
|
33
|
+
from . import address
|
|
37
34
|
|
|
38
35
|
__all__ = [
|
|
39
36
|
"Agent",
|
|
@@ -68,6 +65,9 @@ __all__ = [
|
|
|
68
65
|
"RemoteAgent",
|
|
69
66
|
"host",
|
|
70
67
|
"create_app",
|
|
68
|
+
"relay",
|
|
69
|
+
"announce",
|
|
70
|
+
"address",
|
|
71
71
|
"after_user_input",
|
|
72
72
|
"before_llm",
|
|
73
73
|
"after_llm",
|
|
@@ -39,6 +39,18 @@ PLUGINS = {
|
|
|
39
39
|
"calendar_plugin": "calendar_plugin.py",
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
# Registry of copyable TUI components
|
|
43
|
+
TUI = {
|
|
44
|
+
"chat": "chat.py",
|
|
45
|
+
"fuzzy": "fuzzy.py",
|
|
46
|
+
"divider": "divider.py",
|
|
47
|
+
"footer": "footer.py",
|
|
48
|
+
"status_bar": "status_bar.py",
|
|
49
|
+
"dropdown": "dropdown.py",
|
|
50
|
+
"pick": "pick.py",
|
|
51
|
+
"keys": "keys.py",
|
|
52
|
+
}
|
|
53
|
+
|
|
42
54
|
|
|
43
55
|
def handle_copy(
|
|
44
56
|
names: List[str],
|
|
@@ -56,9 +68,11 @@ def handle_copy(
|
|
|
56
68
|
# Get source directories using import system (works for installed packages)
|
|
57
69
|
import connectonion.useful_tools as tools_module
|
|
58
70
|
import connectonion.useful_plugins as plugins_module
|
|
71
|
+
import connectonion.tui as tui_module
|
|
59
72
|
|
|
60
73
|
useful_tools_dir = Path(tools_module.__file__).parent
|
|
61
74
|
useful_plugins_dir = Path(plugins_module.__file__).parent
|
|
75
|
+
tui_dir = Path(tui_module.__file__).parent
|
|
62
76
|
|
|
63
77
|
current_dir = Path.cwd()
|
|
64
78
|
|
|
@@ -77,6 +91,12 @@ def handle_copy(
|
|
|
77
91
|
dest_dir = Path(path) if path else current_dir / "plugins"
|
|
78
92
|
copy_file(source, dest_dir, force)
|
|
79
93
|
|
|
94
|
+
# Check if it's a TUI component
|
|
95
|
+
elif name_lower in TUI:
|
|
96
|
+
source = tui_dir / TUI[name_lower]
|
|
97
|
+
dest_dir = Path(path) if path else current_dir / "tui"
|
|
98
|
+
copy_file(source, dest_dir, force)
|
|
99
|
+
|
|
80
100
|
else:
|
|
81
101
|
console.print(f"[red]Unknown: {name}[/red]")
|
|
82
102
|
console.print("Use [cyan]co copy --list[/cyan] to see available items")
|
|
@@ -100,7 +120,7 @@ def copy_file(source: Path, dest_dir: Path, force: bool):
|
|
|
100
120
|
|
|
101
121
|
|
|
102
122
|
def show_available_items():
|
|
103
|
-
"""Display available tools and
|
|
123
|
+
"""Display available tools, plugins, and TUI components."""
|
|
104
124
|
table = Table(title="Available Items to Copy")
|
|
105
125
|
table.add_column("Name", style="cyan")
|
|
106
126
|
table.add_column("Type", style="green")
|
|
@@ -112,5 +132,8 @@ def show_available_items():
|
|
|
112
132
|
for name, file in sorted(PLUGINS.items()):
|
|
113
133
|
table.add_row(name, "plugin", file)
|
|
114
134
|
|
|
135
|
+
for name, file in sorted(TUI.items()):
|
|
136
|
+
table.add_row(name, "tui", file)
|
|
137
|
+
|
|
115
138
|
console.print(table)
|
|
116
139
|
console.print("\n[dim]Usage: co copy <name> [--path ./custom/][/dim]")
|
|
@@ -217,4 +217,19 @@ def handle_deploy():
|
|
|
217
217
|
# Always show URL if we have one
|
|
218
218
|
if url:
|
|
219
219
|
console.print(f"Agent URL: {url}")
|
|
220
|
+
|
|
221
|
+
# Always fetch and display container logs
|
|
222
|
+
if deployment_id:
|
|
223
|
+
logs_resp = requests.get(
|
|
224
|
+
f"{API_BASE}/api/v1/deploy/{deployment_id}/logs?tail=20",
|
|
225
|
+
headers={"Authorization": f"Bearer {api_key}"},
|
|
226
|
+
timeout=10,
|
|
227
|
+
)
|
|
228
|
+
if logs_resp.status_code == 200:
|
|
229
|
+
logs = logs_resp.json().get("logs", "")
|
|
230
|
+
if logs:
|
|
231
|
+
console.print()
|
|
232
|
+
console.print("[dim]Container logs:[/dim]")
|
|
233
|
+
console.print(f"[dim]{logs}[/dim]")
|
|
234
|
+
|
|
220
235
|
console.print()
|
|
@@ -622,7 +622,7 @@ def generate_custom_template_with_name(description: str, api_key: str, model: st
|
|
|
622
622
|
# Try to use AI to generate name and code
|
|
623
623
|
if model or api_key:
|
|
624
624
|
try:
|
|
625
|
-
from ...llm import create_llm
|
|
625
|
+
from ...core.llm import create_llm
|
|
626
626
|
|
|
627
627
|
# Use the model specified or default to co/gemini-2.5-pro
|
|
628
628
|
llm_model = model if model else "co/gemini-2.5-pro"
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""Core agent execution engine.
|
|
2
|
+
|
|
3
|
+
This module contains the minimal set of components needed to run an agent:
|
|
4
|
+
- Agent: Main orchestrator
|
|
5
|
+
- LLM: Multi-provider LLM abstraction
|
|
6
|
+
- Events: Event system for lifecycle hooks
|
|
7
|
+
- Tools: Tool execution, factory, and registry
|
|
8
|
+
- Usage: Token tracking and cost calculation
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from .agent import Agent
|
|
12
|
+
from .llm import LLM, create_llm, TokenUsage
|
|
13
|
+
from .events import (
|
|
14
|
+
EventHandler,
|
|
15
|
+
after_user_input,
|
|
16
|
+
before_llm,
|
|
17
|
+
after_llm,
|
|
18
|
+
before_each_tool,
|
|
19
|
+
before_tools,
|
|
20
|
+
after_each_tool,
|
|
21
|
+
after_tools,
|
|
22
|
+
on_error,
|
|
23
|
+
on_complete,
|
|
24
|
+
)
|
|
25
|
+
from .tool_factory import create_tool_from_function, extract_methods_from_instance, is_class_instance
|
|
26
|
+
from .tool_registry import ToolRegistry
|
|
27
|
+
from .tool_executor import execute_and_record_tools, execute_single_tool
|
|
28
|
+
from .usage import TokenUsage, calculate_cost, get_context_limit
|
|
29
|
+
|
|
30
|
+
__all__ = [
|
|
31
|
+
"Agent",
|
|
32
|
+
"LLM",
|
|
33
|
+
"create_llm",
|
|
34
|
+
"TokenUsage",
|
|
35
|
+
"EventHandler",
|
|
36
|
+
"after_user_input",
|
|
37
|
+
"before_llm",
|
|
38
|
+
"after_llm",
|
|
39
|
+
"before_each_tool",
|
|
40
|
+
"before_tools",
|
|
41
|
+
"after_each_tool",
|
|
42
|
+
"after_tools",
|
|
43
|
+
"on_error",
|
|
44
|
+
"on_complete",
|
|
45
|
+
"create_tool_from_function",
|
|
46
|
+
"extract_methods_from_instance",
|
|
47
|
+
"is_class_instance",
|
|
48
|
+
"ToolRegistry",
|
|
49
|
+
"execute_and_record_tools",
|
|
50
|
+
"execute_single_tool",
|
|
51
|
+
"calculate_cost",
|
|
52
|
+
"get_context_limit",
|
|
53
|
+
]
|
|
@@ -18,11 +18,11 @@ from .llm import LLM, create_llm, TokenUsage
|
|
|
18
18
|
from .usage import get_context_limit
|
|
19
19
|
from .tool_factory import create_tool_from_function, extract_methods_from_instance, is_class_instance
|
|
20
20
|
from .tool_registry import ToolRegistry
|
|
21
|
-
from
|
|
22
|
-
from .decorators import (
|
|
21
|
+
from ..prompts import load_system_prompt
|
|
22
|
+
from ..debug.decorators import (
|
|
23
23
|
_is_replay_enabled # Only need this for replay check
|
|
24
24
|
)
|
|
25
|
-
from
|
|
25
|
+
from ..logger import Logger
|
|
26
26
|
from .tool_executor import execute_and_record_tools, execute_single_tool
|
|
27
27
|
from .events import EventHandler
|
|
28
28
|
|
|
@@ -444,7 +444,7 @@ class Agent:
|
|
|
444
444
|
# Single prompt mode
|
|
445
445
|
agent.auto_debug("Find information about Python")
|
|
446
446
|
"""
|
|
447
|
-
from .
|
|
448
|
-
debugger =
|
|
447
|
+
from .debug import AutoDebugger
|
|
448
|
+
debugger = AutoDebugger(self)
|
|
449
449
|
debugger.start_debug_session(prompt)
|
|
450
450
|
|
|
@@ -13,7 +13,7 @@ import time
|
|
|
13
13
|
import json
|
|
14
14
|
from typing import List, Dict, Any, Optional, Callable
|
|
15
15
|
|
|
16
|
-
from .xray import (
|
|
16
|
+
from ..debug.xray import (
|
|
17
17
|
inject_xray_context,
|
|
18
18
|
clear_xray_context,
|
|
19
19
|
is_xray_enabled
|
|
@@ -165,7 +165,8 @@ def execute_single_tool(
|
|
|
165
165
|
agent.current_session['pending_tool'] = {
|
|
166
166
|
'name': tool_name,
|
|
167
167
|
'arguments': tool_args,
|
|
168
|
-
'id': tool_id
|
|
168
|
+
'id': tool_id,
|
|
169
|
+
'description': getattr(tool_func, 'description', '')
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
# Invoke before_each_tool events
|
|
@@ -29,7 +29,9 @@ def create_tool_from_function(func: Callable) -> Callable:
|
|
|
29
29
|
by inspecting its signature and docstring.
|
|
30
30
|
"""
|
|
31
31
|
name = func.__name__
|
|
32
|
-
|
|
32
|
+
raw_doc = inspect.getdoc(func)
|
|
33
|
+
# Extract summary only (first paragraph) - Args/Returns sections are not sent to LLM
|
|
34
|
+
description = raw_doc.split('\n\n')[0].strip() if raw_doc else f"Execute the {name} tool."
|
|
33
35
|
|
|
34
36
|
# Build the parameters schema from the function signature
|
|
35
37
|
sig = inspect.signature(func)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""Debug tools for agent development and troubleshooting.
|
|
2
|
+
|
|
3
|
+
This module contains:
|
|
4
|
+
- xray: Runtime context injection for tool inspection
|
|
5
|
+
- decorators: replay, xray_replay for debugging
|
|
6
|
+
- auto_debug: Interactive debugging with breakpoints (AutoDebugger, AutoDebugUI)
|
|
7
|
+
- auto_debug_exception: Exception handling and debugging
|
|
8
|
+
- runtime_inspector: AI-powered runtime state inspection for crash debugging
|
|
9
|
+
- debug_explainer: AI-powered explanation of tool choices
|
|
10
|
+
|
|
11
|
+
Note: Uses lazy imports to avoid circular dependency with agent.py
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
# xray and decorators can be imported eagerly (no circular dependency)
|
|
15
|
+
from .xray import xray
|
|
16
|
+
from .decorators import replay, xray_replay
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"xray",
|
|
20
|
+
"replay",
|
|
21
|
+
"xray_replay",
|
|
22
|
+
"AutoDebugger",
|
|
23
|
+
"AutoDebugUI",
|
|
24
|
+
"BreakpointContext",
|
|
25
|
+
"BreakpointAction",
|
|
26
|
+
"auto_debug_exception",
|
|
27
|
+
"create_debug_agent",
|
|
28
|
+
"RuntimeInspector",
|
|
29
|
+
"explain_tool_choice",
|
|
30
|
+
"RuntimeContext",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def __getattr__(name):
|
|
35
|
+
"""Lazy import to avoid circular dependency with agent.py."""
|
|
36
|
+
if name == "AutoDebugger":
|
|
37
|
+
from .auto_debug import AutoDebugger
|
|
38
|
+
return AutoDebugger
|
|
39
|
+
elif name in ("AutoDebugUI", "BreakpointContext", "BreakpointAction"):
|
|
40
|
+
from .auto_debug_ui import AutoDebugUI, BreakpointContext, BreakpointAction
|
|
41
|
+
return {"AutoDebugUI": AutoDebugUI, "BreakpointContext": BreakpointContext, "BreakpointAction": BreakpointAction}[name]
|
|
42
|
+
elif name == "auto_debug_exception":
|
|
43
|
+
from .auto_debug_exception import auto_debug_exception
|
|
44
|
+
return auto_debug_exception
|
|
45
|
+
elif name in ("create_debug_agent", "RuntimeInspector"):
|
|
46
|
+
from .runtime_inspector import create_debug_agent, RuntimeInspector
|
|
47
|
+
return {"create_debug_agent": create_debug_agent, "RuntimeInspector": RuntimeInspector}[name]
|
|
48
|
+
elif name in ("explain_tool_choice", "RuntimeContext"):
|
|
49
|
+
from .debug_explainer import explain_tool_choice, RuntimeContext
|
|
50
|
+
return {"explain_tool_choice": explain_tool_choice, "RuntimeContext": RuntimeContext}[name]
|
|
51
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
@@ -13,25 +13,25 @@ LLM-Note:
|
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
15
|
from typing import Any, Dict, Optional, List
|
|
16
|
-
from .
|
|
16
|
+
from .auto_debug_ui import AutoDebugUI, BreakpointContext, BreakpointAction
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
class
|
|
19
|
+
class AutoDebugger:
|
|
20
20
|
"""Orchestrates debugging sessions for AI agents.
|
|
21
21
|
|
|
22
22
|
This class handles the debugging logic and intercepts tool execution,
|
|
23
23
|
delegating all UI interactions to the DebuggerUI class.
|
|
24
24
|
"""
|
|
25
25
|
|
|
26
|
-
def __init__(self, agent: Any, ui: Optional[
|
|
26
|
+
def __init__(self, agent: Any, ui: Optional[AutoDebugUI] = None):
|
|
27
27
|
"""Initialize debugger with an agent instance and optional UI.
|
|
28
28
|
|
|
29
29
|
Args:
|
|
30
30
|
agent: The Agent instance to debug
|
|
31
|
-
ui: Optional
|
|
31
|
+
ui: Optional AutoDebugUI instance (creates default if None)
|
|
32
32
|
"""
|
|
33
33
|
self.agent = agent
|
|
34
|
-
self.ui = ui or
|
|
34
|
+
self.ui = ui or AutoDebugUI()
|
|
35
35
|
self.original_execute_single_tool = None
|
|
36
36
|
|
|
37
37
|
def start_debug_session(self, prompt: Optional[str] = None):
|
|
@@ -99,7 +99,7 @@ class InteractiveDebugger:
|
|
|
99
99
|
- Pause execution and show UI if breakpoint conditions are met
|
|
100
100
|
- Only affect this specific agent instance
|
|
101
101
|
"""
|
|
102
|
-
from
|
|
102
|
+
from ..core import tool_executor
|
|
103
103
|
from .xray import is_xray_enabled
|
|
104
104
|
|
|
105
105
|
# Store original function for restoration later
|
|
@@ -141,7 +141,7 @@ class InteractiveDebugger:
|
|
|
141
141
|
tool execution function.
|
|
142
142
|
"""
|
|
143
143
|
if self.original_execute_single_tool:
|
|
144
|
-
from
|
|
144
|
+
from ..core import tool_executor
|
|
145
145
|
tool_executor.execute_single_tool = self.original_execute_single_tool
|
|
146
146
|
|
|
147
147
|
def _show_breakpoint_ui_and_wait_for_continue(self, tool_name: str, tool_args: Dict, trace_entry: Dict):
|
|
@@ -57,7 +57,7 @@ def auto_debug_exception(model: str = "o4-mini"):
|
|
|
57
57
|
original_hook(exc_type, exc_value, exception_traceback)
|
|
58
58
|
|
|
59
59
|
# Then add our AI analysis
|
|
60
|
-
from
|
|
60
|
+
from ..console import Console
|
|
61
61
|
console = Console()
|
|
62
62
|
|
|
63
63
|
# Find the most relevant frame (last user code, not library)
|
|
@@ -125,7 +125,7 @@ def auto_debug_exception(model: str = "o4-mini"):
|
|
|
125
125
|
|
|
126
126
|
try:
|
|
127
127
|
# Use debug agent with runtime inspection tools
|
|
128
|
-
from .
|
|
128
|
+
from .runtime_inspector import create_debug_agent
|
|
129
129
|
|
|
130
130
|
# Pass the actual frame and traceback for runtime inspection!
|
|
131
131
|
agent = create_debug_agent(
|
|
@@ -176,6 +176,6 @@ You have LIVE ACCESS to the crashed program's state! Use your tools to investiga
|
|
|
176
176
|
sys.excepthook = handle_exception
|
|
177
177
|
|
|
178
178
|
# Simple confirmation
|
|
179
|
-
from
|
|
179
|
+
from ..console import Console
|
|
180
180
|
console = Console()
|
|
181
181
|
console.print(f"[green]✅ Exception debugging enabled[/green] - AI will analyze uncaught exceptions with runtime inspection")
|
|
@@ -16,7 +16,7 @@ Analyzes the entire execution trace and provides suggestions for improvement.
|
|
|
16
16
|
from pathlib import Path
|
|
17
17
|
from pydantic import BaseModel
|
|
18
18
|
from typing import List
|
|
19
|
-
from
|
|
19
|
+
from ...llm_do import llm_do
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
class ExecutionAnalysis(BaseModel):
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Runtime inspector for AI-powered crash debugging.
|
|
2
|
+
|
|
3
|
+
Provides RuntimeInspector class and factory function to create debug agents
|
|
4
|
+
that can experiment, test, and validate fixes using actual crashed program data.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .agent import create_debug_agent
|
|
8
|
+
from .runtime_inspector import RuntimeInspector
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"create_debug_agent",
|
|
12
|
+
"RuntimeInspector"
|
|
13
|
+
]
|
|
@@ -14,7 +14,7 @@ This module provides the @xray decorator and xray context for debugging AI agent
|
|
|
14
14
|
See everything your agent is thinking during tool execution.
|
|
15
15
|
|
|
16
16
|
Usage:
|
|
17
|
-
from connectonion
|
|
17
|
+
from connectonion import xray # or: from connectonion.debug import xray
|
|
18
18
|
|
|
19
19
|
@xray
|
|
20
20
|
def my_tool(query: str):
|
connectonion/llm_do.py
CHANGED
|
@@ -222,7 +222,7 @@ from typing import Union, Type, Optional, TypeVar
|
|
|
222
222
|
from pathlib import Path
|
|
223
223
|
from pydantic import BaseModel
|
|
224
224
|
from .prompts import load_system_prompt
|
|
225
|
-
from .llm import create_llm
|
|
225
|
+
from .core.llm import create_llm
|
|
226
226
|
|
|
227
227
|
T = TypeVar('T', bound=BaseModel)
|
|
228
228
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Network layer for hosting and connecting agents.
|
|
2
|
+
|
|
3
|
+
This module contains:
|
|
4
|
+
- host: Host an agent over HTTP/WebSocket
|
|
5
|
+
- asgi: ASGI app implementation
|
|
6
|
+
- relay: Agent relay server for P2P discovery
|
|
7
|
+
- connect: Multi-agent networking (RemoteAgent)
|
|
8
|
+
- announce: Service announcement protocol
|
|
9
|
+
- trust: Trust verification system
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from .host import host, create_app, SessionStorage, Session
|
|
13
|
+
from .connect import connect, RemoteAgent
|
|
14
|
+
from .relay import connect as relay_connect, serve_loop
|
|
15
|
+
from .announce import create_announce_message
|
|
16
|
+
from .trust import create_trust_agent, get_default_trust_level, TRUST_LEVELS
|
|
17
|
+
from . import relay, announce
|
|
18
|
+
|
|
19
|
+
__all__ = [
|
|
20
|
+
"host",
|
|
21
|
+
"create_app",
|
|
22
|
+
"SessionStorage",
|
|
23
|
+
"Session",
|
|
24
|
+
"connect",
|
|
25
|
+
"RemoteAgent",
|
|
26
|
+
"relay_connect",
|
|
27
|
+
"serve_loop",
|
|
28
|
+
"create_announce_message",
|
|
29
|
+
"create_trust_agent",
|
|
30
|
+
"get_default_trust_level",
|
|
31
|
+
"TRUST_LEVELS",
|
|
32
|
+
"relay",
|
|
33
|
+
"announce",
|
|
34
|
+
]
|
|
@@ -72,7 +72,7 @@ def create_announce_message(
|
|
|
72
72
|
message_bytes = message_json.encode('utf-8')
|
|
73
73
|
|
|
74
74
|
# Sign with Ed25519
|
|
75
|
-
from
|
|
75
|
+
from .. import address
|
|
76
76
|
signature_bytes = address.sign(address_data, message_bytes)
|
|
77
77
|
|
|
78
78
|
# Convert to hex string (NO 0x prefix - matches auth system convention)
|