uro-cli 0.16.0__tar.gz → 0.17.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.
- {uro_cli-0.16.0 → uro_cli-0.17.0}/PKG-INFO +3 -3
- {uro_cli-0.16.0 → uro_cli-0.17.0}/pyproject.toml +3 -3
- {uro_cli-0.16.0 → uro_cli-0.17.0}/uro_cli/main.py +164 -15
- {uro_cli-0.16.0 → uro_cli-0.17.0}/.gitignore +0 -0
- {uro_cli-0.16.0 → uro_cli-0.17.0}/LICENSE +0 -0
- {uro_cli-0.16.0 → uro_cli-0.17.0}/README.md +0 -0
- {uro_cli-0.16.0 → uro_cli-0.17.0}/tests/test_cli_scaffold.py +0 -0
- {uro_cli-0.16.0 → uro_cli-0.17.0}/tests/test_connect.py +0 -0
- {uro_cli-0.16.0 → uro_cli-0.17.0}/tests/test_registry_router.py +0 -0
- {uro_cli-0.16.0 → uro_cli-0.17.0}/tests/test_wiring.py +0 -0
- {uro_cli-0.16.0 → uro_cli-0.17.0}/uro_cli/__init__.py +0 -0
- {uro_cli-0.16.0 → uro_cli-0.17.0}/uro_cli/py.typed +0 -0
- {uro_cli-0.16.0 → uro_cli-0.17.0}/uro_cli/wiring.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: uro-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.17.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.
|
|
16
|
-
Requires-Dist: uro-server==0.
|
|
15
|
+
Requires-Dist: uro-core[llm,postgres]==0.17.0
|
|
16
|
+
Requires-Dist: uro-server==0.17.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.
|
|
3
|
+
version = "0.17.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.
|
|
17
|
-
"uro-server==0.
|
|
16
|
+
"uro-core[postgres,llm]==0.17.0",
|
|
17
|
+
"uro-server==0.17.0",
|
|
18
18
|
"typer>=0.27.2",
|
|
19
19
|
"rich>=13.9",
|
|
20
20
|
"websockets>=16.1",
|
|
@@ -18,13 +18,14 @@ from typing import Any
|
|
|
18
18
|
import typer
|
|
19
19
|
from dotenv import find_dotenv, load_dotenv
|
|
20
20
|
from uro_core.adapters.postgres.store import PostgresEventStore
|
|
21
|
-
from uro_core.pipeline.engine import Engine
|
|
21
|
+
from uro_core.pipeline.engine import BeatResult, Engine
|
|
22
22
|
from uro_core.ports.model_registry import ROLES
|
|
23
23
|
from uro_core.providers.router import ProviderRouter
|
|
24
24
|
from uro_core.rulesets import registry
|
|
25
25
|
from uro_core.rulesets.base import CharSpec, Ruleset
|
|
26
26
|
from uro_core.rulesets.rng import Rng
|
|
27
|
-
from uro_core.timeline.
|
|
27
|
+
from uro_core.timeline.gear import starting_gear
|
|
28
|
+
from uro_core.timeline.models import FORK_TIME_SKIP, World
|
|
28
29
|
|
|
29
30
|
from uro_cli.wiring import (
|
|
30
31
|
build_router,
|
|
@@ -217,6 +218,7 @@ def world_new(
|
|
|
217
218
|
ruleset: str = typer.Option(
|
|
218
219
|
"", "--ruleset", help="a built-in ruleset id (`uro ruleset list`); default uro-basic"
|
|
219
220
|
),
|
|
221
|
+
pc: str = typer.Option("Player", "--pc", help="the player character's name"),
|
|
220
222
|
) -> None:
|
|
221
223
|
"""Create a world (+ its main branch) and a ready-to-play campaign with a default,
|
|
222
224
|
sheeted PC. Prints the campaign id."""
|
|
@@ -232,15 +234,15 @@ def world_new(
|
|
|
232
234
|
world.world_id,
|
|
233
235
|
world.main_branch_id,
|
|
234
236
|
participant_id=PARTICIPANT,
|
|
235
|
-
new_pc_name=
|
|
237
|
+
new_pc_name=pc,
|
|
236
238
|
pc_sheet=sheet,
|
|
237
|
-
starting_items=
|
|
239
|
+
starting_items=await starting_gear(store, world.main_branch_id),
|
|
238
240
|
ruleset_id=ruleset_id,
|
|
239
241
|
)
|
|
240
242
|
finally:
|
|
241
243
|
await store.close()
|
|
242
244
|
typer.echo(f"world: {world.world_id} ({name})")
|
|
243
|
-
typer.echo(f"campaign: {campaign.campaign_id} (PC:
|
|
245
|
+
typer.echo(f"campaign: {campaign.campaign_id} (PC: {pc})")
|
|
244
246
|
typer.echo(f"\nplay it: uro play {campaign.campaign_id}")
|
|
245
247
|
|
|
246
248
|
_run_async(_run)
|
|
@@ -315,7 +317,8 @@ def world_create(
|
|
|
315
317
|
typer.echo(f"world: {world.world_id} ({world.name}, grade {result.grade})")
|
|
316
318
|
for a in result.backfilled:
|
|
317
319
|
typer.echo(f" backfilled + committed: {a}")
|
|
318
|
-
|
|
320
|
+
if pack.manifest.history.vocabulary is not None: # D-97: seeding speaks the pack's words
|
|
321
|
+
typer.echo(f"seed history: uro world seed {path} --seed 42")
|
|
319
322
|
|
|
320
323
|
_run_async(_run)
|
|
321
324
|
|
|
@@ -328,9 +331,10 @@ def world_seed(
|
|
|
328
331
|
None, "--world", help="the world to seed (id or name; default: the pack's name)"
|
|
329
332
|
),
|
|
330
333
|
) -> None:
|
|
331
|
-
"""Run History seeding on the world imported from <path>: layer seed-dependent
|
|
332
|
-
|
|
333
|
-
history on identical
|
|
334
|
+
"""Run History seeding on the world imported from <path>: layer a seed-dependent past (power
|
|
335
|
+
groups, their leaders and conflicts, in the pack's [history.vocabulary]) on top of the authored
|
|
336
|
+
geography (docs/09). Same pack + a different seed → a different history on identical
|
|
337
|
+
geography."""
|
|
334
338
|
|
|
335
339
|
async def _run() -> None:
|
|
336
340
|
from uro_core.errors import PackError
|
|
@@ -350,7 +354,8 @@ def world_seed(
|
|
|
350
354
|
await store.close()
|
|
351
355
|
typer.echo(f"seeded {target.name!r} with seed {seed} → commit {result.commit_id}")
|
|
352
356
|
typer.echo(
|
|
353
|
-
f" {result.
|
|
357
|
+
f" {result.groups} power groups, {result.wars} conflicts "
|
|
358
|
+
"(on the pack's authored geography)"
|
|
354
359
|
)
|
|
355
360
|
|
|
356
361
|
_run_async(_run)
|
|
@@ -526,6 +531,7 @@ def play(
|
|
|
526
531
|
typer.echo(f" > {beat.intent_text}")
|
|
527
532
|
typer.echo(f" {beat.narration}")
|
|
528
533
|
typer.echo("—")
|
|
534
|
+
day: int | None = await store.current_world_time(campaign.branch_id)
|
|
529
535
|
|
|
530
536
|
while True:
|
|
531
537
|
try:
|
|
@@ -538,10 +544,17 @@ def play(
|
|
|
538
544
|
if not intent:
|
|
539
545
|
continue
|
|
540
546
|
try:
|
|
541
|
-
|
|
547
|
+
results: list[BeatResult] = []
|
|
548
|
+
async for chunk in engine.run_beat_stream(
|
|
549
|
+
campaign, PARTICIPANT, intent, on_result=results.append
|
|
550
|
+
):
|
|
542
551
|
sys.stdout.write(chunk)
|
|
543
552
|
sys.stdout.flush()
|
|
544
553
|
sys.stdout.write("\n")
|
|
554
|
+
for line in beat_detail_lines(_details(results[0]) if results else {}, day):
|
|
555
|
+
typer.echo(line)
|
|
556
|
+
if results:
|
|
557
|
+
day = results[0].world_day
|
|
545
558
|
except Exception as exc:
|
|
546
559
|
sys.stdout.write("\n")
|
|
547
560
|
typer.echo(f"beat failed ({exc}); nothing was saved — try again.", err=True)
|
|
@@ -551,6 +564,38 @@ def play(
|
|
|
551
564
|
_run_async(_run)
|
|
552
565
|
|
|
553
566
|
|
|
567
|
+
def _details(result: BeatResult) -> dict[str, Any]:
|
|
568
|
+
"""A local beat's details in the shape `beat_committed` carries them (D-98)."""
|
|
569
|
+
return {
|
|
570
|
+
"checks": [c.model_dump() for c in result.outcomes],
|
|
571
|
+
"suggestions": result.suggestions,
|
|
572
|
+
"mode": result.mode,
|
|
573
|
+
"world_day": result.world_day,
|
|
574
|
+
"created": [c.model_dump() for c in result.created],
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
def beat_detail_lines(
|
|
579
|
+
details: dict[str, Any], previous_day: int | None, *, mine: bool = True
|
|
580
|
+
) -> list[str]:
|
|
581
|
+
"""What `uro play` and `uro connect` show under a beat (D-98): each check's outcome, a
|
|
582
|
+
fight, the day (when it moved, or first seen), what the beat made, and — under the player's
|
|
583
|
+
OWN beat only — the planner's suggestions (in a party they belong to whoever acted)."""
|
|
584
|
+
lines = [f" · {c['affordance']}: {c['outcome']}" for c in details.get("checks") or []]
|
|
585
|
+
if details.get("mode") == "encounter":
|
|
586
|
+
lines.append(" · a fight was resolved")
|
|
587
|
+
day = details.get("world_day")
|
|
588
|
+
if day is not None and day != previous_day:
|
|
589
|
+
lines.append(f" · day {day}")
|
|
590
|
+
created = details.get("created") or []
|
|
591
|
+
if created:
|
|
592
|
+
lines.append(" + new: " + ", ".join(f"{c['name']} ({c['kind']})" for c in created))
|
|
593
|
+
suggestions = details.get("suggestions") or []
|
|
594
|
+
if suggestions and mine:
|
|
595
|
+
lines.append(" ? you could: " + "; ".join(suggestions))
|
|
596
|
+
return lines
|
|
597
|
+
|
|
598
|
+
|
|
554
599
|
@app.command()
|
|
555
600
|
def serve(
|
|
556
601
|
host: str = typer.Option("127.0.0.1", help="bind address"),
|
|
@@ -749,6 +794,7 @@ def connect(
|
|
|
749
794
|
# without an id is another client's.
|
|
750
795
|
pending: dict[str, tuple[str, asyncio.Event]] = {}
|
|
751
796
|
echoes = False
|
|
797
|
+
seen_day: int | None = None # the day the last beat_committed showed
|
|
752
798
|
|
|
753
799
|
def settle(msg: dict[str, Any]) -> None:
|
|
754
800
|
if "intent_id" in msg:
|
|
@@ -763,17 +809,27 @@ def connect(
|
|
|
763
809
|
hit[1].set()
|
|
764
810
|
|
|
765
811
|
async def receive() -> None:
|
|
766
|
-
nonlocal echoes
|
|
812
|
+
nonlocal echoes, seen_day
|
|
767
813
|
async for raw in ws:
|
|
768
814
|
msg = json.loads(raw)
|
|
769
815
|
kind = msg.get("type")
|
|
770
816
|
echoes = echoes or "intent_id" in msg
|
|
817
|
+
# one of OUR intents? (decided before settle() pops it)
|
|
818
|
+
ours = (
|
|
819
|
+
str(msg["intent_id"]) in pending
|
|
820
|
+
if "intent_id" in msg
|
|
821
|
+
else any(t == msg.get("intent") for t, _ in pending.values())
|
|
822
|
+
)
|
|
771
823
|
if kind in settles:
|
|
772
824
|
settle(msg)
|
|
773
825
|
if kind == "narration_chunk":
|
|
774
826
|
typer.echo(msg["text"], nl=False)
|
|
775
827
|
elif kind == "beat_committed":
|
|
776
|
-
typer.echo(f"\n ✓ [{msg['participant_id']}] {msg['intent']!r}
|
|
828
|
+
typer.echo(f"\n ✓ [{msg['participant_id']}] {msg['intent']!r}")
|
|
829
|
+
for line in beat_detail_lines(msg, seen_day, mine=ours):
|
|
830
|
+
typer.echo(line)
|
|
831
|
+
seen_day = msg.get("world_day", seen_day)
|
|
832
|
+
typer.echo("")
|
|
777
833
|
elif kind == "not_your_turn":
|
|
778
834
|
typer.echo(" · not your turn — another player holds it (round-robin)")
|
|
779
835
|
elif kind == "proposal_opened":
|
|
@@ -1486,6 +1542,97 @@ def campaign_show(campaign_id: str) -> None:
|
|
|
1486
1542
|
_run_async(_run)
|
|
1487
1543
|
|
|
1488
1544
|
|
|
1545
|
+
def _print_removed(removed: dict[str, int]) -> None:
|
|
1546
|
+
kept = {k: v for k, v in removed.items() if v}
|
|
1547
|
+
typer.echo("removed: " + (", ".join(f"{v} {k}" for k, v in kept.items()) or "nothing"))
|
|
1548
|
+
|
|
1549
|
+
|
|
1550
|
+
def _confirm_or_exit(yes: bool, what: str) -> None:
|
|
1551
|
+
if not yes:
|
|
1552
|
+
typer.echo(
|
|
1553
|
+
f"this permanently deletes {what}; nothing can bring it back. Pass --yes.", err=True
|
|
1554
|
+
)
|
|
1555
|
+
raise typer.Exit(1)
|
|
1556
|
+
|
|
1557
|
+
|
|
1558
|
+
@world_app.command("delete")
|
|
1559
|
+
def world_delete(
|
|
1560
|
+
world: str,
|
|
1561
|
+
yes: bool = typer.Option(False, "--yes", help="confirm: the world is gone for good"),
|
|
1562
|
+
) -> None:
|
|
1563
|
+
"""Remove a world and everything it holds, for good (D-99): campaigns, branches, history,
|
|
1564
|
+
memories, its players' notes for it, and the model calls metered for it. A privacy wipe."""
|
|
1565
|
+
|
|
1566
|
+
async def _run() -> None:
|
|
1567
|
+
store = build_store()
|
|
1568
|
+
await connect_store(store)
|
|
1569
|
+
try:
|
|
1570
|
+
w = await _world_or_exit(store, world)
|
|
1571
|
+
_confirm_or_exit(yes, f"the world {w.name!r} ({w.world_id})")
|
|
1572
|
+
removed = await store.delete_world(w.world_id)
|
|
1573
|
+
finally:
|
|
1574
|
+
await store.close()
|
|
1575
|
+
_print_removed(removed)
|
|
1576
|
+
|
|
1577
|
+
_run_async(_run)
|
|
1578
|
+
|
|
1579
|
+
|
|
1580
|
+
@branch_app.command("delete")
|
|
1581
|
+
def branch_delete(
|
|
1582
|
+
world: str,
|
|
1583
|
+
branch: str,
|
|
1584
|
+
yes: bool = typer.Option(False, "--yes", help="confirm: the branch is gone for good"),
|
|
1585
|
+
) -> None:
|
|
1586
|
+
"""Remove a branch, its campaigns and the commits only it reaches (D-99); history it shares
|
|
1587
|
+
with other branches stays. A world's main branch can't be removed (remove the world)."""
|
|
1588
|
+
|
|
1589
|
+
async def _run() -> None:
|
|
1590
|
+
store = build_store()
|
|
1591
|
+
await connect_store(store)
|
|
1592
|
+
try:
|
|
1593
|
+
w = await _world_or_exit(store, world)
|
|
1594
|
+
b = await _branch_or_exit(store, w, branch)
|
|
1595
|
+
_confirm_or_exit(yes, f"the branch {b.name!r} of {w.name!r}")
|
|
1596
|
+
try:
|
|
1597
|
+
removed = await store.delete_branch(b.branch_id)
|
|
1598
|
+
except ValueError as exc:
|
|
1599
|
+
typer.echo(f"error: {exc}", err=True)
|
|
1600
|
+
raise typer.Exit(1) from exc
|
|
1601
|
+
finally:
|
|
1602
|
+
await store.close()
|
|
1603
|
+
_print_removed(removed)
|
|
1604
|
+
|
|
1605
|
+
_run_async(_run)
|
|
1606
|
+
|
|
1607
|
+
|
|
1608
|
+
@campaign_app.command("delete")
|
|
1609
|
+
def campaign_delete(
|
|
1610
|
+
campaign_id: str,
|
|
1611
|
+
yes: bool = typer.Option(False, "--yes", help="confirm: the campaign is gone for good"),
|
|
1612
|
+
) -> None:
|
|
1613
|
+
"""Remove a campaign and its branch (D-99). Refused for a campaign on its world's main branch
|
|
1614
|
+
(remove the world) or on a branch other campaigns share (remove the branch)."""
|
|
1615
|
+
|
|
1616
|
+
async def _run() -> None:
|
|
1617
|
+
from uro_core.timeline.removal import delete_campaign
|
|
1618
|
+
|
|
1619
|
+
store = build_store()
|
|
1620
|
+
await connect_store(store)
|
|
1621
|
+
try:
|
|
1622
|
+
c = await _campaign_or_exit(store, campaign_id)
|
|
1623
|
+
_confirm_or_exit(yes, f"the campaign {c.campaign_id} and its branch")
|
|
1624
|
+
try:
|
|
1625
|
+
removed = await delete_campaign(store, c.campaign_id)
|
|
1626
|
+
except ValueError as exc:
|
|
1627
|
+
typer.echo(f"error: {exc}", err=True)
|
|
1628
|
+
raise typer.Exit(1) from exc
|
|
1629
|
+
finally:
|
|
1630
|
+
await store.close()
|
|
1631
|
+
_print_removed(removed)
|
|
1632
|
+
|
|
1633
|
+
_run_async(_run)
|
|
1634
|
+
|
|
1635
|
+
|
|
1489
1636
|
@campaign_app.command("pacing")
|
|
1490
1637
|
def campaign_pacing(campaign_id: str) -> None:
|
|
1491
1638
|
"""Which live plots have gone quiet, and the one the next beat would name to the narrator
|
|
@@ -1598,7 +1745,7 @@ def campaign_new(
|
|
|
1598
1745
|
adopt_actor_id=adopt,
|
|
1599
1746
|
new_pc_name=pc,
|
|
1600
1747
|
pc_sheet=pc_sheet,
|
|
1601
|
-
starting_items=
|
|
1748
|
+
starting_items=await starting_gear(store, b.branch_id) if pc is not None else None,
|
|
1602
1749
|
ruleset_id=ruleset_id,
|
|
1603
1750
|
ruleset_version=pin.version,
|
|
1604
1751
|
seed=seed,
|
|
@@ -1737,7 +1884,9 @@ def campaign_join(
|
|
|
1737
1884
|
adopt_actor_id=adopt,
|
|
1738
1885
|
new_pc_name=pc,
|
|
1739
1886
|
pc_sheet=pc_sheet,
|
|
1740
|
-
starting_items=
|
|
1887
|
+
starting_items=(
|
|
1888
|
+
await starting_gear(store, campaign.branch_id) if pc is not None else None
|
|
1889
|
+
),
|
|
1741
1890
|
ruleset_id=campaign.ruleset_id,
|
|
1742
1891
|
)
|
|
1743
1892
|
finally:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|