indent 0.1.8__py3-none-any.whl → 0.1.9__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 indent might be problematic. Click here for more details.
- exponent/__init__.py +21 -1
- exponent/cli.py +8 -10
- exponent/commands/config_commands.py +10 -10
- exponent/commands/run_commands.py +1 -1
- exponent/commands/upgrade.py +3 -3
- exponent/commands/utils.py +0 -90
- exponent/commands/workflow_commands.py +1 -1
- exponent/core/config.py +2 -0
- exponent/core/remote_execution/client.py +57 -1
- {indent-0.1.8.dist-info → indent-0.1.9.dist-info}/METADATA +1 -1
- {indent-0.1.8.dist-info → indent-0.1.9.dist-info}/RECORD +13 -17
- exponent/commands/github_app_commands.py +0 -211
- exponent/commands/listen_commands.py +0 -96
- exponent/commands/shell_commands.py +0 -2840
- exponent/commands/theme.py +0 -246
- {indent-0.1.8.dist-info → indent-0.1.9.dist-info}/WHEEL +0 -0
- {indent-0.1.8.dist-info → indent-0.1.9.dist-info}/entry_points.txt +0 -0
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
|
|
3
|
-
import click
|
|
4
|
-
from websockets.exceptions import ConnectionClosed
|
|
5
|
-
|
|
6
|
-
from exponent.commands.settings import use_settings
|
|
7
|
-
from exponent.commands.shell_commands import LiveView
|
|
8
|
-
from exponent.commands.theme import get_theme
|
|
9
|
-
from exponent.commands.types import exponent_cli_group
|
|
10
|
-
from exponent.core.config import Settings
|
|
11
|
-
from exponent.core.graphql.client import GraphQLClient
|
|
12
|
-
from exponent.core.graphql.subscriptions import INDENT_CHAT_EVENT_STREAM_SUBSCRIPTION
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@exponent_cli_group(hidden=True)
|
|
16
|
-
def listen_cli() -> None:
|
|
17
|
-
pass
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@listen_cli.command()
|
|
21
|
-
@click.option("--chat-id", help="ID of the chat to listen to", required=True)
|
|
22
|
-
@click.option(
|
|
23
|
-
"--known-event-uuids",
|
|
24
|
-
help="Comma-separated list of known event UUIDs to skip",
|
|
25
|
-
default="",
|
|
26
|
-
)
|
|
27
|
-
@use_settings
|
|
28
|
-
def listen(settings: Settings, chat_id: str, known_event_uuids: str) -> None:
|
|
29
|
-
"""Listen to events from an indent chat session."""
|
|
30
|
-
api_key = settings.api_key
|
|
31
|
-
if not api_key:
|
|
32
|
-
raise click.UsageError("API key is not set")
|
|
33
|
-
|
|
34
|
-
base_api_url = settings.get_base_api_url()
|
|
35
|
-
base_ws_url = settings.get_base_ws_url()
|
|
36
|
-
|
|
37
|
-
gql_client = GraphQLClient(api_key, base_api_url, base_ws_url)
|
|
38
|
-
|
|
39
|
-
# Parse known event UUIDs
|
|
40
|
-
known_uuids = []
|
|
41
|
-
if known_event_uuids:
|
|
42
|
-
known_uuids = [
|
|
43
|
-
uuid.strip() for uuid in known_event_uuids.split(",") if uuid.strip()
|
|
44
|
-
]
|
|
45
|
-
|
|
46
|
-
# Set up the live view with theme
|
|
47
|
-
theme = get_theme(settings.options.use_default_colors)
|
|
48
|
-
live_view = LiveView(theme, render_user_messages=True)
|
|
49
|
-
|
|
50
|
-
asyncio.run(_listen(gql_client, chat_id, known_uuids, live_view))
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
async def _listen(
|
|
54
|
-
gql_client: GraphQLClient,
|
|
55
|
-
chat_id: str,
|
|
56
|
-
known_event_uuids: list[str],
|
|
57
|
-
live_view: LiveView,
|
|
58
|
-
) -> None:
|
|
59
|
-
"""Internal listen function that handles the WebSocket subscription."""
|
|
60
|
-
while True:
|
|
61
|
-
try:
|
|
62
|
-
variables = {
|
|
63
|
-
"chatUuid": chat_id,
|
|
64
|
-
"lastKnownFullEventUuid": known_event_uuids[-1]
|
|
65
|
-
if known_event_uuids
|
|
66
|
-
else None,
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
async for response in gql_client.subscribe(
|
|
70
|
-
INDENT_CHAT_EVENT_STREAM_SUBSCRIPTION, variables
|
|
71
|
-
):
|
|
72
|
-
event = response["indentChatEventStream"]
|
|
73
|
-
kind = event["__typename"]
|
|
74
|
-
|
|
75
|
-
# Handle different event types
|
|
76
|
-
if kind in ["UserEvent", "AssistantEvent", "SystemEvent"]:
|
|
77
|
-
live_view.render_event(kind, event)
|
|
78
|
-
elif kind == "Error":
|
|
79
|
-
print(f"Error: {event.get('message', 'Unknown error')}")
|
|
80
|
-
elif kind == "UnauthenticatedError":
|
|
81
|
-
print(
|
|
82
|
-
f"Authentication error: {event.get('message', 'Unauthenticated')}"
|
|
83
|
-
)
|
|
84
|
-
break
|
|
85
|
-
else:
|
|
86
|
-
print(f"Unknown event type: {kind}")
|
|
87
|
-
|
|
88
|
-
except ConnectionClosed:
|
|
89
|
-
print("WebSocket disconnected, reconnecting...")
|
|
90
|
-
await asyncio.sleep(1)
|
|
91
|
-
except KeyboardInterrupt:
|
|
92
|
-
print("\nDisconnecting...")
|
|
93
|
-
break
|
|
94
|
-
except Exception as e:
|
|
95
|
-
print(f"Error: {e}")
|
|
96
|
-
await asyncio.sleep(1)
|