Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

feat(cli): compact Show Page rows and removed definitions (#2977)

Call White0968ee5019d7
diff --git a/docs/CLI.md b/docs/CLI.md
index c578863c2..b428bc346 100644
--- a/docs/CLI.md
+++ b/docs/CLI.md
@@ -77,10 +77,14 @@ and use the corresponding `show` or `get` command for full record detail.
takes `--page` only.
List rows carry only what is needed to decide the next step and omit null,
-empty, and zero-valued fields, so an absent field means unset. `vibe task show`,
-`vibe watch show`, `vibe runs show`, `vibe session get`, and `vibe agent show`
+empty, and zero-valued fields, so an absent field means unset. A Show Page row
+is its `session_id`, `visibility`, `active_url` (the URL to share), `path` (the
+workspace to edit), and `updated_at`. `vibe task show`, `vibe watch show`,
+`vibe runs show`, `vibe session get`, `vibe agent show`, and `vibe show status`
print the full record; add `--brief` to print exactly the row the matching list
-command prints.
+command prints. A removed Task or Watch shows `lifecycle_state: "removed"` and
+`removed_at`, and none of the live fields (`enabled`, health, next fire, or
+waiter state) it no longer has.
### Session-owned lists
diff --git a/docs/CLI_ZH.md b/docs/CLI_ZH.md
index d5554a535..08a9971d5 100644
--- a/docs/CLI_ZH.md
+++ b/docs/CLI_ZH.md
@@ -65,8 +65,12 @@ list/find/tags、Show Page 的 list/marks、`vibe data query`、`vibe task list`
`--page`。
列表行只携带决定下一步所需的字段,并省略 null、空值和零值字段,因此缺失的字段即表示
-未设置。`vibe task show`、`vibe watch show`、`vibe runs show`、`vibe session get`
-和 `vibe agent show` 输出完整记录;加上 `--brief` 则只输出对应 list 命令打印的那一行。
+未设置。Show Page 的列表行只有 `session_id`、`visibility`、`active_url`(用于分享的
+URL)、`path`(要编辑的工作目录)和 `updated_at`。`vibe task show`、`vibe watch show`、
+`vibe runs show`、`vibe session get`、`vibe agent show` 和 `vibe show status` 输出完整
+记录;加上 `--brief` 则只输出对应 list 命令打印的那一行。已删除的 Task 或 Watch 显示
+`lifecycle_state: "removed"` 和 `removed_at`,不再带它已经没有的实时字段(`enabled`、
+健康状态、下次触发或 waiter 状态)。
### Session 归属的列表
diff --git a/docs/COMMANDS.md b/docs/COMMANDS.md
index 3208c02e6..2d2cfbcb1 100644
--- a/docs/COMMANDS.md
+++ b/docs/COMMANDS.md
@@ -529,7 +529,8 @@ compact rows. A page holds at most 100 rows; a larger `--limit` reads 100 and
`--all` mode. Continue with `pagination.next_command`; inspect one record with
its `show` or `get` command. List rows omit null, empty, and zero-valued fields;
`--brief` on `vibe task show`, `vibe watch show`, `vibe runs show`,
-`vibe session get`, and `vibe agent show` prints exactly the list row.
+`vibe session get`, `vibe agent show`, and `vibe show status` prints exactly the
+list row.
Every command follows one grammar: `--session-id <id>` is the only way to name a
Session, and single-Session commands default to the caller Session inside an
diff --git a/docs/COMMANDS_ZH.md b/docs/COMMANDS_ZH.md
index b5bfaf4b2..f7fa68e3d 100644
--- a/docs/COMMANDS_ZH.md
+++ b/docs/COMMANDS_ZH.md
@@ -505,8 +505,8 @@ bind vr-a3x9k2
单页最多 100 条;更大的 `--limit` 按 100 读取,`pagination.limit` 报告实际使用的
上限。不提供无分页的 `--all` 模式。按 `pagination.next_command` 继续翻页;单条完整
详情通过对应的 `show` 或 `get` 命令获取。列表行省略 null、空值和零值字段;
-`vibe task show`、`vibe watch show`、`vibe runs show`、`vibe session get` 和
-`vibe agent show` 加上 `--brief` 时只输出对应的列表行。
+`vibe task show`、`vibe watch show`、`vibe runs show`、`vibe session get`、
+`vibe agent show` 和 `vibe show status` 加上 `--brief` 时只输出对应的列表行。
所有命令遵循同一套语法:只用 `--session-id <id>` 指定 Session,作用于单个 Session
的命令在 Avibe Agent shell 内默认使用调用方 Session。面向 Agent 的命令输出 JSON
diff --git a/tests/test_cli_definition_read_projection.py b/tests/test_cli_definition_read_projection.py
index 27fed0d57..163c10fea 100644
--- a/tests/test_cli_definition_read_projection.py
+++ b/tests/test_cli_definition_read_projection.py
@@ -189,8 +189,10 @@ def test_cli_and_workbench_share_the_definition_read_projection(capsys) -> None:
assert _canonical(cli_watch_detail, watch=True) == _canonical(
api_watches["waiting-live"], watch=True
)
- assert cli_watch_detail["runtime"]["pid"] == 1234
- # Never observed: neither liveness nor a heartbeat to print.
+ # The heartbeat record stays internal; ``process_alive`` states what it means.
+ assert "runtime" not in cli_watch_detail
+ assert cli_watch_detail["process_alive"] is True
+ # Never observed: no liveness to print.
assert {"process_alive", "runtime"}.isdisjoint(cli_unknown_watch_detail)
assert api_watches["waiting-never"]["runtime"] == {}
diff --git a/tests/test_cli_task_command.py b/tests/test_cli_task_command.py
index ed0bea13c..f96775f08 100644
--- a/tests/test_cli_task_command.py
+++ b/tests/test_cli_task_command.py
@@ -590,8 +590,8 @@ def test_removed_task_reads_as_removed_and_refuses_mutations(capsys) -> None:
assert definition["id"] == task.id
assert definition["name"] == "Hourly summary"
assert definition["lifecycle_state"] == "removed"
- # The removed row keeps ``enabled``, but it will never fire again.
- assert "next_run_at" not in definition
+ # It will never fire again, so it carries no live state.
+ assert not {"enabled", "health", "next_run_at", "waiting_since"} & set(definition)
removed_at = definition["removed_at"]
assert removed_at
diff --git a/tests/test_cli_watch_command.py b/tests/test_cli_watch_command.py
index da18cfca5..408b8be0d 100644
--- a/tests/test_cli_watch_command.py
+++ b/tests/test_cli_watch_command.py
@@ -1314,11 +1314,14 @@ def test_removed_watch_reads_as_removed_and_refuses_mutations(capsys) -> None:
assert definition["id"] == watch.id
assert definition["name"] == "Watch CI"
assert definition["lifecycle_state"] == "removed"
+ # Nothing about it can still run, so it carries no live state.
+ assert not {"enabled", "health", "process_alive", "waiting_since", "next_run_at", "runtime"} & set(definition)
removed_at = definition["removed_at"]
assert removed_at
assert cli.cmd_watch_show(watch.id, brief=True) == 0
row = json.loads(capsys.readouterr().out)["definition"]
assert (row["lifecycle_state"], row["removed_at"]) == ("removed", removed_at)
+ assert not {"health", "process_alive", "waiting_since"} & set(row)
mutations = [
(cli.cmd_watch_set_enabled, (watch.id, False)),
diff --git a/tests/test_show_pages.py b/tests/test_show_pages.py
index 53a84e530..0dd1f957d 100644
--- a/tests/test_show_pages.py
+++ b/tests/test_show_pages.py
@@ -2825,11 +2825,25 @@ def test_show_list_cli_json_reports_existing_pages(monkeypatch, tmp_path, capsys
payload = json.loads(capsys.readouterr().out)
assert payload["ok"] is True
assert payload["count"] == 2
+ assert "url_guidance" not in payload
assert [page["session_id"] for page in payload["pages"]] == ["ses-public", "ses-private"]
public_page = payload["pages"][0]
+ # A row names the page, its visibility, the URL to share, and the workspace.
+ assert set(public_page) == {"session_id", "visibility", "active_url", "path", "updated_at"}
assert public_page["visibility"] == "public"
- assert public_page["active_url"] == public_page["public_url"]
assert public_page["active_url"].startswith("https://alex.avibe.bot/p/")
+ assert payload["pages"][1]["active_url"].startswith("https://alex.avibe.bot/show/ses-private")
+
+ # ``show status --brief`` is that row; ``show status`` keeps the full record.
+ args = cli.build_parser().parse_args(["show", "status", "--session-id", "ses-public", "--brief"])
+ assert cli.cmd_show_status(args) == 0
+ brief = json.loads(capsys.readouterr().out)
+ assert {key: brief[key] for key in public_page} == public_page
+ assert not {"public_url", "private_url", "share_id", "next_actions"} & set(brief)
+ args = cli.build_parser().parse_args(["show", "status", "--session-id", "ses-public"])
+ assert cli.cmd_show_status(args) == 0
+ full = json.loads(capsys.readouterr().out)
+ assert full["active_url"] == full["public_url"] == public_page["active_url"]
def test_show_list_cli_json_reports_pagination(monkeypatch, tmp_path, capsys):
diff --git a/vibe/cli.py b/vibe/cli.py
index aacc1c3cb..59e9eb7d3 100644
--- a/vibe/cli.py
+++ b/vibe/cli.py
@@ -2565,15 +2565,32 @@ def _definition_health_fields(row: Mapping[str, object]) -> dict:
return fields
+#: What a removed definition no longer has: it is not armed, has no next fire or
+#: waiter, and its health describes nothing that can still run.
+_REMOVED_DEFINITION_LIVE_FIELDS = frozenset(
+ {"enabled", "next_run_at", "waiting_since", "running_since", "process_alive"}
+)
+
+
def _definition_detail_payload(row: Mapping[str, object], **derived: object) -> dict:
- """``vibe task show`` / ``vibe watch show``: every fact the projection holds, once."""
+ """``vibe task show`` / ``vibe watch show``: every fact the projection holds, once.
+
+ ``runtime`` is the waiter's heartbeat record (pid and process identity);
+ ``process_alive``, ``waiting_since``, and ``running_since`` already state what
+ it means.
+ """
+ removed = row.get("lifecycle_state") == "removed"
payload = {
key: value
for key, value in row.items()
- if key not in _CLI_OMITTED_DEFINITION_FIELDS and key not in _DEFINITION_HEALTH_FIELDS
+ if key not in _CLI_OMITTED_DEFINITION_FIELDS
+ and key not in _DEFINITION_HEALTH_FIELDS
+ and key != "runtime"
+ and not (removed and key in _REMOVED_DEFINITION_LIVE_FIELDS)
}
- payload.update(_definition_health_fields(row))
+ if not removed:
+ payload.update(_definition_health_fields(row))
payload.update(derived)
return _present_fields(payload)
@@ -2618,7 +2635,7 @@ def _task_projection_payload(task: Mapping[str, object], *, brief: bool = False)
"last_run_at": task.get("last_run_at"),
"last_exit_code": task.get("last_exit_code") or None,
"last_error": task.get("last_error"),
- **_definition_health_fields(task),
+ **({} if task.get("lifecycle_state") == "removed" else _definition_health_fields(task)),
"resume_blocked": task.get("resume_blocked"),
}
)
@@ -3827,9 +3844,13 @@ def _watch_projection_payload(watch: Mapping[str, object], *, brief: bool = Fals
"last_exit_code": watch.get("last_exit_code") or None,
"last_error": watch.get("last_error"),
"process_alive": (
- False if watch.get("enabled") and watch.get("process_alive") is False else None
+ False
+ if watch.get("enabled")
+ and watch.get("process_alive") is False
+ and watch.get("lifecycle_state") != "removed"
+ else None
),
- **_definition_health_fields(watch),
+ **({} if watch.get("lifecycle_state") == "removed" else _definition_health_fields(watch)),
}
)
@@ -14565,6 +14586,19 @@ def _load_show_page_store():
return ShowPageStore()
+def _show_page_row(page_payload: Mapping[str, object]) -> dict:
+ """One Show Page as ``vibe show list`` prints it.
+
+ The row names the page, its visibility, the URL to share, and the workspace to
+ edit. ``vibe show status`` prints the rest: the private and public URLs behind
+ ``active_url``, access revision, share id, icon token, and history.
+ """
+
+ return _present_fields(
+ {key: page_payload.get(key) for key in ("session_id", "visibility", "active_url", "path", "updated_at")}
+ )
+
+
def cmd_show_list(args):
from core.show_pages import avibe_cloud_connect_guidance, show_page_payload
@@ -14595,14 +14629,17 @@ def cmd_show_list(args):
_add_optional_arg(command, "--updated-after", updated_after)
_add_optional_arg(command, "--updated-before", updated_before)
_add_optional_arg(command, "--q", getattr(args, "query", None))
+ # Without a reachable URL every row lacks ``active_url`` for the same reason, so
+ # the guidance is said once, and only then.
+ url_guidance = avibe_cloud_connect_guidance()
_print_cli_payload(
"show_pages",
**scope.payload(),
count=len(result.items),
- visibility=getattr(args, "visibility", None),
- pages=[show_page_payload(page) for page in result.items],
+ **({"visibility": args.visibility} if getattr(args, "visibility", None) else {}),
+ pages=[_show_page_row(show_page_payload(page)) for page in result.items],
**_paginated_fields(result, command=command),
- url_guidance=avibe_cloud_connect_guidance(),
+ **({"url_guidance": url_guidance} if url_guidance else {}),
)
return 0
except Exception as exc:
@@ -14663,6 +14700,11 @@ def cmd_show_status(args):
help_command="vibe show path --help",
details={"session_id": session_id},
)
+ if getattr(args, "brief", False):
+ from core.show_pages import show_page_payload
+
+ _print_json(_cli_payload("show_page", **_show_page_row(show_page_payload(page))))
+ return 0
payload = _show_page_result(
page,
message=f"Show Page is {page.visibility}.",
@@ -17837,6 +17879,7 @@ def build_parser():
error_hint="Pass --session-id, or run from an Avibe Agent shell where AVIBE_SESSION_ID is injected.",
)
show_status_parser.add_argument("--session-id", help="Agent Session ID for the Show Page.")
+ _add_brief_arg(show_status_parser, list_command="vibe show list")
_add_json_noop(show_status_parser)
show_update_parser = show_subparsers.add_parser(