ring-cli 0.17.7__tar.gz → 0.18.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ring_cli-0.17.7 → ring_cli-0.18.0}/PKG-INFO +1 -1
- {ring_cli-0.17.7 → ring_cli-0.18.0}/pyproject.toml +1 -1
- {ring_cli-0.17.7 → ring_cli-0.18.0}/pyproject.toml.orig +1 -1
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/cli.py +35 -12
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/hook.py +17 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/locale/en/LC_MESSAGES/ring.mo +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/locale/en/LC_MESSAGES/ring.po +3 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/locale/ring.pot +114 -110
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/registry.py +4 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/sources/__init__.py +3 -0
- ring_cli-0.18.0/src/ring/terminal.py +215 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/tui.py +14 -3
- {ring_cli-0.17.7 → ring_cli-0.18.0}/LICENSE +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/README.en.md +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/__init__.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/__main__.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/agent_notify.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/commands/__init__.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/commands/_args.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/commands/completion.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/commands/digest.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/commands/doctor.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/commands/focus.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/commands/gc.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/commands/hook.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/commands/quiet.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/commands/stats.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/config.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/focus/__init__.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/focus/applescript.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/focus/base.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/focus/iterm2.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/focus/kitty.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/focus/linux_wm.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/focus/neovim.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/focus/terminal.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/focus/tmux.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/focus/trace.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/fsutil.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/gc.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/hook_protocol.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/i18n.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/ipc.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/labels.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/notify/__init__.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/notify/base.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/notify/command.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/notify/notify_send.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/notify/ntfy.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/notify/osascript_notifier.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/notify/terminal_notifier.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/notify/webhook.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/notify_queue.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/osascript.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/pathutil.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/payload_log.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/permission.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/plugins.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/ps_parse.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/question_detect.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/sources/base.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/sources/claude_code.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/sources/codex.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/sources/hook_registry.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/sources/local_llm.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/stats.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/subproc.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/tmux_scan.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/transcript.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/waiting.py +0 -0
- {ring_cli-0.17.7 → ring_cli-0.18.0}/src/ring/watcher.py +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# import 的 module(見 [tool.uv.build-backend] module-name)與 CLI 指令仍是 `ring`。
|
|
3
3
|
[project]
|
|
4
4
|
name = "ring-cli"
|
|
5
|
-
version = "0.
|
|
5
|
+
version = "0.18.0"
|
|
6
6
|
description = "RiNG — Realtime Instance Notification Grid for active agent CLI sessions."
|
|
7
7
|
readme = "README.en.md"
|
|
8
8
|
requires-python = ">=3.13"
|
|
@@ -40,6 +40,7 @@ from ring.notify_queue import flush_if_due
|
|
|
40
40
|
from ring.plugins import load_plugins
|
|
41
41
|
from ring.registry import Session, Status, running_agent_pids
|
|
42
42
|
from ring.sources import discover_sessions
|
|
43
|
+
from ring.terminal import TERMINAL_LABEL_MAX, show_terminal_column, terminal_labels
|
|
43
44
|
|
|
44
45
|
try:
|
|
45
46
|
from rich.box import SIMPLE_HEAD
|
|
@@ -174,7 +175,9 @@ def _status_text(s: Session) -> str:
|
|
|
174
175
|
return f"{s.status.marker} {status_label(s.status)}{suffix}"
|
|
175
176
|
|
|
176
177
|
|
|
177
|
-
def _rich_renderable(
|
|
178
|
+
def _rich_renderable(
|
|
179
|
+
sessions: list[Session], show_legend: bool, show_tool: bool = True, show_terminal: bool = False
|
|
180
|
+
) -> Group:
|
|
178
181
|
pids = running_agent_pids()
|
|
179
182
|
blocks: list[Any] = [Text(_header(len(sessions), len(pids)), style="bold")]
|
|
180
183
|
if show_legend:
|
|
@@ -190,11 +193,14 @@ def _rich_renderable(sessions: list[Session], show_legend: bool, show_tool: bool
|
|
|
190
193
|
table.add_column(_("專案"), style=_COLORS["project"], no_wrap=True)
|
|
191
194
|
table.add_column(_("進度"), justify="right", no_wrap=True)
|
|
192
195
|
table.add_column(_("閒置"), justify="right", no_wrap=True)
|
|
196
|
+
if show_terminal:
|
|
197
|
+
table.add_column(_("終端"), no_wrap=True, max_width=TERMINAL_LABEL_MAX)
|
|
193
198
|
table.add_column(_("去哪"), style=_COLORS["location"], no_wrap=True, min_width=16, max_width=_LOC_MAX)
|
|
194
199
|
# action 可能很長:給 max_width 上限,否則 no_wrap 會吃掉整列寬度、把其他欄壓成 0。
|
|
195
200
|
table.add_column(_("動作"), no_wrap=True, overflow="ellipsis", max_width=50)
|
|
196
201
|
|
|
197
202
|
labels = load_labels()
|
|
203
|
+
term_labels = terminal_labels(sessions) if show_terminal else {}
|
|
198
204
|
for s in sessions:
|
|
199
205
|
status_cell = Text(_status_text(s), style=_STATUS_STYLE[s.status])
|
|
200
206
|
progress = f"{s.todo[0]}/{s.todo[1]}" if s.todo else "·"
|
|
@@ -203,7 +209,10 @@ def _rich_renderable(sessions: list[Session], show_legend: bool, show_tool: bool
|
|
|
203
209
|
cells: list[Any] = [status_cell]
|
|
204
210
|
if show_tool:
|
|
205
211
|
cells.append(provider_label(s.provider))
|
|
206
|
-
cells += [project_cell, progress, _rel(s.idle_for)
|
|
212
|
+
cells += [project_cell, progress, _rel(s.idle_for)]
|
|
213
|
+
if show_terminal:
|
|
214
|
+
cells.append(Text(term_labels[s.session_id])) # Text:標籤來自使用者環境,不可當 markup 解析
|
|
215
|
+
cells += [loc_cell, s.last_action]
|
|
207
216
|
table.add_row(*cells)
|
|
208
217
|
|
|
209
218
|
blocks.append(table)
|
|
@@ -211,7 +220,9 @@ def _rich_renderable(sessions: list[Session], show_legend: bool, show_tool: bool
|
|
|
211
220
|
|
|
212
221
|
|
|
213
222
|
# ----------------------------------------------------------------------------- plain fallback
|
|
214
|
-
def _render_plain(
|
|
223
|
+
def _render_plain(
|
|
224
|
+
sessions: list[Session], show_legend: bool, show_tool: bool = True, show_terminal: bool = False
|
|
225
|
+
) -> str:
|
|
215
226
|
pids = running_agent_pids()
|
|
216
227
|
lines = [_header(len(sessions), len(pids))]
|
|
217
228
|
if show_legend:
|
|
@@ -222,6 +233,7 @@ def _render_plain(sessions: list[Session], show_legend: bool, show_tool: bool =
|
|
|
222
233
|
return "\n".join(lines)
|
|
223
234
|
|
|
224
235
|
labels = load_labels()
|
|
236
|
+
term_labels = terminal_labels(sessions) if show_terminal else {}
|
|
225
237
|
rows = [
|
|
226
238
|
(
|
|
227
239
|
s.status.marker,
|
|
@@ -232,6 +244,7 @@ def _render_plain(sessions: list[Session], show_legend: bool, show_tool: bool =
|
|
|
232
244
|
_rel(s.idle_for),
|
|
233
245
|
_middle_truncate(s.location, _LOC_MAX),
|
|
234
246
|
s.last_action[:48],
|
|
247
|
+
term_labels.get(s.session_id, ""),
|
|
235
248
|
)
|
|
236
249
|
for s in sessions
|
|
237
250
|
]
|
|
@@ -241,15 +254,20 @@ def _render_plain(sessions: list[Session], show_legend: bool, show_tool: bool =
|
|
|
241
254
|
w_prog = max(len(c_prog), *(len(r[4]) for r in rows))
|
|
242
255
|
w_ago = max(len(c_idle), 3, *(len(r[5]) for r in rows))
|
|
243
256
|
w_loc = max(len(c_loc), *(len(r[6]) for r in rows))
|
|
257
|
+
c_term = _("終端")
|
|
258
|
+
w_term = max(len(c_term), *(len(r[8]) for r in rows))
|
|
244
259
|
tool_h = f"{c_tool:<{w_tool}} " if show_tool else ""
|
|
245
|
-
|
|
260
|
+
term_h = f"{c_term:<{w_term}} " if show_terminal else ""
|
|
261
|
+
header = (
|
|
262
|
+
f" {tool_h}{c_proj:<{w_proj}} {c_prog:>{w_prog}} {c_idle:>{w_ago}} {term_h}{c_loc:<{w_loc}} {c_act}"
|
|
263
|
+
)
|
|
246
264
|
lines += ["", header]
|
|
247
|
-
for marker, kind_icon, tool, project, prog, ago, loc, action in rows:
|
|
265
|
+
for marker, kind_icon, tool, project, prog, ago, loc, action, term in rows:
|
|
248
266
|
tool_c = f"{tool:<{w_tool}} " if show_tool else ""
|
|
267
|
+
term_c = f"{term:<{w_term}} " if show_terminal else ""
|
|
249
268
|
marker_c = f"{marker}{kind_icon}"
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
)
|
|
269
|
+
head = f" {marker_c:<2} {tool_c}{project:<{w_proj}} {prog:>{w_prog}} {ago:>{w_ago}}"
|
|
270
|
+
lines.append(f"{head} {term_c}📍{loc:<{w_loc}} {action}")
|
|
253
271
|
return "\n".join(lines)
|
|
254
272
|
|
|
255
273
|
|
|
@@ -280,6 +298,8 @@ def render_json(sessions: list[Session]) -> str:
|
|
|
280
298
|
"location": s.location,
|
|
281
299
|
"tmux_target": s.tmux_target,
|
|
282
300
|
"tty": s.tty,
|
|
301
|
+
"terminal": s.terminal,
|
|
302
|
+
"terminal_id": s.terminal_id,
|
|
283
303
|
"idle_seconds": round(s.idle_for, 1),
|
|
284
304
|
"last_active": s.last_active,
|
|
285
305
|
"last_action": s.last_action,
|
|
@@ -314,10 +334,11 @@ def render_oneline(sessions: list[Session]) -> str:
|
|
|
314
334
|
# ----------------------------------------------------------------------------- entry
|
|
315
335
|
def print_snapshot(sessions: list[Session], show_legend: bool) -> None:
|
|
316
336
|
show_tool = show_tool_column(sessions)
|
|
337
|
+
show_terminal = show_terminal_column(sessions)
|
|
317
338
|
if HAVE_RICH:
|
|
318
|
-
Console().print(_rich_renderable(sessions, show_legend, show_tool))
|
|
339
|
+
Console().print(_rich_renderable(sessions, show_legend, show_tool, show_terminal))
|
|
319
340
|
else:
|
|
320
|
-
print(_render_plain(sessions, show_legend, show_tool))
|
|
341
|
+
print(_render_plain(sessions, show_legend, show_tool, show_terminal))
|
|
321
342
|
|
|
322
343
|
|
|
323
344
|
def _format_config_value(value: object) -> str:
|
|
@@ -433,7 +454,7 @@ def watch(interval: float, count: int, show_all: bool, show_legend: bool) -> int
|
|
|
433
454
|
sys.stdout.write("\033[2J\033[H")
|
|
434
455
|
sessions = board(show_all)
|
|
435
456
|
_watch_flush_if_due(sessions)
|
|
436
|
-
print(_render_plain(sessions, show_legend, show_tool_column(sessions)))
|
|
457
|
+
print(_render_plain(sessions, show_legend, show_tool_column(sessions), show_terminal_column(sessions)))
|
|
437
458
|
print(f"\n{footer_text}")
|
|
438
459
|
sys.stdout.flush()
|
|
439
460
|
frames += 1
|
|
@@ -449,7 +470,9 @@ def watch(interval: float, count: int, show_all: bool, show_legend: bool) -> int
|
|
|
449
470
|
while True:
|
|
450
471
|
sessions = board(show_all)
|
|
451
472
|
_watch_flush_if_due(sessions)
|
|
452
|
-
body = _rich_renderable(
|
|
473
|
+
body = _rich_renderable(
|
|
474
|
+
sessions, show_legend, show_tool_column(sessions), show_terminal_column(sessions)
|
|
475
|
+
)
|
|
453
476
|
live.update(Group(body, Text(f"\n{footer_text}", style=_MUTED)), refresh=True)
|
|
454
477
|
frames += 1
|
|
455
478
|
if count and frames >= count:
|
|
@@ -54,6 +54,7 @@ from ring.registry import (
|
|
|
54
54
|
unhide_session,
|
|
55
55
|
)
|
|
56
56
|
from ring.stats import log_transition
|
|
57
|
+
from ring.terminal import detect_terminal_info
|
|
57
58
|
from ring.transcript import _extract_todo, _latest_action, _tail_records
|
|
58
59
|
from ring.waiting import (
|
|
59
60
|
FOREGROUND_OWNER,
|
|
@@ -476,6 +477,22 @@ def _update_session_state(
|
|
|
476
477
|
if tty:
|
|
477
478
|
payload["tty"] = tty
|
|
478
479
|
|
|
480
|
+
# terminal 種類/視窗識別:同 tmux_pane,subagent 事件與取不到時沿用前值。
|
|
481
|
+
previous_terminal = str(prev_row.get("terminal", "")) if same_binding else ""
|
|
482
|
+
previous_terminal_id = str(prev_row.get("terminal_id", "")) if same_binding else ""
|
|
483
|
+
if is_subagent_event:
|
|
484
|
+
terminal, terminal_id = previous_terminal, previous_terminal_id
|
|
485
|
+
else:
|
|
486
|
+
terminal, terminal_id = detect_terminal_info()
|
|
487
|
+
if not terminal:
|
|
488
|
+
terminal, terminal_id = previous_terminal, previous_terminal_id
|
|
489
|
+
elif not terminal_id and terminal == previous_terminal:
|
|
490
|
+
terminal_id = previous_terminal_id # 同一種 terminal 這次沒拿到 id:沿用前值
|
|
491
|
+
if terminal:
|
|
492
|
+
payload["terminal"] = terminal
|
|
493
|
+
if terminal_id:
|
|
494
|
+
payload["terminal_id"] = terminal_id
|
|
495
|
+
|
|
479
496
|
# waiting 通知冷卻(防翻轉轟炸):hook 是短命 process,冷卻狀態持久化在 registry row
|
|
480
497
|
# 的 waiting_notified_at(上次 waiting 通知的 epoch 時間戳)。離開 WAITING 也要把時間戳
|
|
481
498
|
# 帶進新 row(payload 每次重建,不帶會遺失),快速翻回 WAITING 時才判得出「還在冷卻期」。
|
|
Binary file
|