uro-cli 0.9.0__tar.gz → 0.11.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: uro-cli
3
- Version: 0.9.0
3
+ Version: 0.11.0
4
4
  Summary: Uro Engine reference client — play, dry-run, and dev tools against the engine
5
5
  Project-URL: Homepage, https://github.com/cupskeee/uro
6
6
  Project-URL: Repository, https://github.com/cupskeee/uro
@@ -12,8 +12,8 @@ Requires-Python: >=3.12
12
12
  Requires-Dist: python-dotenv>=1.0
13
13
  Requires-Dist: rich>=13.9
14
14
  Requires-Dist: typer>=0.27.2
15
- Requires-Dist: uro-core[llm,postgres]==0.9.0
16
- Requires-Dist: uro-server==0.9.0
15
+ Requires-Dist: uro-core[llm,postgres]==0.11.0
16
+ Requires-Dist: uro-server==0.11.0
17
17
  Requires-Dist: websockets>=16.1
18
18
  Description-Content-Type: text/markdown
19
19
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "uro-cli"
3
- version = "0.9.0"
3
+ version = "0.11.0"
4
4
  description = "Uro Engine reference client — play, dry-run, and dev tools against the engine"
5
5
  license = "MIT"
6
6
  license-files = ["LICENSE"]
@@ -13,8 +13,8 @@ requires-python = ">=3.12"
13
13
  # pair a new uro-cli with an old uro-core; `just release` bumps all three together, and the
14
14
  # `{workspace = true}` sources make a drifted pin fail `uv sync` locally.
15
15
  dependencies = [
16
- "uro-core[postgres,llm]==0.9.0",
17
- "uro-server==0.9.0",
16
+ "uro-core[postgres,llm]==0.11.0",
17
+ "uro-server==0.11.0",
18
18
  "typer>=0.27.2",
19
19
  "rich>=13.9",
20
20
  "websockets>=16.1",
@@ -131,3 +131,51 @@ def test_another_players_identical_intent_never_settles_ours() -> None:
131
131
  ours = out.index("✓ [player-1] 'look around'") # ...but our prompt waited for OUR beat
132
132
  prompts = [i for i in range(len(out)) if out.startswith("> ", i)]
133
133
  assert len(prompts) == 2 and prompts[1] > ours, out
134
+
135
+
136
+ def test_the_prompt_returns_when_the_story_is_told() -> None:
137
+ # D-71: a server that marks the end of the narration frees the prompt while the beat is still
138
+ # being extracted; the next intent waits on the server until that beat commits.
139
+ from uro_core.pipeline.engine import NARRATION_DONE
140
+
141
+ started: list[str] = []
142
+
143
+ async def run_beat(campaign_id: str, participant: str, text: str) -> AsyncIterator[str]:
144
+ started.append(text)
145
+ yield "The tide turns."
146
+ yield NARRATION_DONE
147
+ await asyncio.sleep(0.6) # the extractor's seconds
148
+
149
+ async def campaign_exists(campaign_id: str) -> bool:
150
+ return True
151
+
152
+ deps = ServerDeps(
153
+ resolve_participant={"tok": "player-1"}.get,
154
+ campaign_exists=campaign_exists,
155
+ run_beat=run_beat,
156
+ )
157
+ port = _free_port()
158
+ server = uvicorn.Server(
159
+ uvicorn.Config(create_app(deps), host="127.0.0.1", port=port, log_level="warning")
160
+ )
161
+ thread = threading.Thread(target=server.run, daemon=True)
162
+ thread.start()
163
+ while not server.started:
164
+ time.sleep(0.02)
165
+ try:
166
+ result = CliRunner().invoke(
167
+ app,
168
+ ["connect", "camp-1", "--server", f"http://127.0.0.1:{port}", "--token", "tok"],
169
+ input="first\nsecond\n/quit\n",
170
+ )
171
+ finally:
172
+ server.should_exit = True
173
+ thread.join(5)
174
+ out = result.output
175
+ assert result.exit_code == 0, out
176
+ assert started == ["first", "second"] # in order: the second waited for the first to commit
177
+ prompts = [i for i in range(len(out)) if out.startswith("> ", i)]
178
+ first_done = out.index("✓ [player-1] 'first'")
179
+ assert prompts[1] < first_done, out # the prompt came back before the first beat committed
180
+ assert "\x00" not in out # the marker itself is never shown
181
+ assert "The tide turns.\n> " in out # the prompt starts its own line (review)
@@ -121,3 +121,33 @@ async def test_all_roles_bound_without_default_is_ok() -> None:
121
121
  router = await build_router_from_registry(reg)
122
122
  assert router is not None
123
123
  assert isinstance(router._provider_for("narrator"), StubProvider)
124
+
125
+
126
+ async def test_each_binding_s_reasoning_effort_reaches_its_adapter() -> None:
127
+ # D-71 review: the effort was stored and listed, but no test showed the router built the
128
+ # adapters with it — dropping it there would have left it silently unsent.
129
+ from uro_core.providers.adapters.codex import CodexResponsesProvider
130
+
131
+ reg = FakeRegistry(
132
+ connections=[
133
+ ModelConnection(id="c1", name="oai", provider="openai", auth_id="k1"),
134
+ ModelConnection(id="c2", name="cdx", provider="codex", auth_id="k2"),
135
+ ],
136
+ bindings=[
137
+ RoleBinding(role="default", connection_id="c1", model="gpt-5.1"),
138
+ RoleBinding(
139
+ role="planner", connection_id="c1", model="gpt-5.1", reasoning_effort="low"
140
+ ),
141
+ RoleBinding(
142
+ role="extractor", connection_id="c2", model="gpt-5.6-luna", reasoning_effort="low"
143
+ ),
144
+ ],
145
+ secrets={"k1": ("sk-oai", None)},
146
+ )
147
+ router = await build_router_from_registry(reg)
148
+ assert router is not None
149
+ planner, extractor = router._provider_for("planner"), router._provider_for("extractor")
150
+ assert isinstance(planner, OpenAICompatProvider) and planner._reasoning_effort == "low"
151
+ assert isinstance(extractor, CodexResponsesProvider) and extractor._reasoning_effort == "low"
152
+ default = router._provider_for("default")
153
+ assert isinstance(default, OpenAICompatProvider) and default._reasoning_effort is None
@@ -712,11 +712,14 @@ def connect(
712
712
  try:
713
713
  async with websockets.connect(uri) as ws:
714
714
  typer.echo(f"connected to {campaign_id} as {token!r}. Type an action; /quit.\n")
715
- # An intent's beat is SETTLED by one of these, each echoing the intent's text. The
716
- # prompt waits for it: shown at once, it sat above the streaming narration and was
717
- # gone by the time the beat committed (extraction runs after the narration), so a
718
- # player retyped the intent and played it twice (live run, 2026-10-31).
715
+ # An intent is SETTLED by one of these, each echoing the intent's text. The prompt
716
+ # waits for it: shown at once, it sat above the streaming narration and was gone by
717
+ # the time the beat committed, so a player retyped an intent and played it twice
718
+ # (live run, 2026-10-31). A server that sends `beat_narrated` (D-71) frees the
719
+ # prompt when the story is told, while the beat is still being extracted; an intent
720
+ # typed then waits on the server until that beat commits.
719
721
  settles = {
722
+ "beat_narrated", # D-71: the narration is done; the beat commits in the back
720
723
  "beat_committed",
721
724
  "beat_failed",
722
725
  "not_your_turn",
@@ -776,8 +779,12 @@ def connect(
776
779
  typer.echo(
777
780
  " · voting isn't enabled here (server needs --arbiter vote)"
778
781
  )
782
+ elif kind == "beat_narrated":
783
+ typer.echo("") # end the story's line before the prompt comes back
779
784
  elif kind == "beat_failed":
780
- typer.echo(f"\n ✗ beat failed: {msg['error']}")
785
+ typer.echo(
786
+ f"\n ✗ beat failed ({msg.get('intent', '')!r}): {msg['error']}"
787
+ )
781
788
  elif kind == "intent_rejected":
782
789
  typer.echo(
783
790
  f" ✗ [{msg['participant_id']}] intent rejected: {msg['text']!r}"
@@ -1686,7 +1693,8 @@ def consistency(campaign_id: str) -> None:
1686
1693
  """Report the narrator contradiction-survival rate (thesis proxy metric T2).
1687
1694
 
1688
1695
  Counts narrator-asserted claims that survived the extractor's contradiction gauntlet
1689
- (i.e. were not flagged as contradicting recalled state). This is a PROXY — it only
1696
+ (i.e. were not flagged as contradicting recalled state); a fact a later change superseded
1697
+ (D-70) counts neither way. This is a PROXY — it only
1690
1698
  catches contradictions the extractor self-flagged, not all narration-vs-truth
1691
1699
  disagreement — best read as a regression trend, not ground-truth verification.
1692
1700
  """
@@ -1790,7 +1798,10 @@ def codex_list(
1790
1798
  def provider_add(
1791
1799
  name: str = typer.Argument(..., help="a display label for this connection"),
1792
1800
  provider: str = typer.Option(
1793
- ..., "--provider", help="provider kind: openai | anthropic | openai_compat | local | stub"
1801
+ ...,
1802
+ "--provider",
1803
+ help="provider kind: openai | anthropic | openai_compat | local | stub | claude_cli | "
1804
+ "codex_cli (the last two run the installed, logged-in CLI; --base-url = its path)",
1794
1805
  ),
1795
1806
  base_url: str = typer.Option(None, "--base-url", help="per-connection endpoint override"),
1796
1807
  api_key: str = typer.Option(
@@ -1808,6 +1819,9 @@ def provider_add(
1808
1819
  async def _run() -> None:
1809
1820
  if api_key and credential:
1810
1821
  raise ValueError("pass either --api-key or --credential, not both")
1822
+ from uro_core.providers.registry import check_cli_command
1823
+
1824
+ check_cli_command(provider, base_url)
1811
1825
  store = build_store()
1812
1826
  await connect_store(store)
1813
1827
  try:
@@ -1858,7 +1872,8 @@ def provider_list() -> None:
1858
1872
  if not bindings:
1859
1873
  typer.echo(" (none — the server falls back to the --provider/uro.toml seed)")
1860
1874
  for b in bindings:
1861
- typer.echo(f" {b.role:<9} → {b.connection_id} : {b.model}")
1875
+ effort = f" (effort {b.reasoning_effort})" if b.reasoning_effort else ""
1876
+ typer.echo(f" {b.role:<9} → {b.connection_id} : {b.model}{effort}")
1862
1877
  if credentials:
1863
1878
  typer.echo("credentials:")
1864
1879
  for cr in credentials:
@@ -2011,6 +2026,9 @@ def provider_refresh(connection_id: str) -> None:
2011
2026
  def provider_test(
2012
2027
  connection_id: str,
2013
2028
  model: str = typer.Option("", "--model", help="the model to probe (default: a known-good one)"),
2029
+ reasoning_effort: str = typer.Option(
2030
+ "", "--reasoning-effort", help="send this effort too, to check the model accepts it (D-71)"
2031
+ ),
2014
2032
  ) -> None:
2015
2033
  """Probe a connection with one tiny call. Exits 1 if the provider refuses it."""
2016
2034
 
@@ -2022,7 +2040,9 @@ def provider_test(
2022
2040
  try:
2023
2041
  if await store.get_connection(connection_id) is None:
2024
2042
  raise ValueError(f"no such connection: {connection_id}")
2025
- result = await probe_connection(store, connection_id, model)
2043
+ result = await probe_connection(
2044
+ store, connection_id, model, reasoning_effort=reasoning_effort or None
2045
+ )
2026
2046
  finally:
2027
2047
  await store.close()
2028
2048
  typer.echo(("ok: " if result["ok"] else "failed: ") + result["detail"])
@@ -2145,11 +2165,18 @@ def provider_bind(
2145
2165
  role: str = typer.Argument(..., help=f"one of: {', '.join(_ROLES)}"),
2146
2166
  connection_id: str = typer.Argument(...),
2147
2167
  model: str = typer.Argument(..., help="a model id offered by the connection's provider"),
2168
+ reasoning_effort: str = typer.Option(
2169
+ "",
2170
+ "--reasoning-effort",
2171
+ help="how hard a reasoning model thinks: none|minimal|low|medium|high|xhigh (D-71; "
2172
+ "omit for the provider's default). `low` on the extractor cut its latency ~40% in replays "
2173
+ "(docs/21); check a model accepts it with `uro provider test --reasoning-effort`.",
2174
+ ),
2148
2175
  ) -> None:
2149
2176
  """Bind an engine role to a connection + model. `default` backs any unbound role."""
2150
2177
 
2151
2178
  async def _run() -> None:
2152
- from uro_core.providers.registry import classify_modality
2179
+ from uro_core.providers.registry import check_reasoning_effort, classify_modality
2153
2180
 
2154
2181
  if role not in _ROLES:
2155
2182
  raise ValueError(f"unknown role {role!r}; one of: {', '.join(_ROLES)}")
@@ -2167,10 +2194,13 @@ def provider_bind(
2167
2194
  f"the embedder role needs an embedding model, not {model!r} "
2168
2195
  f"(a chat model on provider {conn.provider!r})"
2169
2196
  )
2170
- await store.set_role_binding(role, connection_id, model)
2197
+ effort = check_reasoning_effort(conn, reasoning_effort)
2198
+ await store.set_role_binding(role, connection_id, model, reasoning_effort=effort)
2171
2199
  finally:
2172
2200
  await store.close()
2173
- typer.echo(f"bound {role} → {connection_id} : {model}")
2201
+ typer.echo(
2202
+ f"bound {role} → {connection_id} : {model}" + (f" (effort {effort})" if effort else "")
2203
+ )
2174
2204
 
2175
2205
  _run_async(_run)
2176
2206
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes