delos-cli 5.9.32__tar.gz → 5.9.67__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.
- {delos_cli-5.9.32 → delos_cli-5.9.67}/.gitignore +4 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/PKG-INFO +10 -1
- {delos_cli-5.9.32 → delos_cli-5.9.67}/README.md +9 -0
- delos_cli-5.9.67/delos_cli/_build.json +5 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/apps/chat/app.py +8 -6
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/main.py +36 -0
- delos_cli-5.9.67/delos_cli/update.py +71 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/usage_report.py +22 -16
- {delos_cli-5.9.32 → delos_cli-5.9.67}/pyproject.toml +1 -1
- delos_cli-5.9.67/tests/test_chat_models.py +30 -0
- delos_cli-5.9.67/tests/test_update.py +76 -0
- delos_cli-5.9.67/tests/ui/test_usage_report.py +30 -0
- delos_cli-5.9.32/delos_cli/_build.json +0 -5
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/__main__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/agent/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/agent/session.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/agent/tools.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/agent/transport.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/agent/turn.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/apps/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/apps/base.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/apps/chat/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/apps/chat/commands.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/apps/chat/render.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/apps/chat/rewind.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/apps/replay.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/auth/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/auth/config.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/auth/mfa.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/auth/oauth.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/auth/token_manager.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/checkpoints.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/commands/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/commands/base.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/commands/builtin.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/commands/mcp.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/commands/permissions.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/commands/prompts.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/commands/sandbox.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/context_report.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/ctx.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/file_state.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/git_context.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/hooks.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/loop.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/mcp/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/mcp/client.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/mcp/config.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/mcp/handlers.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/mcp/landing.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/mcp/manager.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/mcp/remote.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/mcp/state.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/permissions.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/project_context.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/public_key.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/sandbox/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/sandbox/approval.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/sandbox/bwrap.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/sandbox/config.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/sandbox/core.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/sandbox/denial.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/sandbox/platform.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/sandbox/policy.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/sandbox/seatbelt.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/sandbox/seatbelt.sbpl +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/sandbox/seatbelt_network.sbpl +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/sentry_identity.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/serve/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/serve/app.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/serve/confirm.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/serve/protocol.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/serve/rpc.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/serve/server.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/settings.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/skills.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/state.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/telemetry.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/tool_output.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/tools/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/tools/ask_user_input.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/tools/edit_content.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/tools/explore.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/tools/glob_tool.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/tools/grep.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/tools/read.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/tools/run_shell.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/tools/task.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/tools/todo_write.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/tools/verify.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/tools/write_content.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/transport/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/transport/chats.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/transport/client.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/transport/conversation_rows.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/transport/documents.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/transport/integrations.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/transport/models.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/ui/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/ui/banner.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/ui/chat_picker.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/ui/collapse.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/ui/completer.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/ui/lexer.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/ui/model_picker.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/ui/output.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/ui/repl.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/delos_cli/ui/style.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/agent/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/agent/test_hooks.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/agent/test_steering.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/conftest.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/context/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/context/test_checkpoints.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/context/test_permissions.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/context/test_project_context.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/context/test_skills.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/mcp/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/mcp/fake_server.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/mcp/test_client.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/mcp/test_manager.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/mcp/test_remote.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/sandbox/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/sandbox/test_approval.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/sandbox/test_bwrap.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/sandbox/test_config.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/sandbox/test_denial.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/sandbox/test_integration.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/sandbox/test_platform.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/sandbox/test_policy.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/sandbox/test_seatbelt.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/serve/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/serve/test_confirm.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/serve/test_steer.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/tools/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/tools/test_file_state.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/tools/test_run_shell.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/tools/test_tool_output.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/ui/__init__.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/ui/test_steering_keys.py +0 -0
- {delos_cli-5.9.32 → delos_cli-5.9.67}/tests/ui/test_transcript_view.py +0 -0
|
@@ -36,6 +36,7 @@ backend/scripts/*
|
|
|
36
36
|
!backend/scripts/dump_openapi.py
|
|
37
37
|
!backend/scripts/backfill_agent_issues.py
|
|
38
38
|
!backend/scripts/backfill_directive_recurrence.py
|
|
39
|
+
!backend/scripts/backfill_google_series_end.py
|
|
39
40
|
!backend/scripts/analyze_prompt_dumps.py
|
|
40
41
|
!backend/scripts/check_route_response_types.py
|
|
41
42
|
!backend/scripts/check_usage_export.py
|
|
@@ -203,6 +204,9 @@ __pycache__/
|
|
|
203
204
|
# Supabase CLI local link state (project ref, pooler URL, remote versions).
|
|
204
205
|
# Rewritten by every `supabase link`, and belongs to a machine, not to the repo.
|
|
205
206
|
**/supabase/.temp/
|
|
207
|
+
|
|
208
|
+
# A local pg_dump of the model deployments, provider API keys included — never committed
|
|
209
|
+
/apps/web/supabase/seed.sensitive.sql
|
|
206
210
|
apps/workers-mobile/eas-asc-key.p8
|
|
207
211
|
|
|
208
212
|
# backfill_fts.py keyset cursor (local run state)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: delos-cli
|
|
3
|
-
Version: 5.9.
|
|
3
|
+
Version: 5.9.67
|
|
4
4
|
Summary: Terminal REPL for the Delos agent — the Claude-Code-style CLI for Delos.
|
|
5
5
|
Project-URL: Homepage, https://delos.so
|
|
6
6
|
Project-URL: Repository, https://github.com/Delos-Intelligence/cosmos-saas
|
|
@@ -52,6 +52,15 @@ Or with pipx:
|
|
|
52
52
|
pipx install delos-cli
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
+
## Update
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
delos update
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Reinstalls the latest release with the tool that installed it (uv or pipx),
|
|
62
|
+
on the Python version that release requires.
|
|
63
|
+
|
|
55
64
|
## Sign in
|
|
56
65
|
|
|
57
66
|
```bash
|
|
@@ -18,6 +18,15 @@ Or with pipx:
|
|
|
18
18
|
pipx install delos-cli
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
## Update
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
delos update
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Reinstalls the latest release with the tool that installed it (uv or pipx),
|
|
28
|
+
on the Python version that release requires.
|
|
29
|
+
|
|
21
30
|
## Sign in
|
|
22
31
|
|
|
23
32
|
```bash
|
|
@@ -72,6 +72,10 @@ if TYPE_CHECKING:
|
|
|
72
72
|
from delos_cli.transport.client import AuthedClient
|
|
73
73
|
from delos_cli.ui.output import OutputBuffer
|
|
74
74
|
|
|
75
|
+
#: Maestro, the model new chats start on: the Gate group the backend also falls
|
|
76
|
+
#: back to when a chat names no model, as VS Code's Maestro does.
|
|
77
|
+
MAESTRO_ID = "group_mezzo_vision"
|
|
78
|
+
|
|
75
79
|
|
|
76
80
|
def default_tool_registry() -> ToolRegistry:
|
|
77
81
|
"""Pre-wired registry: client tools the backend can call out of the box."""
|
|
@@ -147,13 +151,11 @@ class ChatApp(App):
|
|
|
147
151
|
_current_session: AgentSession | None = field(default=None, init=False, repr=False)
|
|
148
152
|
|
|
149
153
|
async def refresh_models(self, http: AuthedClient) -> None:
|
|
150
|
-
"""Load the ``cli`` picker:
|
|
154
|
+
"""Load the ``cli`` picker: Maestro first, then the picker's ids and Gate titles; new chats start on Maestro."""
|
|
151
155
|
models = await fetch_picker_models(http)
|
|
152
|
-
self.available_models = [m["id"] for m in models]
|
|
153
|
-
self.model_titles = {m["id"]: m["title"] for m in models if m["title"]}
|
|
154
|
-
|
|
155
|
-
first = top or (models[0] if models else None)
|
|
156
|
-
self.default_model = first["id"] if first else None
|
|
156
|
+
self.available_models = [MAESTRO_ID, *(m["id"] for m in models if m["id"] != MAESTRO_ID)]
|
|
157
|
+
self.model_titles = {m["id"]: m["title"] for m in models if m["title"]} | {MAESTRO_ID: "Maestro"}
|
|
158
|
+
self.default_model = MAESTRO_ID
|
|
157
159
|
|
|
158
160
|
@property
|
|
159
161
|
def busy(self) -> bool:
|
|
@@ -4,15 +4,19 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import asyncio
|
|
6
6
|
import functools
|
|
7
|
+
import shutil
|
|
8
|
+
import subprocess
|
|
7
9
|
from pathlib import Path
|
|
8
10
|
from typing import TYPE_CHECKING, Annotated, Any
|
|
9
11
|
|
|
12
|
+
import httpx
|
|
10
13
|
import questionary
|
|
11
14
|
import typer
|
|
12
15
|
from rich.console import Console
|
|
13
16
|
from rich.text import Text
|
|
14
17
|
|
|
15
18
|
from . import __version__, version_string
|
|
19
|
+
from . import update as update_mod
|
|
16
20
|
from .apps import ChatApp
|
|
17
21
|
from .auth import config as cfg_mod
|
|
18
22
|
from .auth.oauth import OAuthError, run_login_flow
|
|
@@ -396,6 +400,38 @@ def version() -> None:
|
|
|
396
400
|
console.print(Text(version_string()))
|
|
397
401
|
|
|
398
402
|
|
|
403
|
+
@app.command()
|
|
404
|
+
def update() -> None:
|
|
405
|
+
"""Update the CLI to the latest release."""
|
|
406
|
+
tool = update_mod.installer()
|
|
407
|
+
if tool == "editable":
|
|
408
|
+
console.print(Text("Running from a cosmos-saas checkout — update it with git pull.", style="yellow"))
|
|
409
|
+
return
|
|
410
|
+
if tool == "bundled":
|
|
411
|
+
console.print(Text("This CLI ships with the Delos VS Code extension — update the extension.", style="yellow"))
|
|
412
|
+
return
|
|
413
|
+
try:
|
|
414
|
+
release = update_mod.latest_release()
|
|
415
|
+
except httpx.HTTPError as e:
|
|
416
|
+
console.print(Text(f"Could not reach PyPI: {e}", style="red"))
|
|
417
|
+
raise typer.Exit(code=1) from e
|
|
418
|
+
if release.version == __version__:
|
|
419
|
+
console.print(Text(f"delos-cli {__version__} is already the latest release.", style="green"))
|
|
420
|
+
return
|
|
421
|
+
command = update_mod.upgrade_command(tool, release)
|
|
422
|
+
if command is None or shutil.which(command[0]) is None:
|
|
423
|
+
console.print(Text(f"delos-cli {release.version} is out (you have {__version__}).", style="yellow"))
|
|
424
|
+
console.print(Text("Reinstall it with the tool that installed it, e.g.:", style="dim"))
|
|
425
|
+
console.print(Text(" ".join(update_mod.upgrade_command("uv", release) or []), style="bold"))
|
|
426
|
+
raise typer.Exit(code=1)
|
|
427
|
+
console.print(Text(f"Updating delos-cli {__version__} → {release.version}", style="dim"))
|
|
428
|
+
console.print(Text(" ".join(command), style="dim"))
|
|
429
|
+
code = subprocess.run(command, check=False).returncode
|
|
430
|
+
if code != 0:
|
|
431
|
+
raise typer.Exit(code=code)
|
|
432
|
+
console.print(Text(f"delos-cli {release.version} installed.", style="green"))
|
|
433
|
+
|
|
434
|
+
|
|
399
435
|
_PICKER_STYLE = questionary.Style(
|
|
400
436
|
[
|
|
401
437
|
("qmark", "fg:ansicyan"),
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""``delos update`` — bring the CLI to the latest release, through whatever installed it.
|
|
2
|
+
|
|
3
|
+
A reinstall pinned to the release, never ``uv tool upgrade``: ``requires-python``
|
|
4
|
+
is an exact pin that moves between releases, and an upgrade inside a tool env
|
|
5
|
+
built on the old Python silently keeps the old version. The release's own pin
|
|
6
|
+
picks the interpreter instead.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import re
|
|
12
|
+
import sys
|
|
13
|
+
from dataclasses import dataclass
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
from typing import Literal
|
|
16
|
+
|
|
17
|
+
import httpx
|
|
18
|
+
|
|
19
|
+
from delos_cli import _editable_source_dir
|
|
20
|
+
|
|
21
|
+
PYPI_URL = "https://pypi.org/pypi/delos-cli/json"
|
|
22
|
+
|
|
23
|
+
type Installer = Literal["editable", "bundled", "uv", "pipx", "unknown"]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dataclass(frozen=True)
|
|
27
|
+
class Release:
|
|
28
|
+
"""The latest delos-cli on PyPI, and the Python minor version it pins (``3.14``), if any."""
|
|
29
|
+
|
|
30
|
+
version: str
|
|
31
|
+
python: str | None
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def latest_release() -> Release:
|
|
35
|
+
"""Ask PyPI for the latest release."""
|
|
36
|
+
response = httpx.get(PYPI_URL, timeout=15, follow_redirects=True)
|
|
37
|
+
response.raise_for_status()
|
|
38
|
+
info = response.json()["info"]
|
|
39
|
+
return Release(version=info["version"], python=pinned_python(info.get("requires_python") or ""))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def pinned_python(requires_python: str) -> str | None:
|
|
43
|
+
"""``==3.14.*`` → ``3.14``; None when the release names no exact minor version."""
|
|
44
|
+
match = re.search(r"==\s*(\d+\.\d+)", requires_python)
|
|
45
|
+
return match.group(1) if match else None
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def installer(prefix: Path | None = None) -> Installer:
|
|
49
|
+
"""What installed the running CLI, read from its environment's layout."""
|
|
50
|
+
if _editable_source_dir() is not None:
|
|
51
|
+
return "editable"
|
|
52
|
+
prefix = (prefix or Path(sys.prefix)).resolve()
|
|
53
|
+
# The VS Code extension ships its own interpreter under ``<extension>/runtime/``.
|
|
54
|
+
if any(p.name == "runtime" and (p / "manifest.json").is_file() for p in (prefix, *prefix.parents)):
|
|
55
|
+
return "bundled"
|
|
56
|
+
if (prefix / "uv-receipt.toml").is_file():
|
|
57
|
+
return "uv"
|
|
58
|
+
if (prefix / "pipx_metadata.json").is_file():
|
|
59
|
+
return "pipx"
|
|
60
|
+
return "unknown"
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def upgrade_command(tool: Installer, release: Release) -> list[str] | None:
|
|
64
|
+
"""The command that reinstalls ``release`` with ``tool``; None when the CLI cannot update itself."""
|
|
65
|
+
python = ["--python", release.python] if release.python is not None else []
|
|
66
|
+
spec = f"delos-cli=={release.version}"
|
|
67
|
+
if tool == "uv":
|
|
68
|
+
return ["uv", "tool", "install", "--force", *python, spec]
|
|
69
|
+
if tool == "pipx":
|
|
70
|
+
return ["pipx", "install", "--force", *python, spec]
|
|
71
|
+
return None
|
|
@@ -59,6 +59,20 @@ def _credits_utilization(credit_info: dict[str, Any]) -> float | None:
|
|
|
59
59
|
return min(1.0, float(bags_consumed) / total)
|
|
60
60
|
|
|
61
61
|
|
|
62
|
+
def _source_parts(credit_info: dict[str, Any]) -> list[str]:
|
|
63
|
+
"""Where the credits come from; nothing for unlimited ones (their amounts are no balance)."""
|
|
64
|
+
if credit_info.get("unlimited"):
|
|
65
|
+
return []
|
|
66
|
+
from_sub = float(credit_info.get("from_subscription") or 0)
|
|
67
|
+
from_bags = float(credit_info.get("from_bags") or 0)
|
|
68
|
+
parts: list[str] = []
|
|
69
|
+
if from_sub:
|
|
70
|
+
parts.append(f"{_fmt_credits(from_sub)} from subscription")
|
|
71
|
+
if from_bags:
|
|
72
|
+
parts.append(f"{_fmt_credits(from_bags)} from bags")
|
|
73
|
+
return parts
|
|
74
|
+
|
|
75
|
+
|
|
62
76
|
def _reset_line() -> str:
|
|
63
77
|
"""Claude-style reset copy with the first of next month."""
|
|
64
78
|
now = datetime.now(UTC)
|
|
@@ -84,7 +98,9 @@ def render_usage(report: dict[str, Any]) -> Text:
|
|
|
84
98
|
text = Text()
|
|
85
99
|
text.append("Usage\n", style="bold")
|
|
86
100
|
text.append(f"Credits ({scope})\n", style="bold")
|
|
87
|
-
if
|
|
101
|
+
if credit_info.get("unlimited"):
|
|
102
|
+
text.append("Unlimited\n", style="bold")
|
|
103
|
+
elif util is not None:
|
|
88
104
|
bar_style = "red" if util >= 0.9 else "yellow" if util > 0.5 else "green" # noqa: PLR2004
|
|
89
105
|
text.append(_bar(util), style=bar_style)
|
|
90
106
|
text.append(f" {util:.0%} used", style="bold")
|
|
@@ -92,13 +108,7 @@ def render_usage(report: dict[str, Any]) -> Text:
|
|
|
92
108
|
else:
|
|
93
109
|
text.append(f"{_fmt_credits(remaining)} remaining\n", style="bold")
|
|
94
110
|
|
|
95
|
-
|
|
96
|
-
from_bags = float(credit_info.get("from_bags") or 0)
|
|
97
|
-
parts: list[str] = []
|
|
98
|
-
if from_sub:
|
|
99
|
-
parts.append(f"{_fmt_credits(from_sub)} from subscription")
|
|
100
|
-
if from_bags:
|
|
101
|
-
parts.append(f"{_fmt_credits(from_bags)} from bags")
|
|
111
|
+
parts = _source_parts(credit_info)
|
|
102
112
|
if parts:
|
|
103
113
|
text.append(" · ".join(parts) + "\n", style="dim")
|
|
104
114
|
|
|
@@ -138,20 +148,16 @@ def format_usage_markdown(report: dict[str, Any]) -> str:
|
|
|
138
148
|
"",
|
|
139
149
|
f"**Credits** (`{scope}`)",
|
|
140
150
|
]
|
|
141
|
-
if
|
|
151
|
+
if credit_info.get("unlimited"):
|
|
152
|
+
lines.append("**Unlimited**")
|
|
153
|
+
elif util is not None:
|
|
142
154
|
lines.append(
|
|
143
155
|
f"`{_bar(util)}` **{util:.0%} used** — {_fmt_credits(remaining)} remaining",
|
|
144
156
|
)
|
|
145
157
|
else:
|
|
146
158
|
lines.append(f"**{_fmt_credits(remaining)} remaining**")
|
|
147
159
|
|
|
148
|
-
|
|
149
|
-
from_bags = float(credit_info.get("from_bags") or 0)
|
|
150
|
-
parts: list[str] = []
|
|
151
|
-
if from_sub:
|
|
152
|
-
parts.append(f"{_fmt_credits(from_sub)} from subscription")
|
|
153
|
-
if from_bags:
|
|
154
|
-
parts.append(f"{_fmt_credits(from_bags)} from bags")
|
|
160
|
+
parts = _source_parts(credit_info)
|
|
155
161
|
if parts:
|
|
156
162
|
lines.append(" · ".join(parts))
|
|
157
163
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""The chat's model list: Maestro first, and the model new chats start on."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
from unittest.mock import MagicMock
|
|
7
|
+
|
|
8
|
+
import pytest
|
|
9
|
+
|
|
10
|
+
from delos_cli.apps.chat import app as chat_app
|
|
11
|
+
from delos_cli.apps.chat.app import MAESTRO_ID, ChatApp
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@pytest.mark.asyncio
|
|
15
|
+
async def test_new_chats_start_on_maestro(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
16
|
+
picker = [
|
|
17
|
+
{"id": "gpt-6.1-sol", "title": "GPT-6.1 Sol", "top": True},
|
|
18
|
+
{"id": "claude-5.5-sonnet", "title": "Claude Sonnet 5.5", "top": False},
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
async def fetch(_http: Any) -> list[dict[str, Any]]:
|
|
22
|
+
return picker
|
|
23
|
+
|
|
24
|
+
monkeypatch.setattr(chat_app, "fetch_picker_models", fetch)
|
|
25
|
+
app = ChatApp()
|
|
26
|
+
await app.refresh_models(MagicMock())
|
|
27
|
+
assert app.default_model == MAESTRO_ID
|
|
28
|
+
assert app.available_models == [MAESTRO_ID, "gpt-6.1-sol", "claude-5.5-sonnet"]
|
|
29
|
+
assert app.model_label(MAESTRO_ID) == "Maestro"
|
|
30
|
+
assert app.model_label("gpt-6.1-sol") == "GPT-6.1 Sol"
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""``delos update``: which tool installed the CLI, and the reinstall it runs."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
|
|
9
|
+
from delos_cli import update
|
|
10
|
+
from delos_cli.update import Release, installer, pinned_python, upgrade_command
|
|
11
|
+
|
|
12
|
+
if TYPE_CHECKING:
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@pytest.fixture(autouse=True)
|
|
17
|
+
def _not_editable(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
18
|
+
"""The tests run from the repo checkout, which would read as editable."""
|
|
19
|
+
monkeypatch.setattr(update, "_editable_source_dir", lambda: None)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_a_uv_tool_env_holds_a_receipt(tmp_path: Path) -> None:
|
|
23
|
+
(tmp_path / "uv-receipt.toml").write_text("")
|
|
24
|
+
assert installer(tmp_path) == "uv"
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_a_pipx_venv_holds_its_metadata(tmp_path: Path) -> None:
|
|
28
|
+
(tmp_path / "pipx_metadata.json").write_text("{}")
|
|
29
|
+
assert installer(tmp_path) == "pipx"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def test_the_vscode_runtime_is_the_extensions(tmp_path: Path) -> None:
|
|
33
|
+
runtime = tmp_path / "delos-so.delos-cosmos-5.9.59" / "runtime"
|
|
34
|
+
prefix = runtime / "python"
|
|
35
|
+
prefix.mkdir(parents=True)
|
|
36
|
+
(runtime / "manifest.json").write_text("{}")
|
|
37
|
+
assert installer(prefix) == "bundled"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_anything_else_is_unknown(tmp_path: Path) -> None:
|
|
41
|
+
assert installer(tmp_path) == "unknown"
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def test_the_checkout_is_editable(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
|
|
45
|
+
monkeypatch.setattr(update, "_editable_source_dir", lambda: tmp_path)
|
|
46
|
+
assert installer(tmp_path) == "editable"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@pytest.mark.parametrize(
|
|
50
|
+
("requires", "expected"),
|
|
51
|
+
[("==3.14.*", "3.14"), ("== 3.12.*", "3.12"), (">=3.12", None), ("", None)],
|
|
52
|
+
)
|
|
53
|
+
def test_the_pinned_python(requires: str, expected: str | None) -> None:
|
|
54
|
+
assert pinned_python(requires) == expected
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def test_uv_reinstalls_the_release_on_its_python() -> None:
|
|
58
|
+
"""Never ``uv tool upgrade``: it keeps the old version when the Python pin moved."""
|
|
59
|
+
assert upgrade_command("uv", Release("5.9.59", "3.14")) == [
|
|
60
|
+
"uv",
|
|
61
|
+
"tool",
|
|
62
|
+
"install",
|
|
63
|
+
"--force",
|
|
64
|
+
"--python",
|
|
65
|
+
"3.14",
|
|
66
|
+
"delos-cli==5.9.59",
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def test_pipx_reinstalls_the_release() -> None:
|
|
71
|
+
assert upgrade_command("pipx", Release("5.9.59", None)) == ["pipx", "install", "--force", "delos-cli==5.9.59"]
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@pytest.mark.parametrize("tool", ["editable", "bundled", "unknown"])
|
|
75
|
+
def test_the_others_cannot_update_themselves(tool: update.Installer) -> None:
|
|
76
|
+
assert upgrade_command(tool, Release("5.9.59", "3.14")) is None
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""``/usage``: the credits the backend reports, "Unlimited" when its read says so."""
|
|
2
|
+
|
|
3
|
+
from delos_cli.usage_report import format_usage_markdown, render_usage
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def _report(**credits: object) -> dict:
|
|
7
|
+
return {
|
|
8
|
+
"scope": "standard",
|
|
9
|
+
"credits": {"remaining": 1_234, "bags_total": 5_000, "bags_consumed": 3_766, **credits},
|
|
10
|
+
"license": None,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_usage_shows_the_remaining_credits_and_what_is_used() -> None:
|
|
15
|
+
markdown = format_usage_markdown(_report())
|
|
16
|
+
|
|
17
|
+
assert "**75% used** — 1,234 remaining" in markdown
|
|
18
|
+
assert "1,234 remaining" in render_usage(_report()).plain
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_unlimited_credits_say_so_instead_of_a_number() -> None:
|
|
22
|
+
report = _report(remaining=1_000_000, bags_total=1_000_000, bags_consumed=0, unlimited=True)
|
|
23
|
+
|
|
24
|
+
markdown = format_usage_markdown(report)
|
|
25
|
+
plain = render_usage(report).plain
|
|
26
|
+
|
|
27
|
+
assert "**Unlimited**" in markdown
|
|
28
|
+
assert "1,000,000" not in markdown
|
|
29
|
+
assert "Unlimited" in plain
|
|
30
|
+
assert "1,000,000" not in plain
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|