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 CHANGED
@@ -1,3 +1,8 @@
1
1
  """EmDash CLI - Command-line interface for code intelligence."""
2
2
 
3
- __version__ = "0.1.3"
3
+ from importlib.metadata import version, PackageNotFoundError
4
+
5
+ try:
6
+ __version__ = version("emdash-cli")
7
+ except PackageNotFoundError:
8
+ __version__ = "0.0.0-dev"
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 = 20,
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
- with self._client.stream(
86
- "POST",
87
- f"{self.base_url}/api/agent/chat",
88
- json=payload,
89
- ) as response:
90
- response.raise_for_status()
91
- for line in response.iter_lines():
92
- yield line
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
- with self._client.stream(
111
- "POST",
112
- f"{self.base_url}/api/agent/chat/{session_id}/continue",
113
- json=payload,
114
- ) as response:
115
- response.raise_for_status()
116
- for line in response.iter_lines():
117
- yield line
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 = 10,
493
+ max_iterations: int = _get_max_iterations(),
480
494
  budget: int = 50,
481
495
  model: Optional[str] = None,
482
496
  ) -> Iterator[str]:
@@ -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",