monkeybot-cli 0.2.1__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.
- monkeybot_cli/__init__.py +3 -0
- monkeybot_cli/chat_renderer.py +87 -0
- monkeybot_cli/chat_session.py +911 -0
- monkeybot_cli/chat_status_bar.py +205 -0
- monkeybot_cli/chat_theme.py +91 -0
- monkeybot_cli/chat_tool_display.py +334 -0
- monkeybot_cli/chat_tui.py +1491 -0
- monkeybot_cli/chat_tui_widgets.py +996 -0
- monkeybot_cli/commands/__init__.py +1 -0
- monkeybot_cli/commands/chat.py +817 -0
- monkeybot_cli/commands/doctor.py +293 -0
- monkeybot_cli/commands/loop.py +207 -0
- monkeybot_cli/commands/new.py +207 -0
- monkeybot_cli/commands/run_cmd.py +41 -0
- monkeybot_cli/commands/talk.py +102 -0
- monkeybot_cli/commands/validate.py +385 -0
- monkeybot_cli/compat.py +7 -0
- monkeybot_cli/config_resolve.py +55 -0
- monkeybot_cli/exit_commands.py +13 -0
- monkeybot_cli/extras_catalog.py +95 -0
- monkeybot_cli/gateway_health.py +34 -0
- monkeybot_cli/main.py +38 -0
- monkeybot_cli/opensandbox_lifecycle.py +314 -0
- monkeybot_cli/output.py +110 -0
- monkeybot_cli/providers.py +112 -0
- monkeybot_cli/realtime/__init__.py +13 -0
- monkeybot_cli/realtime/audio_io.py +147 -0
- monkeybot_cli/realtime/client.py +17 -0
- monkeybot_cli/realtime/gateway_manager.py +142 -0
- monkeybot_cli/realtime/push_to_talk.py +128 -0
- monkeybot_cli/realtime/session.py +256 -0
- monkeybot_cli/realtime/session_controller.py +501 -0
- monkeybot_cli/realtime/talk_ui.py +243 -0
- monkeybot_cli/realtime/wire_encode.py +39 -0
- monkeybot_cli/runtime_python.py +91 -0
- monkeybot_cli/scaffold.py +287 -0
- monkeybot_cli/scaffold_defaults/AGENT.md +56 -0
- monkeybot_cli/scaffold_defaults/__init__.py +1 -0
- monkeybot_cli/scaffold_defaults/command_allowlist.yaml +57 -0
- monkeybot_cli/scaffold_defaults/env.example +35 -0
- monkeybot_cli/scaffold_defaults/mcp.json +49 -0
- monkeybot_cli/scaffold_defaults/monkeybot.example.yaml +191 -0
- monkeybot_cli/scaffold_defaults/otel-collector.example.yaml +57 -0
- monkeybot_cli/scaffold_defaults/permissions.yaml +32 -0
- monkeybot_cli/scaffold_defaults/setup-workspace.sh +24 -0
- monkeybot_cli/session_controller.py +7 -0
- monkeybot_cli/terminal_markdown.py +48 -0
- monkeybot_cli-0.2.1.dist-info/METADATA +10 -0
- monkeybot_cli-0.2.1.dist-info/RECORD +51 -0
- monkeybot_cli-0.2.1.dist-info/WHEEL +4 -0
- monkeybot_cli-0.2.1.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"""Shared chat renderer contract and session controller protocol."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING, Any, Protocol, runtime_checkable
|
|
6
|
+
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from monkeybot_cli.chat_session import ChatUiEvent, HitlAnswer
|
|
9
|
+
from monkeybot_cli.chat_status_bar import UsageStore
|
|
10
|
+
|
|
11
|
+
# Every kind emitted by session controllers (and expected by renderers).
|
|
12
|
+
EVENT_KINDS: frozenset[str] = frozenset(
|
|
13
|
+
{
|
|
14
|
+
"usage_updated",
|
|
15
|
+
"session_ready",
|
|
16
|
+
"connection_state",
|
|
17
|
+
"transcript_backfill",
|
|
18
|
+
"thinking",
|
|
19
|
+
"thinking_clear",
|
|
20
|
+
"turn_started",
|
|
21
|
+
"assistant_start",
|
|
22
|
+
"assistant_delta",
|
|
23
|
+
"tool_started",
|
|
24
|
+
"tool_finished",
|
|
25
|
+
"summarizing",
|
|
26
|
+
"summarized",
|
|
27
|
+
"grounding",
|
|
28
|
+
"turn_error",
|
|
29
|
+
"turn_complete",
|
|
30
|
+
"turn_aborted",
|
|
31
|
+
"hitl_required",
|
|
32
|
+
"hitl_failed",
|
|
33
|
+
"hitl_frontend_unsupported",
|
|
34
|
+
"session_busy",
|
|
35
|
+
"error",
|
|
36
|
+
"stream_failed",
|
|
37
|
+
"stream_ended",
|
|
38
|
+
"thinking_trace",
|
|
39
|
+
"thinking_block_delta",
|
|
40
|
+
"thinking_block_complete",
|
|
41
|
+
"voice_state",
|
|
42
|
+
"audio_chunk",
|
|
43
|
+
"device_error",
|
|
44
|
+
"user_transcript",
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@runtime_checkable
|
|
50
|
+
class SessionController(Protocol):
|
|
51
|
+
"""Minimal surface the TUI / plain renderer need from a session backend."""
|
|
52
|
+
|
|
53
|
+
turn_based: bool
|
|
54
|
+
stream_alive: bool
|
|
55
|
+
stream_error: bool
|
|
56
|
+
reconnecting: bool
|
|
57
|
+
show_usage: bool
|
|
58
|
+
usage: UsageStore
|
|
59
|
+
session_id: str | None
|
|
60
|
+
|
|
61
|
+
async def connect(self, resume_session_id: str | None = None) -> None: ...
|
|
62
|
+
|
|
63
|
+
async def submit(self, message: str) -> None: ...
|
|
64
|
+
|
|
65
|
+
def abort_turn(self) -> None: ...
|
|
66
|
+
|
|
67
|
+
def provide_hitl_answer(self, answer: HitlAnswer) -> None: ...
|
|
68
|
+
|
|
69
|
+
def set_emit(self, emit: Any) -> None: ...
|
|
70
|
+
|
|
71
|
+
async def close(self) -> None: ...
|
|
72
|
+
|
|
73
|
+
async def restart_session(self) -> None: ...
|
|
74
|
+
|
|
75
|
+
async def resume_session(self, session_id: str) -> None: ...
|
|
76
|
+
|
|
77
|
+
async def refresh_usage(self) -> None: ...
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@runtime_checkable
|
|
81
|
+
class ChatRenderer(Protocol):
|
|
82
|
+
"""Sink for ``ChatUiEvent``s from a session controller."""
|
|
83
|
+
|
|
84
|
+
def on_event(self, event: ChatUiEvent, controller: SessionController) -> None: ...
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
__all__ = ["EVENT_KINDS", "ChatRenderer", "SessionController"]
|