qbraid-cli 0.17.1__tar.gz → 0.17.3__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.
- {qbraid_cli-0.17.1/qbraid_cli.egg-info → qbraid_cli-0.17.3}/PKG-INFO +4 -4
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/pyproject.toml +7 -4
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/agents/app.py +345 -14
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/ai/token.py +24 -3
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/artifacts/app.py +42 -5
- qbraid_cli-0.17.3/qbraid_cli/artifacts/mermaid.py +202 -0
- qbraid_cli-0.17.3/qbraid_cli/artifacts/pele.LICENSE +40 -0
- qbraid_cli-0.17.3/qbraid_cli/artifacts/pele.global.js +150 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/envs/registry.py +28 -14
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3/qbraid_cli.egg-info}/PKG-INFO +4 -4
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli.egg-info/SOURCES.txt +3 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli.egg-info/requires.txt +3 -3
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/LICENSE +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/README.md +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/__init__.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/_build_info.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/_version.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/account/__init__.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/account/app.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/admin/__init__.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/admin/app.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/admin/headers.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/admin/validation.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/agents/__init__.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/agents/keep_alive.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/agents/permission_response.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/agents/provider_children.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/agents/queue.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/agents/work.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/ai/__init__.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/ai/app.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/artifacts/__init__.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/comms/__init__.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/comms/app.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/compute/__init__.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/compute/app.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/compute/instances.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/compute/profiles.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/compute/server.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/compute/ssh.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/configure/__init__.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/configure/actions.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/configure/app.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/devices/__init__.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/devices/app.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/devices/validation.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/envs/__init__.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/envs/activate.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/envs/app.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/envs/create.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/envs/data_handling.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/envs/groups.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/envs/publish.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/envs/share.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/exceptions.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/handlers.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/jobs/__init__.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/jobs/app.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/jobs/groups.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/kernels/__init__.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/kernels/app.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/lab/__init__.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/lab/app.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/main.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/pip/__init__.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/pip/app.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/pip/hooks.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/projects/__init__.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/projects/app.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/py.typed +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/skills/__init__.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/skills/app.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/troubleshoot/__init__.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli/troubleshoot/app.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli.egg-info/dependency_links.txt +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli.egg-info/entry_points.txt +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/qbraid_cli.egg-info/top_level.txt +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/setup.cfg +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/tests/test_cli_e2e.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/tests/test_register_client.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/tests/test_status_colors.py +0 -0
- {qbraid_cli-0.17.1 → qbraid_cli-0.17.3}/tests/test_version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: qbraid-cli
|
|
3
|
-
Version: 0.17.
|
|
3
|
+
Version: 0.17.3
|
|
4
4
|
Summary: Command Line Interface for interacting with all parts of the qBraid platform.
|
|
5
5
|
Author-email: qBraid Development Team <contact@qbraid.com>
|
|
6
6
|
License-Expression: LicenseRef-Proprietary
|
|
@@ -30,11 +30,11 @@ Requires-Dist: typer>=0.12.1
|
|
|
30
30
|
Requires-Dist: rich>=10.11.0
|
|
31
31
|
Requires-Dist: click<=8.5.1
|
|
32
32
|
Requires-Dist: questionary>=2.0.0
|
|
33
|
-
Requires-Dist: qbraid-core>=0.6.
|
|
33
|
+
Requires-Dist: qbraid-core>=0.6.57
|
|
34
34
|
Provides-Extra: compute
|
|
35
|
-
Requires-Dist: qbraid-core[compute]>=0.6.
|
|
35
|
+
Requires-Dist: qbraid-core[compute]>=0.6.57; extra == "compute"
|
|
36
36
|
Provides-Extra: envs
|
|
37
|
-
Requires-Dist: qbraid-core[environments]>=0.6.
|
|
37
|
+
Requires-Dist: qbraid-core[environments]>=0.6.57; extra == "envs"
|
|
38
38
|
Provides-Extra: dev
|
|
39
39
|
Requires-Dist: isort; extra == "dev"
|
|
40
40
|
Requires-Dist: black; extra == "dev"
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "qbraid-cli"
|
|
7
|
-
version = "0.17.
|
|
7
|
+
version = "0.17.3"
|
|
8
8
|
description = "Command Line Interface for interacting with all parts of the qBraid platform."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [{ name = "qBraid Development Team", email = "contact@qbraid.com" }]
|
|
@@ -32,7 +32,7 @@ dependencies = [
|
|
|
32
32
|
"rich>=10.11.0",
|
|
33
33
|
"click<=8.5.1",
|
|
34
34
|
"questionary>=2.0.0",
|
|
35
|
-
"qbraid-core>=0.6.
|
|
35
|
+
"qbraid-core>=0.6.57",
|
|
36
36
|
]
|
|
37
37
|
requires-python = ">= 3.10"
|
|
38
38
|
|
|
@@ -43,8 +43,8 @@ Documentation = "https://docs.qbraid.com/v2/cli/api-reference/qbraid"
|
|
|
43
43
|
Discord = "https://discord.gg/KugF6Cnncm"
|
|
44
44
|
|
|
45
45
|
[project.optional-dependencies]
|
|
46
|
-
compute = ["qbraid-core[compute]>=0.6.
|
|
47
|
-
envs = ["qbraid-core[environments]>=0.6.
|
|
46
|
+
compute = ["qbraid-core[compute]>=0.6.57"]
|
|
47
|
+
envs = ["qbraid-core[environments]>=0.6.57"]
|
|
48
48
|
dev = ["isort", "black", "pytest", "pytest-cov", "pytest-asyncio"]
|
|
49
49
|
|
|
50
50
|
[project.scripts]
|
|
@@ -53,6 +53,9 @@ qbraid = "qbraid_cli.main:app"
|
|
|
53
53
|
# through the full CLI would import every command group to print one string.
|
|
54
54
|
qbraid-ai-token = "qbraid_cli.ai.token:main"
|
|
55
55
|
|
|
56
|
+
[tool.setuptools.package-data]
|
|
57
|
+
qbraid_cli = ["artifacts/pele.global.js", "artifacts/pele.LICENSE"]
|
|
58
|
+
|
|
56
59
|
[tool.black]
|
|
57
60
|
line-length = 110
|
|
58
61
|
target-version = ["py310", "py311", "py312", "py313"]
|
|
@@ -972,6 +972,10 @@ def agents_list(
|
|
|
972
972
|
for row, session in zip(output, sessions):
|
|
973
973
|
row["parent_agent_id"] = parents.get(session.session_id)
|
|
974
974
|
row["children"] = children.get(agent_of(session), [])
|
|
975
|
+
# How mail reaches each one now (qbraid-core wake_status); absent on older Core.
|
|
976
|
+
for row, wake in zip(output, _wakes_of(registry, sessions)):
|
|
977
|
+
if wake is not None:
|
|
978
|
+
row["wake_status"] = wake
|
|
975
979
|
print(json.dumps(output, indent=2))
|
|
976
980
|
return
|
|
977
981
|
|
|
@@ -2056,6 +2060,62 @@ class TrustTool(str, Enum):
|
|
|
2056
2060
|
CODEX = "codex"
|
|
2057
2061
|
|
|
2058
2062
|
|
|
2063
|
+
def _trust_folder_remote(compute: str, folder: Optional[str], tool: str, no: bool, json_output: bool) -> None:
|
|
2064
|
+
"""``trust-folder --compute``: the person's decision, recorded on the remote.
|
|
2065
|
+
|
|
2066
|
+
Person-only in the strict sense: an agent caller is refused, and a terminal
|
|
2067
|
+
is required (the question is asked here, never skipped with --yes), since a
|
|
2068
|
+
remote launch is always unattended and this is the one way to unblock
|
|
2069
|
+
NEEDS_TRUST_DECISION there. The remote runs its own ``trust-folder --yes
|
|
2070
|
+
--json``; its refusals (a folder above home, the root) come back as-is.
|
|
2071
|
+
"""
|
|
2072
|
+
import shlex # pylint: disable=import-outside-toplevel
|
|
2073
|
+
|
|
2074
|
+
if _caller_agent_reason() or _calling_session(_get_registry(), refuse_ambiguous=False):
|
|
2075
|
+
typer.echo("Only the person decides whether to trust a folder; an agent cannot.", err=True)
|
|
2076
|
+
raise typer.Exit(1)
|
|
2077
|
+
if _bad_alias(compute):
|
|
2078
|
+
typer.echo(f"--compute: invalid SSH alias {compute!r}.", err=True)
|
|
2079
|
+
raise typer.Exit(2)
|
|
2080
|
+
if not folder:
|
|
2081
|
+
typer.echo("--compute needs the remote folder to decide about.", err=True)
|
|
2082
|
+
raise typer.Exit(2)
|
|
2083
|
+
if folder.startswith("-") or any(ch in folder for ch in "\n\r\0"):
|
|
2084
|
+
typer.echo(f"Not a folder path: {folder!r}.", err=True)
|
|
2085
|
+
raise typer.Exit(2)
|
|
2086
|
+
if not _can_ask():
|
|
2087
|
+
typer.echo("Refusing to decide about a remote folder without a terminal to ask you.", err=True)
|
|
2088
|
+
raise typer.Exit(1)
|
|
2089
|
+
if no:
|
|
2090
|
+
question = f"Stop trusting {folder} on {compute}?"
|
|
2091
|
+
else:
|
|
2092
|
+
question = (
|
|
2093
|
+
f"Trust {folder} on {compute} for {tool}? Its own settings, hooks and MCP servers "
|
|
2094
|
+
"will run there without asking, including in unattended launches."
|
|
2095
|
+
)
|
|
2096
|
+
if not typer.confirm(question, default=False, err=True):
|
|
2097
|
+
typer.echo("Nothing changed.", err=True)
|
|
2098
|
+
raise typer.Exit(1)
|
|
2099
|
+
remote = f"qbraid agents trust-folder {shlex.quote(folder)} --tool {shlex.quote(tool)} --yes --json" + (
|
|
2100
|
+
" --no" if no else ""
|
|
2101
|
+
)
|
|
2102
|
+
stdout = _ssh_cmd(compute, remote)
|
|
2103
|
+
line = next((row for row in reversed(stdout.splitlines()) if row.strip().startswith("{")), "")
|
|
2104
|
+
try:
|
|
2105
|
+
result = json.loads(line)
|
|
2106
|
+
except ValueError:
|
|
2107
|
+
typer.echo(f"The remote recorded no decision ({compute}): {_remote_failure(stdout, '')}", err=True)
|
|
2108
|
+
raise typer.Exit(1) from None
|
|
2109
|
+
if json_output:
|
|
2110
|
+
print(json.dumps({**result, "compute": compute}))
|
|
2111
|
+
return
|
|
2112
|
+
shown = result.get("trustedAs") or result.get("folder") or folder
|
|
2113
|
+
if not result.get("trusted", not no):
|
|
2114
|
+
typer.echo(f"{shown} on {compute} is no longer trusted by your choice.")
|
|
2115
|
+
else:
|
|
2116
|
+
typer.echo(f"{shown} on {compute} is trusted for {tool}.")
|
|
2117
|
+
|
|
2118
|
+
|
|
2059
2119
|
@agents_app.command("trust-folder")
|
|
2060
2120
|
def agents_trust_folder(
|
|
2061
2121
|
folder: Optional[str] = typer.Argument(None, help="Folder to decide about (default: here)."),
|
|
@@ -2063,6 +2123,16 @@ def agents_trust_folder(
|
|
|
2063
2123
|
no: bool = typer.Option(False, "--no", help="Undo: stop trusting your home folder."),
|
|
2064
2124
|
yes: bool = typer.Option(False, "--yes", "-y", help="Skip the confirmation question."),
|
|
2065
2125
|
json_output: bool = typer.Option(False, "--json", help="Print the recorded decision."),
|
|
2126
|
+
compute: Optional[str] = typer.Option(
|
|
2127
|
+
None,
|
|
2128
|
+
"--compute",
|
|
2129
|
+
"-c",
|
|
2130
|
+
help=(
|
|
2131
|
+
"Decide for a folder on this compute server (SSH alias) instead of here. Launches "
|
|
2132
|
+
"there are unattended, so a folder they start in needs your decision first. You are "
|
|
2133
|
+
"asked at this terminal; --yes does not replace the question for a remote folder."
|
|
2134
|
+
),
|
|
2135
|
+
),
|
|
2066
2136
|
):
|
|
2067
2137
|
"""Decide whether an agent trusts a folder.
|
|
2068
2138
|
|
|
@@ -2071,7 +2141,14 @@ def agents_trust_folder(
|
|
|
2071
2141
|
your home folder the decision is standing (it covers every launch there,
|
|
2072
2142
|
including unattended ones) and is recorded with when and how; undo it with
|
|
2073
2143
|
--no. Only you can decide: an agent calling this is refused.
|
|
2144
|
+
|
|
2145
|
+
With --compute the decision is recorded on that server (the folder path is
|
|
2146
|
+
the remote one): a launch there with ``--compute`` has nobody at its
|
|
2147
|
+
terminal and fails with NEEDS_TRUST_DECISION until you decide.
|
|
2074
2148
|
"""
|
|
2149
|
+
if compute is not None:
|
|
2150
|
+
_trust_folder_remote(compute, folder, tool_choice.value, no, json_output)
|
|
2151
|
+
return
|
|
2075
2152
|
try:
|
|
2076
2153
|
from qbraid_core.services.agents.trust import ( # type: ignore[attr-defined]
|
|
2077
2154
|
HOME_TRUST_WARNING,
|
|
@@ -2232,6 +2309,53 @@ def _messaging_setting(mode: Optional[str], as_json: bool) -> None:
|
|
|
2232
2309
|
console.print(f"Messaging: {current} (this machine). " + messaging_mode.describe(None))
|
|
2233
2310
|
|
|
2234
2311
|
|
|
2312
|
+
def _mail_wakes_module():
|
|
2313
|
+
"""qbraid-core's ``mail_wakes`` (#606), or None on an older Core."""
|
|
2314
|
+
try:
|
|
2315
|
+
# pylint: disable-next=import-outside-toplevel
|
|
2316
|
+
from qbraid_core.services.agents import mail_wakes # type: ignore[attr-defined]
|
|
2317
|
+
except ImportError:
|
|
2318
|
+
return None
|
|
2319
|
+
return mail_wakes
|
|
2320
|
+
|
|
2321
|
+
|
|
2322
|
+
def _mail_wake_cap_setting(cap: int, as_json: bool) -> None:
|
|
2323
|
+
"""Set this machine's mail wake cap (anyone may lower it; only a person may raise it)."""
|
|
2324
|
+
mail_wakes = _mail_wakes_module()
|
|
2325
|
+
if mail_wakes is None:
|
|
2326
|
+
console.print("[red]--mail-wake-cap needs a newer qbraid-core[/red] (one with mail wakes).")
|
|
2327
|
+
raise typer.Exit(code=1)
|
|
2328
|
+
try:
|
|
2329
|
+
current = mail_wakes.set_wake_cap(cap)
|
|
2330
|
+
except mail_wakes.WakeCapError as err:
|
|
2331
|
+
console.print(f"[red]Not changed:[/red] {_plain(str(err))}")
|
|
2332
|
+
raise typer.Exit(code=1) from None
|
|
2333
|
+
if as_json:
|
|
2334
|
+
print(json.dumps({"mail_wake_cap": current}))
|
|
2335
|
+
return
|
|
2336
|
+
console.print(f"Mail wake cap: {current} (this machine). {_MAIL_WAKE_CAP_NOTE}", soft_wrap=True)
|
|
2337
|
+
|
|
2338
|
+
|
|
2339
|
+
#: Said when the cap setting cannot be read (qbraid-core reads it as 0).
|
|
2340
|
+
_CAP_DAMAGED = "cap file damaged; showing 0"
|
|
2341
|
+
|
|
2342
|
+
|
|
2343
|
+
def _cap_damaged(mail_wakes) -> bool:
|
|
2344
|
+
"""Whether Core reports the cap setting as damaged (an older Core cannot say)."""
|
|
2345
|
+
check = getattr(mail_wakes, "wake_cap_damaged", None)
|
|
2346
|
+
try:
|
|
2347
|
+
return bool(check()) if callable(check) else False
|
|
2348
|
+
except Exception: # pylint: disable=broad-exception-caught
|
|
2349
|
+
return False
|
|
2350
|
+
|
|
2351
|
+
|
|
2352
|
+
#: What the mail wake cap does, for ``settings``.
|
|
2353
|
+
_MAIL_WAKE_CAP_NOTE = (
|
|
2354
|
+
"At most this many mail-triggered wakes per agent per hour with no message from you in "
|
|
2355
|
+
"between; past it, mail waits for your next message to that agent (0: mail never wakes)."
|
|
2356
|
+
)
|
|
2357
|
+
|
|
2358
|
+
|
|
2235
2359
|
@agents_app.command("settings")
|
|
2236
2360
|
def agents_settings(
|
|
2237
2361
|
execution_mode: Optional[ExecutionMode] = typer.Option(
|
|
@@ -2247,6 +2371,16 @@ def agents_settings(
|
|
|
2247
2371
|
"for agents that read untrusted input. Anyone may restrict; only a person may open."
|
|
2248
2372
|
),
|
|
2249
2373
|
),
|
|
2374
|
+
mail_wake_cap: Optional[int] = typer.Option(
|
|
2375
|
+
None,
|
|
2376
|
+
"--mail-wake-cap",
|
|
2377
|
+
min=0,
|
|
2378
|
+
max=1000,
|
|
2379
|
+
help=(
|
|
2380
|
+
"Mail-triggered wakes per agent per hour with no message from you in between "
|
|
2381
|
+
"(default 20; 0: mail never wakes). Anyone may lower it; only a person may raise it."
|
|
2382
|
+
),
|
|
2383
|
+
),
|
|
2250
2384
|
json_output: bool = typer.Option(
|
|
2251
2385
|
False, "--json", help="Print structured settings and sandbox readiness."
|
|
2252
2386
|
),
|
|
@@ -2256,13 +2390,22 @@ def agents_settings(
|
|
|
2256
2390
|
Inspect or change them. Defaults are shared by the CLI and dashboard on this machine.
|
|
2257
2391
|
"""
|
|
2258
2392
|
if messaging is not None:
|
|
2259
|
-
if reset or execution_mode is not None:
|
|
2393
|
+
if reset or execution_mode is not None or mail_wake_cap is not None:
|
|
2260
2394
|
console.print(
|
|
2261
|
-
"[red]Error:[/red] Set --messaging on its own (not with --reset
|
|
2395
|
+
"[red]Error:[/red] Set --messaging on its own (not with --reset, --execution-mode "
|
|
2396
|
+
"or --mail-wake-cap)."
|
|
2262
2397
|
)
|
|
2263
2398
|
raise typer.Exit(code=2)
|
|
2264
2399
|
_messaging_setting(messaging.value, json_output)
|
|
2265
2400
|
return
|
|
2401
|
+
if mail_wake_cap is not None:
|
|
2402
|
+
if reset or execution_mode is not None:
|
|
2403
|
+
console.print(
|
|
2404
|
+
"[red]Error:[/red] Set --mail-wake-cap on its own (not with --reset or --execution-mode)."
|
|
2405
|
+
)
|
|
2406
|
+
raise typer.Exit(code=2)
|
|
2407
|
+
_mail_wake_cap_setting(mail_wake_cap, json_output)
|
|
2408
|
+
return
|
|
2266
2409
|
try:
|
|
2267
2410
|
from qbraid_core.services.agents.execution import execution_settings, set_execution_default
|
|
2268
2411
|
|
|
@@ -2275,11 +2418,26 @@ def agents_settings(
|
|
|
2275
2418
|
else:
|
|
2276
2419
|
settings = execution_settings()
|
|
2277
2420
|
current_messaging = _current_messaging()
|
|
2421
|
+
mail_wakes = _mail_wakes_module()
|
|
2422
|
+
cap = mail_wakes.wake_cap() if mail_wakes is not None else None
|
|
2423
|
+
damaged = mail_wakes is not None and _cap_damaged(mail_wakes)
|
|
2278
2424
|
if json_output:
|
|
2279
|
-
print(
|
|
2425
|
+
print(
|
|
2426
|
+
json.dumps(
|
|
2427
|
+
{
|
|
2428
|
+
**settings,
|
|
2429
|
+
**({"messaging": current_messaging} if current_messaging else {}),
|
|
2430
|
+
**({"mail_wake_cap": cap} if cap is not None else {}),
|
|
2431
|
+
**({"mail_wake_cap_damaged": True} if damaged else {}),
|
|
2432
|
+
}
|
|
2433
|
+
)
|
|
2434
|
+
)
|
|
2280
2435
|
else:
|
|
2281
2436
|
if current_messaging:
|
|
2282
2437
|
console.print(f"Messaging: {current_messaging} (this machine).")
|
|
2438
|
+
if cap is not None:
|
|
2439
|
+
shown = f"{cap} ({_CAP_DAMAGED}; set it again with --mail-wake-cap)" if damaged else cap
|
|
2440
|
+
console.print(f"Mail wake cap: {shown} (this machine). {_MAIL_WAKE_CAP_NOTE}", soft_wrap=True)
|
|
2283
2441
|
console.print(
|
|
2284
2442
|
"Codex execution default: " + (settings["execution_mode"] or "not set (legacy defaults)")
|
|
2285
2443
|
)
|
|
@@ -3479,6 +3637,15 @@ def _report_typed(as_json: bool, target: str, compute: Optional[str]) -> None:
|
|
|
3479
3637
|
|
|
3480
3638
|
#: Why mail waits, for a ``held:<CODE>`` that a qBraid bridge (or its absence) reports.
|
|
3481
3639
|
_MAIL_WAITS = {
|
|
3640
|
+
"WAKE_COUNT_BUSY": (
|
|
3641
|
+
"qBraid could not update its mail wake count (busy), so it is not woken yet rather than "
|
|
3642
|
+
"risk passing the cap; it is told once the count can be kept."
|
|
3643
|
+
),
|
|
3644
|
+
"WAKE_CAP": (
|
|
3645
|
+
"the agent has used its mail wake cap (mail-triggered wakes in the last hour with no "
|
|
3646
|
+
"message from the person; qbraid agents settings --mail-wake-cap), so it is not woken "
|
|
3647
|
+
"now; it is told once its count frees up within the hour or the person messages it."
|
|
3648
|
+
),
|
|
3482
3649
|
"NEXT_TURN": "the agent has no qBraid bridge to wake it, so it sees the message on its next turn.",
|
|
3483
3650
|
"BRIDGE_STARTING": (
|
|
3484
3651
|
"the agent's qBraid bridge is still starting; it tells the agent as soon as it runs."
|
|
@@ -3542,6 +3709,13 @@ def _print_nudge(outcome) -> None:
|
|
|
3542
3709
|
)
|
|
3543
3710
|
return
|
|
3544
3711
|
reason = str(outcome or "held:UNKNOWN").split(":", 1)[-1]
|
|
3712
|
+
if reason == "SENDER_CANNOT_WAKE":
|
|
3713
|
+
console.print(
|
|
3714
|
+
f"[yellow]Mail waiting ({_plain(reason)}):[/yellow] the message is in the agent's "
|
|
3715
|
+
f"inbox; {_plain(_sender_cannot_wake_text())}",
|
|
3716
|
+
soft_wrap=True,
|
|
3717
|
+
)
|
|
3718
|
+
return
|
|
3545
3719
|
if reason in _MAIL_WAITS:
|
|
3546
3720
|
console.print(
|
|
3547
3721
|
f"[yellow]Mail waiting ({_plain(reason)}):[/yellow] the message is in the agent's "
|
|
@@ -3657,6 +3831,8 @@ def _send_to_inbox( # pylint: disable=too-many-arguments
|
|
|
3657
3831
|
"request_id": request_id,
|
|
3658
3832
|
"already_delivered": bool(result.get("alreadyDelivered")),
|
|
3659
3833
|
"nudge": result["nudge"],
|
|
3834
|
+
# As the remote form of this command reports them.
|
|
3835
|
+
**({"wake": result["wakeStatus"]} if isinstance(result.get("wakeStatus"), dict) else {}),
|
|
3660
3836
|
}
|
|
3661
3837
|
)
|
|
3662
3838
|
return
|
|
@@ -3665,6 +3841,9 @@ def _send_to_inbox( # pylint: disable=too-many-arguments
|
|
|
3665
3841
|
f"[dim](id={_plain(result['messageId'])})[/dim]",
|
|
3666
3842
|
soft_wrap=True,
|
|
3667
3843
|
)
|
|
3844
|
+
wake = _wake_line(result.get("wakeStatus"))
|
|
3845
|
+
if wake:
|
|
3846
|
+
console.print(f" [{_wake_style(result['wakeStatus'])}]{_plain(wake)}[/]", soft_wrap=True)
|
|
3668
3847
|
_print_nudge(result["nudge"])
|
|
3669
3848
|
|
|
3670
3849
|
|
|
@@ -3943,6 +4122,7 @@ def agents_watch(
|
|
|
3943
4122
|
|
|
3944
4123
|
Streams live transcript from an agent session.
|
|
3945
4124
|
"""
|
|
4125
|
+
watching = False # this watch registered as a permission watcher
|
|
3946
4126
|
try:
|
|
3947
4127
|
# Remote watch: SSH and stream from remote
|
|
3948
4128
|
if compute:
|
|
@@ -4075,7 +4255,8 @@ def agents_watch(
|
|
|
4075
4255
|
from qbraid_core.services.agents.permissions import start_watching, stop_watching
|
|
4076
4256
|
|
|
4077
4257
|
if can_prompt or can_notify:
|
|
4078
|
-
start_watching(perm_session_id)
|
|
4258
|
+
start_watching(perm_session_id) # raises WatchLockBusy, registering nothing
|
|
4259
|
+
watching = True # only a start that registered has a stop (core #693)
|
|
4079
4260
|
|
|
4080
4261
|
if not stream:
|
|
4081
4262
|
sid_short = session.session_id[:8]
|
|
@@ -4364,7 +4545,7 @@ def agents_watch(
|
|
|
4364
4545
|
try:
|
|
4365
4546
|
from qbraid_core.services.agents.permissions import stop_watching
|
|
4366
4547
|
|
|
4367
|
-
if
|
|
4548
|
+
if watching:
|
|
4368
4549
|
stop_watching(perm_session_id)
|
|
4369
4550
|
except Exception:
|
|
4370
4551
|
pass
|
|
@@ -4880,9 +5061,100 @@ def _parse_target_csv(csv: str, registry) -> list[str]:
|
|
|
4880
5061
|
return resolved
|
|
4881
5062
|
|
|
4882
5063
|
|
|
5064
|
+
#: Why ``send-to`` mail waits for the recipient's next turn (``_waits_for_next_turn``).
|
|
5065
|
+
_WAIT_WHY = {
|
|
5066
|
+
"WAKE_COUNT_BUSY": (
|
|
5067
|
+
"qBraid could not update its mail wake count (busy), so it is not woken yet; it is told "
|
|
5068
|
+
"once the count can be kept."
|
|
5069
|
+
),
|
|
5070
|
+
"WAKE_CAP": (
|
|
5071
|
+
"it has used its mail wake cap (mail-triggered wakes in the last hour with no message from "
|
|
5072
|
+
"the person; qbraid agents settings --mail-wake-cap); it is told once its count frees up "
|
|
5073
|
+
"within the hour or the person messages it."
|
|
5074
|
+
),
|
|
5075
|
+
}
|
|
5076
|
+
|
|
5077
|
+
|
|
5078
|
+
def _wake_line(record) -> Optional[str]:
|
|
5079
|
+
"""Core's ``wake_status`` ({state, reason, detail, route}) as one plain line,
|
|
5080
|
+
or None on a Core without it (qbraid-core < 0.6.57)."""
|
|
5081
|
+
if not isinstance(record, dict) or "state" not in record:
|
|
5082
|
+
return None
|
|
5083
|
+
try:
|
|
5084
|
+
# pylint: disable-next=import-outside-toplevel
|
|
5085
|
+
from qbraid_core.services.agents.wake_route import describe # type: ignore[attr-defined]
|
|
5086
|
+
|
|
5087
|
+
return describe(record)
|
|
5088
|
+
except ImportError:
|
|
5089
|
+
detail = record.get("detail")
|
|
5090
|
+
return str(detail) if detail else str(record.get("state"))
|
|
5091
|
+
|
|
5092
|
+
|
|
5093
|
+
def _wake_style(record) -> str:
|
|
5094
|
+
state = record.get("state") if isinstance(record, dict) else None
|
|
5095
|
+
return {"will_read_now": "green", "waits_next_turn": "yellow", "held": "red"}.get(str(state), "dim")
|
|
5096
|
+
|
|
5097
|
+
|
|
5098
|
+
def _wakes_of(registry, sessions) -> list:
|
|
5099
|
+
"""``wake_status`` per session in one pass (shared state read once), or
|
|
5100
|
+
Nones on an older Core."""
|
|
5101
|
+
try:
|
|
5102
|
+
# pylint: disable-next=import-outside-toplevel
|
|
5103
|
+
from qbraid_core.services.agents.wake_route import wake_statuses # type: ignore[attr-defined]
|
|
5104
|
+
except ImportError:
|
|
5105
|
+
return [_wake_of(registry, s.session_id) for s in sessions]
|
|
5106
|
+
try:
|
|
5107
|
+
found = wake_statuses(registry, list(sessions))
|
|
5108
|
+
except Exception: # pylint: disable=broad-exception-caught
|
|
5109
|
+
return [None for _ in sessions]
|
|
5110
|
+
return [found.get(s.session_id) for s in sessions]
|
|
5111
|
+
|
|
5112
|
+
|
|
5113
|
+
def _wake_of(registry, session_id: str) -> Optional[dict]:
|
|
5114
|
+
"""``wake_status`` for a session on this machine, or None on an older Core."""
|
|
5115
|
+
try:
|
|
5116
|
+
# pylint: disable-next=import-outside-toplevel
|
|
5117
|
+
from qbraid_core.services.agents.wake_route import wake_status # type: ignore[attr-defined]
|
|
5118
|
+
except ImportError:
|
|
5119
|
+
return None
|
|
5120
|
+
try:
|
|
5121
|
+
return wake_status(registry, session_id)
|
|
5122
|
+
except Exception: # pylint: disable=broad-exception-caught
|
|
5123
|
+
return None
|
|
5124
|
+
|
|
5125
|
+
|
|
5126
|
+
def _mail_wakes_label(wakes) -> Optional[str]:
|
|
5127
|
+
"""whoami's ``mail_wakes`` (qbraid-core #606) as one line, or None."""
|
|
5128
|
+
if not isinstance(wakes, dict) or "count" not in wakes:
|
|
5129
|
+
return None
|
|
5130
|
+
text = f"{wakes.get('count')} of {wakes.get('cap')} in the last hour"
|
|
5131
|
+
if wakes.get("cap_damaged"):
|
|
5132
|
+
text += f" ({_CAP_DAMAGED})"
|
|
5133
|
+
return text + (" (held: mail waits until it frees up or the person writes)" if wakes.get("held") else "")
|
|
5134
|
+
|
|
5135
|
+
|
|
5136
|
+
def _sender_cannot_wake_text() -> str:
|
|
5137
|
+
"""``SENDER_CANNOT_WAKE``'s meaning on the installed Core: since qbraid-core
|
|
5138
|
+
#606 only mail from another machine; before it, a sender that was not the
|
|
5139
|
+
person or a bypass agent they launched."""
|
|
5140
|
+
if _mail_wakes_module() is not None:
|
|
5141
|
+
return (
|
|
5142
|
+
"mail from another machine does not wake an agent in a bypass permission mode; it "
|
|
5143
|
+
"sees the message on its next turn."
|
|
5144
|
+
)
|
|
5145
|
+
return "only the person, or an agent they launched in a bypass mode, can wake it."
|
|
5146
|
+
|
|
5147
|
+
|
|
4883
5148
|
def _waits_for_next_turn(registry, msg) -> Optional[str]:
|
|
4884
|
-
"""
|
|
4885
|
-
|
|
5149
|
+
"""Why *msg* waits for its recipient's next turn, or None when it may wake.
|
|
5150
|
+
|
|
5151
|
+
``"WAKE_CAP"``: Core held it, the recipient's mail wake cap reached
|
|
5152
|
+
(``AgentMessage.held``, qbraid-core #606; for every recipient).
|
|
5153
|
+
``"SENDER_CANNOT_WAKE"``: an older Core marked it as not waking and its
|
|
5154
|
+
recipient holds such mail (``messaging_mode.holds_for``)."""
|
|
5155
|
+
held = getattr(msg, "held", None)
|
|
5156
|
+
if isinstance(held, str) and held:
|
|
5157
|
+
return held
|
|
4886
5158
|
if getattr(msg, "wakes", None) is not False:
|
|
4887
5159
|
return None
|
|
4888
5160
|
try:
|
|
@@ -4926,6 +5198,7 @@ def _deliver_to_many(
|
|
|
4926
5198
|
failed: list[tuple[str, str]] = []
|
|
4927
5199
|
forwards: dict = {}
|
|
4928
5200
|
waits: dict = {}
|
|
5201
|
+
wakes: dict = {}
|
|
4929
5202
|
for target_sid in targets:
|
|
4930
5203
|
try:
|
|
4931
5204
|
msg = send_message(
|
|
@@ -4942,6 +5215,7 @@ def _deliver_to_many(
|
|
|
4942
5215
|
forwarded = getattr(msg, "forwarded_from", None)
|
|
4943
5216
|
forwards[msg.id] = forwarded if isinstance(forwarded, str) else None
|
|
4944
5217
|
waits[msg.id] = _waits_for_next_turn(registry, msg)
|
|
5218
|
+
wakes[msg.id] = getattr(msg, "wake_status", None)
|
|
4945
5219
|
if isinstance(forwarded, str) and forwarded and not as_json:
|
|
4946
5220
|
old_sid, new_sid = str(forwarded), str(msg.to_session)
|
|
4947
5221
|
console.print(
|
|
@@ -4963,6 +5237,7 @@ def _deliver_to_many(
|
|
|
4963
5237
|
"type": message_type,
|
|
4964
5238
|
"forwarded_from": forwards.get(mid),
|
|
4965
5239
|
**({"held": waits[mid]} if waits.get(mid) else {}),
|
|
5240
|
+
**({"wake": wakes[mid]} if isinstance(wakes.get(mid), dict) else {}),
|
|
4966
5241
|
}
|
|
4967
5242
|
for sid, mid in delivered
|
|
4968
5243
|
],
|
|
@@ -4977,10 +5252,22 @@ def _deliver_to_many(
|
|
|
4977
5252
|
f"[green]→[/green] Sent to [bold]{_plain(sid)}[/bold] "
|
|
4978
5253
|
f"[dim](id={_plain(mid)}, type={_plain(message_type)})[/dim]"
|
|
4979
5254
|
)
|
|
5255
|
+
wake = _wake_line(wakes.get(mid))
|
|
5256
|
+
if wake:
|
|
5257
|
+
# Core's one answer to "when will it see this?" (wake_status).
|
|
5258
|
+
console.print(f" [{_wake_style(wakes[mid])}]{_plain(wake)}[/]", soft_wrap=True)
|
|
5259
|
+
continue
|
|
4980
5260
|
if waits.get(mid):
|
|
5261
|
+
reason = str(waits[mid])
|
|
4981
5262
|
console.print(
|
|
4982
|
-
f"[dim]It waits for {_plain(sid[:8])}'s next turn ({
|
|
4983
|
-
|
|
5263
|
+
f"[dim]It waits for {_plain(sid[:8])}'s next turn ({_plain(reason)}): "
|
|
5264
|
+
+ _plain(
|
|
5265
|
+
_sender_cannot_wake_text()
|
|
5266
|
+
if reason == "SENDER_CANNOT_WAKE"
|
|
5267
|
+
else _WAIT_WHY.get(reason, "it is not woken for it.")
|
|
5268
|
+
)
|
|
5269
|
+
+ "[/dim]",
|
|
5270
|
+
soft_wrap=True,
|
|
4984
5271
|
)
|
|
4985
5272
|
for sid, reason in failed_shown:
|
|
4986
5273
|
# soft_wrap: a refusal stays one line, so grep-based checks still match.
|
|
@@ -5089,6 +5376,7 @@ def _send_remote( # pylint: disable=too-many-arguments
|
|
|
5089
5376
|
"request_id": result.get("requestId"),
|
|
5090
5377
|
"already_delivered": bool(result.get("alreadyDelivered")),
|
|
5091
5378
|
"nudge": result.get("nudge"),
|
|
5379
|
+
**({"wake": result["wakeStatus"]} if isinstance(result.get("wakeStatus"), dict) else {}),
|
|
5092
5380
|
}
|
|
5093
5381
|
)
|
|
5094
5382
|
return
|
|
@@ -5104,6 +5392,11 @@ def _send_remote( # pylint: disable=too-many-arguments
|
|
|
5104
5392
|
"machine": result.get("machineId"),
|
|
5105
5393
|
"request_id": result.get("requestId"),
|
|
5106
5394
|
"already_delivered": bool(result.get("alreadyDelivered")),
|
|
5395
|
+
**(
|
|
5396
|
+
{"wake": result["wakeStatus"]}
|
|
5397
|
+
if isinstance(result.get("wakeStatus"), dict)
|
|
5398
|
+
else {}
|
|
5399
|
+
),
|
|
5107
5400
|
}
|
|
5108
5401
|
],
|
|
5109
5402
|
"failed": [],
|
|
@@ -5118,6 +5411,9 @@ def _send_remote( # pylint: disable=too-many-arguments
|
|
|
5118
5411
|
+ f", request={_plain(result['requestId'])})[/dim]",
|
|
5119
5412
|
soft_wrap=True,
|
|
5120
5413
|
)
|
|
5414
|
+
wake = _wake_line(result.get("wakeStatus"))
|
|
5415
|
+
if wake:
|
|
5416
|
+
console.print(f" [{_wake_style(result['wakeStatus'])}]{_plain(wake)}[/]", soft_wrap=True)
|
|
5121
5417
|
if nudge:
|
|
5122
5418
|
_print_nudge(result.get("nudge"))
|
|
5123
5419
|
|
|
@@ -5664,16 +5960,42 @@ def _render_messages_table(messages, session_id: str, full_ids: bool = False) ->
|
|
|
5664
5960
|
if machine:
|
|
5665
5961
|
# From another machine: answer with `qbraid agents reply <id>`.
|
|
5666
5962
|
from_display += f" @{machine if full_ids else machine[:8]}"
|
|
5963
|
+
label = _provenance_label(msg)
|
|
5964
|
+
if label:
|
|
5965
|
+
# Core's label on a row of its own, so no message text can draw a
|
|
5966
|
+
# line that passes for it.
|
|
5967
|
+
table.add_row("", "", "", "", f"[dim]{_plain(_printable(label))}[/dim]")
|
|
5667
5968
|
table.add_row(
|
|
5668
5969
|
ts,
|
|
5669
|
-
_plain(from_display),
|
|
5970
|
+
_plain(_printable(from_display)),
|
|
5670
5971
|
_plain(msg.type.value),
|
|
5671
5972
|
read_marker,
|
|
5672
|
-
_plain(msg.text),
|
|
5973
|
+
_plain(_printable(msg.text)),
|
|
5673
5974
|
)
|
|
5674
5975
|
console.print(table)
|
|
5675
5976
|
|
|
5676
5977
|
|
|
5978
|
+
def _printable(value) -> str:
|
|
5979
|
+
"""*value* without terminal control characters (ESC sequences could move
|
|
5980
|
+
the cursor and redraw rows above); tabs and new lines are kept."""
|
|
5981
|
+
import unicodedata # pylint: disable=import-outside-toplevel
|
|
5982
|
+
|
|
5983
|
+
return "".join(ch for ch in str(value) if ch in "\n\t" or unicodedata.category(ch) not in ("Cc", "Cf"))
|
|
5984
|
+
|
|
5985
|
+
|
|
5986
|
+
def _provenance_label(msg) -> Optional[str]:
|
|
5987
|
+
"""Core's one-line label of who sent *msg* (qbraid-core #606), or None on an older Core."""
|
|
5988
|
+
try:
|
|
5989
|
+
# pylint: disable-next=import-outside-toplevel
|
|
5990
|
+
from qbraid_core.services.agents.mail_wakes import provenance_label # type: ignore
|
|
5991
|
+
except ImportError:
|
|
5992
|
+
return None
|
|
5993
|
+
try:
|
|
5994
|
+
return provenance_label(msg)
|
|
5995
|
+
except Exception: # pylint: disable=broad-exception-caught
|
|
5996
|
+
return None
|
|
5997
|
+
|
|
5998
|
+
|
|
5677
5999
|
def _runs_in_agent(registry) -> bool:
|
|
5678
6000
|
"""Whether this command runs inside an agent session rather than for the person.
|
|
5679
6001
|
|
|
@@ -6215,7 +6537,9 @@ def agents_whoami(
|
|
|
6215
6537
|
("Inbox", info.get("inbox_path")),
|
|
6216
6538
|
("Canonical id", info.get("canonical_session_id")),
|
|
6217
6539
|
("Resumed from", info.get("resumed_from")),
|
|
6540
|
+
("Wake", _wake_line(info.get("wake_status"))),
|
|
6218
6541
|
("Mail waiting", _held_label(info.get("nudges_held"))),
|
|
6542
|
+
("Mail wakes", _mail_wakes_label(info.get("mail_wakes"))),
|
|
6219
6543
|
(
|
|
6220
6544
|
"Nudge left",
|
|
6221
6545
|
(
|
|
@@ -6319,10 +6643,11 @@ def agents_team(
|
|
|
6319
6643
|
title=f"Team: {_plain(team_id)} ({len(members)} member{'s' if len(members) != 1 else ''})",
|
|
6320
6644
|
)
|
|
6321
6645
|
table.add_column("You", justify="center", no_wrap=True)
|
|
6322
|
-
table.add_column("Session", style="cyan", no_wrap=
|
|
6646
|
+
table.add_column("Session", style="cyan", no_wrap=True)
|
|
6323
6647
|
table.add_column("Type", style="yellow", no_wrap=True)
|
|
6324
6648
|
table.add_column("Status", no_wrap=True)
|
|
6325
6649
|
table.add_column("Unread", justify="right", no_wrap=True)
|
|
6650
|
+
table.add_column("Wake", no_wrap=True)
|
|
6326
6651
|
table.add_column("Last msg from", style="dim")
|
|
6327
6652
|
table.add_column("Last msg text", style="dim")
|
|
6328
6653
|
|
|
@@ -6343,15 +6668,21 @@ def agents_team(
|
|
|
6343
6668
|
session_display = s.session_id if wide else s.session_id[:12]
|
|
6344
6669
|
last_from = (last.from_session if wide else last.from_session[:12]) if last else "-"
|
|
6345
6670
|
last_text = (last.text[:60] + "…") if last and len(last.text) > 60 else (last.text if last else "-")
|
|
6346
|
-
|
|
6671
|
+
status_text = getattr(s.status, "value", s.status) or "unknown"
|
|
6672
|
+
status_style = status_styles.get(status_text, "dim")
|
|
6347
6673
|
unread_style = "bold red" if unread_count else "dim"
|
|
6674
|
+
wake = _wake_of(registry, s.session_id)
|
|
6675
|
+
wake_text = {"will_read_now": "now", "waits_next_turn": "next turn", "held": "held"}.get(
|
|
6676
|
+
str((wake or {}).get("state")), "-"
|
|
6677
|
+
)
|
|
6348
6678
|
|
|
6349
6679
|
table.add_row(
|
|
6350
6680
|
"★" if s.session_id == me_sid else "",
|
|
6351
6681
|
_plain(session_display),
|
|
6352
6682
|
_plain(s.agent_type or "worker"),
|
|
6353
|
-
f"[{status_style}]{
|
|
6683
|
+
f"[{status_style}]{_plain(status_text)}[/{status_style}]",
|
|
6354
6684
|
f"[{unread_style}]{unread_count}[/{unread_style}]",
|
|
6685
|
+
f"[{_wake_style(wake)}]{_plain(wake_text)}[/]",
|
|
6355
6686
|
_plain(last_from),
|
|
6356
6687
|
_plain(last_text),
|
|
6357
6688
|
)
|