delos-cli 5.9.30__tar.gz → 5.9.59__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.30 → delos_cli-5.9.59}/.gitignore +4 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/PKG-INFO +1 -1
- delos_cli-5.9.59/delos_cli/_build.json +5 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/tools/ask_user_input.py +7 -13
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/tools/edit_content.py +4 -7
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/tools/todo_write.py +4 -7
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/usage_report.py +22 -16
- {delos_cli-5.9.30 → delos_cli-5.9.59}/pyproject.toml +1 -1
- delos_cli-5.9.59/tests/ui/test_usage_report.py +30 -0
- delos_cli-5.9.30/delos_cli/_build.json +0 -5
- {delos_cli-5.9.30 → delos_cli-5.9.59}/README.md +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/__main__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/agent/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/agent/session.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/agent/tools.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/agent/transport.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/agent/turn.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/apps/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/apps/base.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/apps/chat/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/apps/chat/app.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/apps/chat/commands.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/apps/chat/render.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/apps/chat/rewind.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/apps/replay.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/auth/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/auth/config.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/auth/mfa.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/auth/oauth.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/auth/token_manager.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/checkpoints.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/commands/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/commands/base.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/commands/builtin.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/commands/mcp.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/commands/permissions.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/commands/prompts.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/commands/sandbox.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/context_report.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/ctx.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/file_state.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/git_context.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/hooks.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/loop.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/main.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/mcp/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/mcp/client.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/mcp/config.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/mcp/handlers.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/mcp/landing.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/mcp/manager.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/mcp/remote.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/mcp/state.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/permissions.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/project_context.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/public_key.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/sandbox/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/sandbox/approval.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/sandbox/bwrap.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/sandbox/config.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/sandbox/core.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/sandbox/denial.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/sandbox/platform.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/sandbox/policy.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/sandbox/seatbelt.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/sandbox/seatbelt.sbpl +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/sandbox/seatbelt_network.sbpl +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/sentry_identity.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/serve/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/serve/app.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/serve/confirm.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/serve/protocol.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/serve/rpc.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/serve/server.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/settings.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/skills.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/state.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/telemetry.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/tool_output.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/tools/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/tools/explore.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/tools/glob_tool.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/tools/grep.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/tools/read.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/tools/run_shell.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/tools/task.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/tools/verify.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/tools/write_content.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/transport/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/transport/chats.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/transport/client.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/transport/conversation_rows.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/transport/documents.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/transport/integrations.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/transport/models.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/ui/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/ui/banner.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/ui/chat_picker.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/ui/collapse.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/ui/completer.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/ui/lexer.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/ui/model_picker.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/ui/output.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/ui/repl.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/delos_cli/ui/style.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/agent/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/agent/test_hooks.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/agent/test_steering.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/conftest.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/context/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/context/test_checkpoints.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/context/test_permissions.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/context/test_project_context.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/context/test_skills.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/mcp/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/mcp/fake_server.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/mcp/test_client.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/mcp/test_manager.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/mcp/test_remote.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/sandbox/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/sandbox/test_approval.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/sandbox/test_bwrap.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/sandbox/test_config.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/sandbox/test_denial.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/sandbox/test_integration.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/sandbox/test_platform.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/sandbox/test_policy.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/sandbox/test_seatbelt.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/serve/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/serve/test_confirm.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/serve/test_steer.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/tools/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/tools/test_file_state.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/tools/test_run_shell.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/tools/test_tool_output.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/ui/__init__.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/tests/ui/test_steering_keys.py +0 -0
- {delos_cli-5.9.30 → delos_cli-5.9.59}/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.59
|
|
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
|
|
@@ -22,7 +22,7 @@ across the chat, CLI, and VSCode surfaces.
|
|
|
22
22
|
|
|
23
23
|
from __future__ import annotations
|
|
24
24
|
|
|
25
|
-
from typing import TYPE_CHECKING, Any
|
|
25
|
+
from typing import TYPE_CHECKING, Any
|
|
26
26
|
|
|
27
27
|
from rich.text import Text
|
|
28
28
|
|
|
@@ -43,20 +43,17 @@ def _validate(questions: Any) -> str | None:
|
|
|
43
43
|
for idx, entry in enumerate(questions):
|
|
44
44
|
if not isinstance(entry, dict):
|
|
45
45
|
return f"Error: questions[{idx}] must be an object."
|
|
46
|
-
|
|
47
|
-
# ``dict[Unknown, Unknown]`` whose ``.get`` rejects string keys.
|
|
48
|
-
q = cast("dict[str, Any]", entry)
|
|
49
|
-
qtype = q.get("type")
|
|
46
|
+
qtype = entry.get("type")
|
|
50
47
|
if qtype not in _VALID_TYPES:
|
|
51
48
|
return f"Error: questions[{idx}].type must be one of {sorted(_VALID_TYPES)}, got {qtype!r}."
|
|
52
|
-
question_text =
|
|
49
|
+
question_text = entry.get("question")
|
|
53
50
|
if not isinstance(question_text, str) or not question_text.strip():
|
|
54
51
|
return f"Error: questions[{idx}].question must be a non-empty string."
|
|
55
|
-
label =
|
|
52
|
+
label = entry.get("label")
|
|
56
53
|
if label is not None and not isinstance(label, str):
|
|
57
54
|
return f"Error: questions[{idx}].label must be a string when provided."
|
|
58
55
|
if qtype in {"single_select", "multi_select"}:
|
|
59
|
-
options =
|
|
56
|
+
options = entry.get("options")
|
|
60
57
|
if not isinstance(options, list) or not options:
|
|
61
58
|
return f"Error: questions[{idx}].options must be a non-empty list for type {qtype!r}."
|
|
62
59
|
return None
|
|
@@ -64,14 +61,11 @@ def _validate(questions: Any) -> str | None:
|
|
|
64
61
|
|
|
65
62
|
async def handle_ask_user_input(tool_input: dict[str, Any], ctx: Ctx) -> str:
|
|
66
63
|
"""Resolve an ``ask_user_input`` call: validate, prompt, format answers."""
|
|
67
|
-
raw_questions = tool_input.get("questions")
|
|
64
|
+
raw_questions = tool_input.get("questions", [])
|
|
68
65
|
error = _validate(raw_questions)
|
|
69
66
|
if error:
|
|
70
67
|
return error
|
|
71
|
-
|
|
72
|
-
# non-empty list of well-formed question dicts — ty can't narrow
|
|
73
|
-
# across the helper call, so make it explicit.
|
|
74
|
-
questions = cast("list[dict[str, Any]]", raw_questions)
|
|
68
|
+
questions: list[dict[str, Any]] = raw_questions
|
|
75
69
|
|
|
76
70
|
if ctx.ask_user_input is None:
|
|
77
71
|
sink = ctx.output if ctx.output is not None else ctx.console
|
|
@@ -38,7 +38,7 @@ from __future__ import annotations
|
|
|
38
38
|
import difflib
|
|
39
39
|
import re
|
|
40
40
|
from pathlib import Path
|
|
41
|
-
from typing import TYPE_CHECKING, Any
|
|
41
|
+
from typing import TYPE_CHECKING, Any
|
|
42
42
|
|
|
43
43
|
from rich.console import Group
|
|
44
44
|
from rich.padding import Padding
|
|
@@ -131,18 +131,15 @@ def _parse_edits(tool_input: dict[str, Any]) -> list[tuple[str, str, bool]] | st
|
|
|
131
131
|
for idx, entry in enumerate(raw_edits):
|
|
132
132
|
if not isinstance(entry, dict):
|
|
133
133
|
return f"Error: edits[{idx}] must be an object."
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
item = cast("dict[str, Any]", entry)
|
|
137
|
-
old = item.get("old_content")
|
|
138
|
-
new = item.get("new_content")
|
|
134
|
+
old = entry.get("old_content")
|
|
135
|
+
new = entry.get("new_content")
|
|
139
136
|
if not isinstance(old, str) or not isinstance(new, str):
|
|
140
137
|
return f"Error: edits[{idx}] must have string 'old_content' and 'new_content'."
|
|
141
138
|
if not old:
|
|
142
139
|
return f"Error: edits[{idx}].old_content is empty. Use a non-empty pivot string."
|
|
143
140
|
if old == new:
|
|
144
141
|
return f"Error: edits[{idx}] — old_content and new_content are identical."
|
|
145
|
-
pairs.append((old, new,
|
|
142
|
+
pairs.append((old, new, entry.get("replace_all") is True))
|
|
146
143
|
return pairs
|
|
147
144
|
|
|
148
145
|
if not isinstance(old_content, str) or not isinstance(new_content, str):
|
|
@@ -21,7 +21,7 @@ they're feedback the agent should learn from, not exceptions.
|
|
|
21
21
|
|
|
22
22
|
from __future__ import annotations
|
|
23
23
|
|
|
24
|
-
from typing import TYPE_CHECKING, Any,
|
|
24
|
+
from typing import TYPE_CHECKING, Any, get_args
|
|
25
25
|
|
|
26
26
|
from delos_cli.state import TodoItem, TodoStatus, TodoStore
|
|
27
27
|
|
|
@@ -51,12 +51,9 @@ async def handle_todo_write(tool_input: dict[str, Any], ctx: Ctx) -> str:
|
|
|
51
51
|
for idx, entry in enumerate(raw):
|
|
52
52
|
if not isinstance(entry, dict):
|
|
53
53
|
return f"Error: todos[{idx}] must be an object."
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
tid = item.get("id")
|
|
58
|
-
content = item.get("content")
|
|
59
|
-
status = item.get("status")
|
|
54
|
+
tid = entry.get("id")
|
|
55
|
+
content = entry.get("content")
|
|
56
|
+
status = entry.get("status")
|
|
60
57
|
if not isinstance(tid, str) or not tid:
|
|
61
58
|
return f"Error: todos[{idx}].id must be a non-empty string."
|
|
62
59
|
if tid in seen_ids:
|
|
@@ -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
|
+
"""``/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
|