kiteml-cli 0.9.0__tar.gz → 0.9.1__tar.gz

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.
Files changed (23) hide show
  1. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/PKG-INFO +1 -1
  2. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/__init__.py +1 -1
  3. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/cli/commands/rl.py +2 -2
  4. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/client.py +31 -5
  5. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/mcp/server.py +18 -2
  6. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/.gitignore +0 -0
  7. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/README.md +0 -0
  8. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/pyproject.toml +0 -0
  9. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/archive.py +0 -0
  10. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/auth.py +0 -0
  11. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/cli/__init__.py +0 -0
  12. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/cli/commands/__init__.py +0 -0
  13. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/cli/commands/augment.py +0 -0
  14. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/cli/commands/auth_cmd.py +0 -0
  15. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/cli/commands/config_cmd.py +0 -0
  16. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/cli/commands/evaluations.py +0 -0
  17. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/cli/commands/twin.py +0 -0
  18. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/cli/main.py +0 -0
  19. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/config.py +0 -0
  20. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/mcp/__init__.py +0 -0
  21. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/mcp/common.py +0 -0
  22. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/output.py +0 -0
  23. {kiteml_cli-0.9.0 → kiteml_cli-0.9.1}/src/kite_cli/progress.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: kiteml-cli
3
- Version: 0.9.0
3
+ Version: 0.9.1
4
4
  Summary: Kite CLI and MCP server: train robot policies with reinforcement learning in simulation, augment LeRobot datasets, and build MuJoCo digital twins, from your terminal or an AI agent.
5
5
  Project-URL: Homepage, https://kiteml.com
6
6
  Project-URL: Documentation, https://docs.kiteml.com/tools/cli-and-mcp
@@ -1,3 +1,3 @@
1
1
  """Kite CLI and MCP server for the Kite robotics training platform."""
2
2
 
3
- __version__ = "0.9.0"
3
+ __version__ = "0.9.1"
@@ -103,7 +103,7 @@ def estimate(spec: Path = _SPEC):
103
103
  @app.command()
104
104
  def train(
105
105
  spec: Path = _SPEC,
106
- seeds: Optional[int] = typer.Option(None, "--seeds", help="Runs to start, one per seed (1-4)"),
106
+ seeds: Optional[int] = typer.Option(None, "--seeds", help="Runs to start, one per seed (1-5; past your limit they queue)"),
107
107
  budget: Optional[str] = typer.Option(
108
108
  None, "--budget", help="probe (300 iterations, a first signal in minutes) or standard; replaces the "
109
109
  "spec's budget.iterations"
@@ -245,7 +245,7 @@ def fork(
245
245
  run_id: str = _RUN_ID,
246
246
  overrides: List[str] = typer.Option([], "--set", help="key=value: a reward or randomization parameter "
247
247
  "(repeatable; `kite rl catalog` lists them)"),
248
- seeds: Optional[int] = typer.Option(None, "--seeds", help="Runs to start, one per seed (1-4)"),
248
+ seeds: Optional[int] = typer.Option(None, "--seeds", help="Runs to start, one per seed (1-5; past your limit they queue)"),
249
249
  idempotency_key: Optional[str] = _KEY,
250
250
  ):
251
251
  """Train from a run's weights: its robot, task and budget, with the parameters you --set."""
@@ -15,6 +15,7 @@ from __future__ import annotations
15
15
 
16
16
  import json
17
17
  import os
18
+ import re
18
19
  import socket
19
20
  import sys
20
21
  import time
@@ -54,10 +55,35 @@ def seg(value: Any) -> str:
54
55
  return s
55
56
 
56
57
 
57
- def user_agent(surface: str = "kite-cli") -> str:
58
+ # Coding agents, by the marker each sets in the shells it runs. AI_AGENT, the cross-tool convention, wins when set.
59
+ _AGENT_MARKERS = (("CLAUDECODE", "claude-code"), ("CURSOR_AGENT", "cursor"), ("GEMINI_CLI", "gemini-cli"),
60
+ ("CODEX_SANDBOX", "codex"))
61
+
62
+
63
+ def _token(value: str) -> str:
64
+ """A name safe inside a User-Agent comment: lowercase letters, digits, `.` and `-`, at most 40 characters."""
65
+ return re.sub(r"[^a-z0-9.-]+", "-", value.lower()).strip("-")[:40]
66
+
67
+
68
+ def agent_name() -> Optional[str]:
69
+ """The coding agent running this process, when it says so: AI_AGENT's name (`claude-code_2-1-3_agent` →
70
+ `claude-code`), else the marker an agent sets. A best-effort hint for usage reports, never a security signal."""
71
+ named = os.environ.get("AI_AGENT", "").strip()
72
+ if named:
73
+ return _token(named.split("_")[0]) or None
74
+ return next((name for var, name in _AGENT_MARKERS if os.environ.get(var)), None)
75
+
76
+
77
+ def user_agent(surface: str = "kite-cli", client: Optional[str] = None) -> str:
58
78
  """The User-Agent every request sends: `kite-cli/<version>`, or `kite-mcp/<version>` from the MCP server. The
59
- API's request log and run attribution read the surface from this prefix."""
60
- return f"{surface}/{__version__}"
79
+ API's request log and run attribution read the surface from this prefix. A comment names who drove the call:
80
+ the MCP client from its handshake (`(client claude-ai)`), else a coding agent the CLI runs under
81
+ (`(agent claude-code)`), so usage reports can count agents."""
82
+ base = f"{surface}/{__version__}"
83
+ if client and _token(client):
84
+ return f"{base} (client {_token(client)})"
85
+ agent = agent_name()
86
+ return f"{base} (agent {agent})" if agent else base
61
87
 
62
88
 
63
89
  class KiteAPIError(Exception):
@@ -106,10 +132,10 @@ class KiteClient:
106
132
  """HTTP client for the Kite API."""
107
133
 
108
134
  def __init__(self, api_url: Optional[str] = None, token: Optional[str] = None, timeout: float = 30.0,
109
- surface: str = "kite-cli"):
135
+ surface: str = "kite-cli", client: Optional[str] = None):
110
136
  self.base_url = (api_url or get_api_url()).rstrip("/")
111
137
  self._token_override = token
112
- self._user_agent = user_agent(surface)
138
+ self._user_agent = user_agent(surface, client)
113
139
  # httpx ignores the proxy settings once it is given a transport, so behind a proxy it keeps its own.
114
140
  proxied = getproxies().keys() & {"http", "https", "all"}
115
141
  self._client = httpx.Client(
@@ -50,7 +50,23 @@ def _client(timeout: float = 30.0) -> KiteClient:
50
50
  or os.environ.get("KITE_API_KEY")
51
51
  or os.environ.get("KITE_TOKEN")
52
52
  )
53
- return KiteClient(api_url=os.environ.get("KITE_API_URL"), token=token, timeout=timeout, surface="kite-mcp")
53
+ return KiteClient(api_url=os.environ.get("KITE_API_URL"), token=token, timeout=timeout, surface="kite-mcp",
54
+ client=_mcp_client_name())
55
+
56
+
57
+ def _mcp_client_name() -> str | None:
58
+ """Which MCP client is calling, so the API can count the agents that use Kite: its name from the initialize
59
+ handshake (`claude-ai`, `cursor-vscode`, `claude-code`…). The hosted server is stateless, so a tool call there
60
+ has no handshake: the product of the HTTP client's own User-Agent stands in (`claude-code/2.1` → `claude-code`)."""
61
+ try:
62
+ ctx = server.request_context
63
+ except LookupError:
64
+ return None # outside a request
65
+ params = getattr(ctx.session, "client_params", None)
66
+ if params is not None:
67
+ return params.clientInfo.name
68
+ headers = getattr(ctx.request, "headers", None) or {}
69
+ return (headers.get("user-agent") or "").split("/")[0].split(" ")[0] or None
54
70
 
55
71
 
56
72
  def _fetch_command(d: dict, fname: str, client: KiteClient) -> str:
@@ -207,7 +223,7 @@ _RL_SPEC = {
207
223
  "kite_rl_plan writes one"},
208
224
  "budget": {"type": "object", "description": "{preset: probe | standard, iterations?, num_envs?, max_tokens?}; "
209
225
  "probe is 300 iterations, a first signal in minutes. Optional"},
210
- "seeds": {"type": "integer", "description": "Runs to start, one per seed (1-4, default 1). Optional"},
226
+ "seeds": {"type": "integer", "description": "Runs to start, one per seed (1-5, default 1; past the account limit they queue). Optional"},
211
227
  "from": {"type": "object", "description": "Start from a trained policy instead of from scratch: {run: rlr_..., "
212
228
  "mode: fork | continue} or {policy: <public policy id>}. Optional"},
213
229
  "description": {"type": "string", "description": "What the behavior should look like; the report compares the "
File without changes
File without changes
File without changes