emdash-cli 0.1.4__py3-none-any.whl → 0.1.25__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.
- emdash_cli/__init__.py +6 -1
- emdash_cli/client.py +32 -18
- emdash_cli/commands/__init__.py +2 -0
- emdash_cli/commands/agent.py +171 -222
- emdash_cli/commands/index.py +76 -8
- emdash_cli/commands/skills.py +337 -0
- emdash_cli/keyboard.py +146 -0
- emdash_cli/main.py +5 -1
- emdash_cli/sse_renderer.py +265 -49
- {emdash_cli-0.1.4.dist-info → emdash_cli-0.1.25.dist-info}/METADATA +2 -2
- {emdash_cli-0.1.4.dist-info → emdash_cli-0.1.25.dist-info}/RECORD +13 -11
- {emdash_cli-0.1.4.dist-info → emdash_cli-0.1.25.dist-info}/WHEEL +0 -0
- {emdash_cli-0.1.4.dist-info → emdash_cli-0.1.25.dist-info}/entry_points.txt +0 -0
emdash_cli/__init__.py
CHANGED
emdash_cli/client.py
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"""HTTP client for emdash-core API."""
|
|
2
2
|
|
|
3
|
+
import os
|
|
3
4
|
from typing import Any, Iterator, Optional
|
|
4
5
|
|
|
5
6
|
import httpx
|
|
6
7
|
|
|
7
8
|
|
|
9
|
+
def _get_max_iterations() -> int:
|
|
10
|
+
"""Get max iterations from env var with default."""
|
|
11
|
+
return int(os.getenv("EMDASH_MAX_ITERATIONS", "100"))
|
|
12
|
+
|
|
13
|
+
|
|
8
14
|
class EmdashClient:
|
|
9
15
|
"""HTTP client for interacting with emdash-core API.
|
|
10
16
|
|
|
@@ -44,7 +50,7 @@ class EmdashClient:
|
|
|
44
50
|
message: str,
|
|
45
51
|
model: Optional[str] = None,
|
|
46
52
|
session_id: Optional[str] = None,
|
|
47
|
-
max_iterations: int =
|
|
53
|
+
max_iterations: int = _get_max_iterations(),
|
|
48
54
|
options: Optional[dict] = None,
|
|
49
55
|
) -> Iterator[str]:
|
|
50
56
|
"""Stream agent chat response via SSE.
|
|
@@ -82,14 +88,18 @@ class EmdashClient:
|
|
|
82
88
|
if session_id:
|
|
83
89
|
payload["session_id"] = session_id
|
|
84
90
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
response
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
try:
|
|
92
|
+
with self._client.stream(
|
|
93
|
+
"POST",
|
|
94
|
+
f"{self.base_url}/api/agent/chat",
|
|
95
|
+
json=payload,
|
|
96
|
+
) as response:
|
|
97
|
+
response.raise_for_status()
|
|
98
|
+
for line in response.iter_lines():
|
|
99
|
+
yield line
|
|
100
|
+
except GeneratorExit:
|
|
101
|
+
# Stream was closed early (interrupted)
|
|
102
|
+
pass
|
|
93
103
|
|
|
94
104
|
def agent_continue_stream(
|
|
95
105
|
self,
|
|
@@ -107,14 +117,18 @@ class EmdashClient:
|
|
|
107
117
|
"""
|
|
108
118
|
payload = {"message": message}
|
|
109
119
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
response
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
try:
|
|
121
|
+
with self._client.stream(
|
|
122
|
+
"POST",
|
|
123
|
+
f"{self.base_url}/api/agent/chat/{session_id}/continue",
|
|
124
|
+
json=payload,
|
|
125
|
+
) as response:
|
|
126
|
+
response.raise_for_status()
|
|
127
|
+
for line in response.iter_lines():
|
|
128
|
+
yield line
|
|
129
|
+
except GeneratorExit:
|
|
130
|
+
# Stream was closed early (interrupted)
|
|
131
|
+
pass
|
|
118
132
|
|
|
119
133
|
def list_sessions(self) -> list[dict]:
|
|
120
134
|
"""List active agent sessions.
|
|
@@ -476,7 +490,7 @@ class EmdashClient:
|
|
|
476
490
|
def research_stream(
|
|
477
491
|
self,
|
|
478
492
|
goal: str,
|
|
479
|
-
max_iterations: int =
|
|
493
|
+
max_iterations: int = _get_max_iterations(),
|
|
480
494
|
budget: int = 50,
|
|
481
495
|
model: Optional[str] = None,
|
|
482
496
|
) -> Iterator[str]:
|
emdash_cli/commands/__init__.py
CHANGED
|
@@ -10,6 +10,7 @@ from .plan import plan
|
|
|
10
10
|
from .rules import rules
|
|
11
11
|
from .search import search
|
|
12
12
|
from .server import server
|
|
13
|
+
from .skills import skills
|
|
13
14
|
from .team import team
|
|
14
15
|
from .swarm import swarm
|
|
15
16
|
from .projectmd import projectmd
|
|
@@ -28,6 +29,7 @@ __all__ = [
|
|
|
28
29
|
"rules",
|
|
29
30
|
"search",
|
|
30
31
|
"server",
|
|
32
|
+
"skills",
|
|
31
33
|
"team",
|
|
32
34
|
"swarm",
|
|
33
35
|
"projectmd",
|