agent-command-tab 0.1.0__tar.gz → 0.2.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.
- {agent_command_tab-0.1.0/src/agent_command_tab.egg-info → agent_command_tab-0.2.0}/PKG-INFO +10 -10
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/README.md +9 -9
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/__init__.py +1 -1
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/agent_adapters/__init__.py +1 -1
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/agent_adapters/claude_code.py +3 -3
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/agent_process_tree.py +29 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/agent_session_pausing.py +22 -7
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/app_controller.py +143 -42
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/command_line.py +59 -16
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/context_window_usage.py +65 -20
- agent_command_tab-0.2.0/src/agent_command_tab/dashboard_core_api.py +41 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/hook_event_tracking.py +17 -2
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/hooks_installer.py +19 -5
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/iterm2_actions.py +11 -5
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/iterm2_connection_thread.py +252 -127
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/iterm2_snapshot_builder.py +22 -3
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/list_sorting.py +3 -1
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/session_status_computation.py +44 -9
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/settings_store.py +11 -3
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/snapshot_data_classes.py +22 -4
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/user_interface/agent_session_outline_view.py +686 -74
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/user_interface/named_colors.py +13 -3
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/user_interface/popover_container.py +51 -30
- agent_command_tab-0.2.0/src/agent_command_tab/user_interface/process_info_alert.py +121 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/user_interface/row_text_rendering.py +11 -5
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/user_interface/settings_window.py +49 -15
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/user_interface/sidebar_panel.py +15 -8
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/user_interface/sidebar_placement.py +2 -1
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/window_list_ordering.py +14 -7
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0/src/agent_command_tab.egg-info}/PKG-INFO +10 -10
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab.egg-info/SOURCES.txt +1 -1
- agent_command_tab-0.1.0/src/agent_command_tab/dashboard_core_api.py +0 -57
- agent_command_tab-0.1.0/src/agent_command_tab/tab_order_computation.py +0 -26
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/LICENSE +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/pyproject.toml +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/setup.cfg +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/agent_adapters/base.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/agent_adapters/codex.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/agent_adapters/generic.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/claude_code_transcript_records.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/docked_window_frames_store.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/global_shortcut_key_filter.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/hook_event_forwarder.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/hook_states_store.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/installed_copy_paths.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/messages_between_agent_sessions.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/monitor_assignment.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/pause_records_store.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/screen_readings.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/session_preview_computation.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/start_with_iterm2.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/user_interface/__init__.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/user_interface/agent_tool_icons.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/user_interface/app_icon.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/user_interface/control_helpers.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/user_interface/list_window.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/user_interface/menu_bar_status_item.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/user_interface/pointing_hand_button.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/user_interface/screen_layout.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/user_interface/talk_to_each_other_alert.py +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab.egg-info/dependency_links.txt +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab.egg-info/entry_points.txt +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab.egg-info/requires.txt +0 -0
- {agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agent-command-tab
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: macOS menu bar list, window or screen-edge sidebar of the iTerm2 tabs where AI coding agents run
|
|
5
5
|
Author: Ben Weisburd
|
|
6
6
|
License-Expression: MIT
|
|
@@ -25,17 +25,18 @@ Dynamic: license-file
|
|
|
25
25
|
|
|
26
26
|
# AgentCommandTab
|
|
27
27
|
|
|
28
|
-
A macOS menu bar app that lists the iTerm2 windows and tabs where AI coding agents run (Claude Code, OpenAI Codex CLI, and others), shows what each agent is doing, and lets you rename, focus, reorder and move those tabs without interrupting the agents.
|
|
28
|
+
A macOS menu bar app that lists the iTerm2 windows and tabs where AI coding agents run (Claude Code, OpenAI Codex CLI, and others), shows what each agent is doing, and lets you rename, focus, reorder and move those tabs without interrupting the agents.
|
|
29
29
|
|
|
30
30
|
## What it does
|
|
31
31
|
|
|
32
32
|
- **One tree of your agents:** every iTerm2 window with at least one agent tab, with its tabs below it, grouped by monitor when you have several. Tabs without an agent are left out.
|
|
33
|
-
- **What each agent is doing:** a status dot and word per tab (asking for permission, thinking, running a tool, stuck, running in the background, done, idle, error), how long it has been so, the context size in tokens, and optionally when it started, its memory and CPU use. "Done" stays until you look at the tab. The menu bar icon counts the agents waiting for your answer.
|
|
34
|
-
- **A preview per tab:** what the agent is asking or running, what it said since your last prompt, or that prompt.
|
|
33
|
+
- **What each agent is doing:** a status dot and word per tab (asking a question or for permission, thinking, running a tool, stuck, running in the background, done, new, idle, paused, error), how long it has been so, the context size in tokens and its share of the context window, and optionally when it started, how long it has run, its memory and CPU use. "Done" stays until you look at the tab, and a Claude Code session is "new" until you send it its first message. The menu bar icon counts the agents waiting for your answer.
|
|
34
|
+
- **A preview per tab:** what the agent is asking or running, what it said since your last prompt, or that prompt. The tab's arrow opens it, along with a row for each process the agent started (right-click one for Info or Kill).
|
|
35
35
|
- **Control:** double-click to bring a window or tab to the front; press and hold to peek at a tab; rename in place; drag tabs between windows and windows between monitors; start a new agent window or tab; duplicate a tab; type `/compact` or `/clear` into an agent waiting at its prompt; end an agent's process; pause agents (with every process they started) before going offline and resume them later, per tab, window, monitor or all at once. Select several rows (Command-click, Shift-click) to act on all their agents at once (a busy agent gets `/compact` or `/clear` when its turn ends), or to ask them to talk to each other: each gets your note and how to message the others.
|
|
36
|
-
- **
|
|
36
|
+
- **Keyboard:** Return shows the selected tab or window, Delete ends its agent (asking first), R renames it, the Right and Left arrows open and close a tab's preview, typing a name's first letters selects its row, Command-comma opens Settings, and Esc closes the list.
|
|
37
|
+
- **Sort and filter:** sort by activity, name, share of the context window, start time, last status change, memory or CPU use, or keep iTerm2's order; hide the idle tabs with one click or Command-I (new ones stay).
|
|
37
38
|
- **Your choice of view:** a dropdown under the menu bar icon, a sidebar that hides at the screen's edge or stays visible (optionally keeping iTerm2 windows out of its way), or a regular window (optionally always on top).
|
|
38
|
-
- **A shortcut from any app:** Shift-Command-Tab (or Command-Fn-Tab, chosen in Settings) shows the list, and hides it when pressed again. While macOS's app switcher is open, the keys still go to it.
|
|
39
|
+
- **A shortcut from any app:** Shift-Command-Tab (or Command-Fn-Tab, chosen in Settings) shows the list with the first agent waiting for your answer selected, and hides it when pressed again. While macOS's app switcher is open, the keys still go to it.
|
|
39
40
|
|
|
40
41
|
## Requirements
|
|
41
42
|
|
|
@@ -46,7 +47,6 @@ A macOS menu bar app that lists the iTerm2 windows and tabs where AI coding agen
|
|
|
46
47
|
|
|
47
48
|
```bash
|
|
48
49
|
pipx install agent-command-tab # or: pip install agent-command-tab
|
|
49
|
-
brew install bw2/tap/agent-command-tab # Homebrew adds the bw2/tap repository by itself
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
From a clone of this repository:
|
|
@@ -66,9 +66,9 @@ agent-command-tab --version # prints the installed version, for bug reports
|
|
|
66
66
|
|
|
67
67
|
Click the "C" in the menu bar to see the list, right-click it for Settings. The first time, iTerm2 asks whether to allow the app to use its Python API.
|
|
68
68
|
|
|
69
|
-
From its first start on, iTerm2 starts the app whenever iTerm2 starts: the app adds `AgentCommandTab.scpt` to iTerm2's AutoLaunch folder (`~/Library/Application Support/iTerm2/Scripts/AutoLaunch`), which starts the copy you ran, however you installed it. Started that way, it has iTerm2's permissions, as when you start it from an iTerm2 tab. Settings > Start with iTerm2 turns that off and removes the script. Only one copy runs at a time; starting another prints that one is already running. Before uninstalling, turn Start with iTerm2 off and run `agent-command-tab remove-hooks`, since pip and
|
|
69
|
+
From its first start on, iTerm2 starts the app whenever iTerm2 starts: the app adds `AgentCommandTab.scpt` to iTerm2's AutoLaunch folder (`~/Library/Application Support/iTerm2/Scripts/AutoLaunch`), which starts the copy you ran, however you installed it. Started that way, it has iTerm2's permissions, as when you start it from an iTerm2 tab. Settings > Start with iTerm2 turns that off and removes the script. Only one copy runs at a time; starting another prints that one is already running. Before uninstalling, turn Start with iTerm2 off and run `agent-command-tab remove-hooks`, since pip and pipx leave the script and the hooks behind.
|
|
70
70
|
|
|
71
|
-
The app's hooks tell a crashed agent from one that ended normally (its row stays, gray and "exited", for 5 minutes),
|
|
71
|
+
The app's hooks tell a crashed agent from one that ended normally (its row stays, gray and "exited", for 5 minutes), count Claude Code's background shells and agents, and tell when a Claude Code turn ends while one of those still runs. The list offers to install them (Install Hooks, at its bottom left) while an agent tool in it lacks them. The first time the app changes a settings file, it copies it to `<file>.agent-command-tab-backup`. Sessions started afterwards use them, and Codex asks you to approve them first: type `/hooks` in Codex.
|
|
72
72
|
|
|
73
73
|
The shortcut needs the Accessibility permission (System Settings > Privacy & Security > Accessibility), because it has to see the keys before macOS's app switcher does. macOS gives it to the app that starts AgentCommandTab, so started from iTerm2, turn it on for iTerm2. Until it is on, Settings show a button that opens that page.
|
|
74
74
|
|
|
@@ -82,4 +82,4 @@ The shortcut needs the Accessibility permission (System Settings > Privacy & Sec
|
|
|
82
82
|
|
|
83
83
|
## License
|
|
84
84
|
|
|
85
|
-
MIT; see [LICENSE](https://github.com/bw2/agent-command-tab/blob/main/LICENSE). The app uses iTerm2's `iterm2` Python package, which is licensed GPL-2.0-or-later. pip and
|
|
85
|
+
MIT; see [LICENSE](https://github.com/bw2/agent-command-tab/blob/main/LICENSE). The app uses iTerm2's `iterm2` Python package, which is licensed GPL-2.0-or-later. pip and pipx install it alongside as a separate package.
|
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
# AgentCommandTab
|
|
4
4
|
|
|
5
|
-
A macOS menu bar app that lists the iTerm2 windows and tabs where AI coding agents run (Claude Code, OpenAI Codex CLI, and others), shows what each agent is doing, and lets you rename, focus, reorder and move those tabs without interrupting the agents.
|
|
5
|
+
A macOS menu bar app that lists the iTerm2 windows and tabs where AI coding agents run (Claude Code, OpenAI Codex CLI, and others), shows what each agent is doing, and lets you rename, focus, reorder and move those tabs without interrupting the agents.
|
|
6
6
|
|
|
7
7
|
## What it does
|
|
8
8
|
|
|
9
9
|
- **One tree of your agents:** every iTerm2 window with at least one agent tab, with its tabs below it, grouped by monitor when you have several. Tabs without an agent are left out.
|
|
10
|
-
- **What each agent is doing:** a status dot and word per tab (asking for permission, thinking, running a tool, stuck, running in the background, done, idle, error), how long it has been so, the context size in tokens, and optionally when it started, its memory and CPU use. "Done" stays until you look at the tab. The menu bar icon counts the agents waiting for your answer.
|
|
11
|
-
- **A preview per tab:** what the agent is asking or running, what it said since your last prompt, or that prompt.
|
|
10
|
+
- **What each agent is doing:** a status dot and word per tab (asking a question or for permission, thinking, running a tool, stuck, running in the background, done, new, idle, paused, error), how long it has been so, the context size in tokens and its share of the context window, and optionally when it started, how long it has run, its memory and CPU use. "Done" stays until you look at the tab, and a Claude Code session is "new" until you send it its first message. The menu bar icon counts the agents waiting for your answer.
|
|
11
|
+
- **A preview per tab:** what the agent is asking or running, what it said since your last prompt, or that prompt. The tab's arrow opens it, along with a row for each process the agent started (right-click one for Info or Kill).
|
|
12
12
|
- **Control:** double-click to bring a window or tab to the front; press and hold to peek at a tab; rename in place; drag tabs between windows and windows between monitors; start a new agent window or tab; duplicate a tab; type `/compact` or `/clear` into an agent waiting at its prompt; end an agent's process; pause agents (with every process they started) before going offline and resume them later, per tab, window, monitor or all at once. Select several rows (Command-click, Shift-click) to act on all their agents at once (a busy agent gets `/compact` or `/clear` when its turn ends), or to ask them to talk to each other: each gets your note and how to message the others.
|
|
13
|
-
- **
|
|
13
|
+
- **Keyboard:** Return shows the selected tab or window, Delete ends its agent (asking first), R renames it, the Right and Left arrows open and close a tab's preview, typing a name's first letters selects its row, Command-comma opens Settings, and Esc closes the list.
|
|
14
|
+
- **Sort and filter:** sort by activity, name, share of the context window, start time, last status change, memory or CPU use, or keep iTerm2's order; hide the idle tabs with one click or Command-I (new ones stay).
|
|
14
15
|
- **Your choice of view:** a dropdown under the menu bar icon, a sidebar that hides at the screen's edge or stays visible (optionally keeping iTerm2 windows out of its way), or a regular window (optionally always on top).
|
|
15
|
-
- **A shortcut from any app:** Shift-Command-Tab (or Command-Fn-Tab, chosen in Settings) shows the list, and hides it when pressed again. While macOS's app switcher is open, the keys still go to it.
|
|
16
|
+
- **A shortcut from any app:** Shift-Command-Tab (or Command-Fn-Tab, chosen in Settings) shows the list with the first agent waiting for your answer selected, and hides it when pressed again. While macOS's app switcher is open, the keys still go to it.
|
|
16
17
|
|
|
17
18
|
## Requirements
|
|
18
19
|
|
|
@@ -23,7 +24,6 @@ A macOS menu bar app that lists the iTerm2 windows and tabs where AI coding agen
|
|
|
23
24
|
|
|
24
25
|
```bash
|
|
25
26
|
pipx install agent-command-tab # or: pip install agent-command-tab
|
|
26
|
-
brew install bw2/tap/agent-command-tab # Homebrew adds the bw2/tap repository by itself
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
From a clone of this repository:
|
|
@@ -43,9 +43,9 @@ agent-command-tab --version # prints the installed version, for bug reports
|
|
|
43
43
|
|
|
44
44
|
Click the "C" in the menu bar to see the list, right-click it for Settings. The first time, iTerm2 asks whether to allow the app to use its Python API.
|
|
45
45
|
|
|
46
|
-
From its first start on, iTerm2 starts the app whenever iTerm2 starts: the app adds `AgentCommandTab.scpt` to iTerm2's AutoLaunch folder (`~/Library/Application Support/iTerm2/Scripts/AutoLaunch`), which starts the copy you ran, however you installed it. Started that way, it has iTerm2's permissions, as when you start it from an iTerm2 tab. Settings > Start with iTerm2 turns that off and removes the script. Only one copy runs at a time; starting another prints that one is already running. Before uninstalling, turn Start with iTerm2 off and run `agent-command-tab remove-hooks`, since pip and
|
|
46
|
+
From its first start on, iTerm2 starts the app whenever iTerm2 starts: the app adds `AgentCommandTab.scpt` to iTerm2's AutoLaunch folder (`~/Library/Application Support/iTerm2/Scripts/AutoLaunch`), which starts the copy you ran, however you installed it. Started that way, it has iTerm2's permissions, as when you start it from an iTerm2 tab. Settings > Start with iTerm2 turns that off and removes the script. Only one copy runs at a time; starting another prints that one is already running. Before uninstalling, turn Start with iTerm2 off and run `agent-command-tab remove-hooks`, since pip and pipx leave the script and the hooks behind.
|
|
47
47
|
|
|
48
|
-
The app's hooks tell a crashed agent from one that ended normally (its row stays, gray and "exited", for 5 minutes),
|
|
48
|
+
The app's hooks tell a crashed agent from one that ended normally (its row stays, gray and "exited", for 5 minutes), count Claude Code's background shells and agents, and tell when a Claude Code turn ends while one of those still runs. The list offers to install them (Install Hooks, at its bottom left) while an agent tool in it lacks them. The first time the app changes a settings file, it copies it to `<file>.agent-command-tab-backup`. Sessions started afterwards use them, and Codex asks you to approve them first: type `/hooks` in Codex.
|
|
49
49
|
|
|
50
50
|
The shortcut needs the Accessibility permission (System Settings > Privacy & Security > Accessibility), because it has to see the keys before macOS's app switcher does. macOS gives it to the app that starts AgentCommandTab, so started from iTerm2, turn it on for iTerm2. Until it is on, Settings show a button that opens that page.
|
|
51
51
|
|
|
@@ -59,4 +59,4 @@ The shortcut needs the Accessibility permission (System Settings > Privacy & Sec
|
|
|
59
59
|
|
|
60
60
|
## License
|
|
61
61
|
|
|
62
|
-
MIT; see [LICENSE](https://github.com/bw2/agent-command-tab/blob/main/LICENSE). The app uses iTerm2's `iterm2` Python package, which is licensed GPL-2.0-or-later. pip and
|
|
62
|
+
MIT; see [LICENSE](https://github.com/bw2/agent-command-tab/blob/main/LICENSE). The app uses iTerm2's `iterm2` Python package, which is licensed GPL-2.0-or-later. pip and pipx install it alongside as a separate package.
|
{agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/agent_adapters/__init__.py
RENAMED
|
@@ -33,7 +33,7 @@ def find_agent_tool_adapter_for_tab(command_line, iterm2_status_value, specific_
|
|
|
33
33
|
command_line: iTerm2's `commandLine` for the tab's first session.
|
|
34
34
|
iterm2_status_value: The value iTerm2 set in that session's `status` variable after its
|
|
35
35
|
foreground job started, or None (find_status_set_in_iterm2_since_the_job_started).
|
|
36
|
-
specific_adapters: Adapters tried in order (Claude Code, Codex
|
|
36
|
+
specific_adapters: Adapters tried in order (Claude Code, then Codex).
|
|
37
37
|
generic_adapter: Used when no specific adapter matches, the job is not a shell, and the
|
|
38
38
|
status variable holds a recognized value.
|
|
39
39
|
|
|
@@ -12,6 +12,7 @@ from agent_command_tab.agent_process_tree import read_process_arguments_and_envi
|
|
|
12
12
|
from agent_command_tab.context_window_usage import (choose_claude_code_context_window_tokens, find_claude_code_transcript,
|
|
13
13
|
read_claude_code_model_setting,
|
|
14
14
|
read_context_tokens_from_claude_code_transcript,
|
|
15
|
+
read_model_from_claude_code_transcript,
|
|
15
16
|
read_turn_started_at_from_claude_code_transcript)
|
|
16
17
|
from agent_command_tab.session_preview_computation import read_preview_fields_from_claude_code_transcript
|
|
17
18
|
|
|
@@ -85,8 +86,7 @@ class ClaudeCodeAdapter(AgentToolAdapter):
|
|
|
85
86
|
|
|
86
87
|
async def find_conversation_file(self, agent_process_id, claude_agent_record, claude_config_folders):
|
|
87
88
|
"""Returns the transcript named after the record's `sessionId`: in the record's own config
|
|
88
|
-
folder first
|
|
89
|
-
the config folders."""
|
|
89
|
+
folder first, else in one of the config folders."""
|
|
90
90
|
conversation_id = await self.find_conversation_id(agent_process_id, claude_agent_record)
|
|
91
91
|
if not conversation_id:
|
|
92
92
|
return None
|
|
@@ -99,7 +99,7 @@ class ClaudeCodeAdapter(AgentToolAdapter):
|
|
|
99
99
|
def read_context_window_tokens(self, conversation_file_path, agent_process_id, claude_agent_record, context_tokens):
|
|
100
100
|
return choose_claude_code_context_window_tokens(read_claude_code_model_setting(
|
|
101
101
|
*read_process_arguments_and_environment(agent_process_id), (claude_agent_record or {}).get("config_folder")),
|
|
102
|
-
context_tokens)
|
|
102
|
+
read_model_from_claude_code_transcript(conversation_file_path), context_tokens)
|
|
103
103
|
|
|
104
104
|
def read_turn_started_at(self, conversation_file_path):
|
|
105
105
|
return read_turn_started_at_from_claude_code_transcript(conversation_file_path)
|
{agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/agent_process_tree.py
RENAMED
|
@@ -472,6 +472,35 @@ def read_child_processes(agent_process_id, turn_is_under_way, turn_started_at, r
|
|
|
472
472
|
return sorted(child_processes, key=lambda child_process: child_process["child"].started_at) # oldest first, detached ones too
|
|
473
473
|
|
|
474
474
|
|
|
475
|
+
def read_process_details(process_id):
|
|
476
|
+
"""Returns what a sub row's Info shows about its process (user request, 2026-10-29), or None
|
|
477
|
+
if it is gone: {"process_id", "command_line": its arguments as ps shows them, "agent_command":
|
|
478
|
+
the command in it as the agent wrote it, for a Claude Code shell, else None, "working_folder"
|
|
479
|
+
("" if unknown), "started_at", "subprocesses": [{"process_id", "command_text"
|
|
480
|
+
(build_command_text's)}] of the processes below it, oldest first (user request, 2026-10-29),
|
|
481
|
+
and "memory_bytes" and "cpu_seconds" (read_process_tree_resource_usage's), its and theirs
|
|
482
|
+
together}. The command line keeps its line breaks, as a command with a heredoc has them."""
|
|
483
|
+
process = read_process_info(process_id)
|
|
484
|
+
resource_usage = read_process_tree_resource_usage(process_id)
|
|
485
|
+
if process is None or resource_usage is None:
|
|
486
|
+
return None
|
|
487
|
+
arguments = read_process_arguments_and_environment(process_id)[0]
|
|
488
|
+
processes_below = sorted(list_descendant_processes(process_id, maximum_depth=None), key=lambda process_below: process_below.started_at)
|
|
489
|
+
return {
|
|
490
|
+
"process_id": process_id,
|
|
491
|
+
"command_line": " ".join(arguments) or process.name,
|
|
492
|
+
"agent_command": find_the_command_a_claude_code_shell_runs(arguments),
|
|
493
|
+
"working_folder": read_process_current_folder(process_id),
|
|
494
|
+
"started_at": process.started_at,
|
|
495
|
+
"subprocesses": [
|
|
496
|
+
{"process_id": process_below.process_id,
|
|
497
|
+
"command_text": build_command_text(read_process_arguments_and_environment(process_below.process_id)[0], process_below.name)}
|
|
498
|
+
for process_below in processes_below],
|
|
499
|
+
"memory_bytes": resource_usage[0],
|
|
500
|
+
"cpu_seconds": resource_usage[1],
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
|
|
475
504
|
def choose_helper_process_ids(descendant_processes):
|
|
476
505
|
"""Returns the IDs of the processes running below an agent between its turns (MCP servers, for
|
|
477
506
|
example), which choose_command_the_agent_is_waiting_on never takes for a command, nor anything
|
{agent_command_tab-0.1.0 → agent_command_tab-0.2.0}/src/agent_command_tab/agent_session_pausing.py
RENAMED
|
@@ -147,22 +147,36 @@ async def read_the_shell_prompt(session, agent_process_id):
|
|
|
147
147
|
return None
|
|
148
148
|
|
|
149
149
|
|
|
150
|
-
def list_processes_below_the_agent_to_stop(agent_process_id):
|
|
150
|
+
def list_processes_below_the_agent_to_stop(agent_process_id, detached_processes=()):
|
|
151
151
|
"""Returns ({process ID: ProcessInfo} of the processes below the agent a pause stops, the IDs
|
|
152
152
|
of those below it that belong to another user, which it can't stop: a command run with sudo).
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
The detached processes its conversation started (launchd adopted them when their shell ended,
|
|
154
|
+
and the list shows them under the agent) count as below it, with the processes below them
|
|
155
|
+
(code review, 2026-10-29). Leaves out the dashboard's own process, those it runs in and those
|
|
156
|
+
it started, so a dashboard started from the agent's own commands keeps running.
|
|
157
|
+
|
|
158
|
+
Args:
|
|
159
|
+
agent_process_id: The agent's process.
|
|
160
|
+
detached_processes: The ProcessInfo of each detached process its conversation started
|
|
161
|
+
(agent_process_tree.choose_detached_processes_of_the_conversation's).
|
|
162
|
+
"""
|
|
155
163
|
dashboard_process_ids = set(list_the_process_and_its_ancestor_ids(os.getpid())) | {
|
|
156
164
|
process.process_id
|
|
157
165
|
for process in list_descendant_processes_and_other_users_process_ids(os.getpid(), maximum_depth=None)[0]}
|
|
158
166
|
processes_below, other_users_process_ids_below = list_descendant_processes_and_other_users_process_ids(
|
|
159
167
|
agent_process_id, maximum_depth=None)
|
|
168
|
+
for detached_process in detached_processes:
|
|
169
|
+
processes_below_the_detached_process, other_users_process_ids_below_the_detached_process = \
|
|
170
|
+
list_descendant_processes_and_other_users_process_ids(detached_process.process_id, maximum_depth=None)
|
|
171
|
+
processes_below = processes_below + [detached_process] + processes_below_the_detached_process
|
|
172
|
+
other_users_process_ids_below = other_users_process_ids_below + other_users_process_ids_below_the_detached_process
|
|
160
173
|
return ({process.process_id: process for process in processes_below if process.process_id not in dashboard_process_ids},
|
|
161
174
|
other_users_process_ids_below)
|
|
162
175
|
|
|
163
176
|
|
|
164
|
-
async def pause_agent_session(session, agent_process_id, agent_tool_name):
|
|
165
|
-
"""Suspends the agent like Ctrl+Z, then stops every process below it
|
|
177
|
+
async def pause_agent_session(session, agent_process_id, agent_tool_name, detached_processes=()):
|
|
178
|
+
"""Suspends the agent like Ctrl+Z, then stops every process below it, the detached processes
|
|
179
|
+
its conversation started included (list_processes_below_the_agent_to_stop).
|
|
166
180
|
|
|
167
181
|
An agent that doesn't take Ctrl+Z as "suspend" (an older Claude Code took it as undo) gets
|
|
168
182
|
SIGTSTP, the signal Ctrl+Z sends in an ordinary terminal, and SIGSTOP, which nothing can
|
|
@@ -174,6 +188,7 @@ async def pause_agent_session(session, agent_process_id, agent_tool_name):
|
|
|
174
188
|
session: The tab's iterm2.Session.
|
|
175
189
|
agent_process_id: The agent's process.
|
|
176
190
|
agent_tool_name: The agent's tool, as its row names it.
|
|
191
|
+
detached_processes: The ProcessInfo of each detached process its conversation started.
|
|
177
192
|
|
|
178
193
|
Returns:
|
|
179
194
|
(ActionResult, PauseRecord), or (a failed ActionResult, None) when the agent is gone. The
|
|
@@ -184,7 +199,7 @@ async def pause_agent_session(session, agent_process_id, agent_tool_name):
|
|
|
184
199
|
if agent is None:
|
|
185
200
|
return ActionResult(False, "the agent's process has ended"), None
|
|
186
201
|
was_suspended_by_hand = process_is_stopped(agent_process_id)
|
|
187
|
-
processes_below, other_users_process_ids_below = list_processes_below_the_agent_to_stop(agent_process_id)
|
|
202
|
+
processes_below, other_users_process_ids_below = list_processes_below_the_agent_to_stop(agent_process_id, detached_processes)
|
|
188
203
|
if not was_suspended_by_hand:
|
|
189
204
|
await session.async_send_text(CONTROL_Z, suppress_broadcast=True)
|
|
190
205
|
if not await wait_until(lambda: process_is_stopped(agent_process_id), SECONDS_TO_WAIT_FOR_CONTROL_Z):
|
|
@@ -192,7 +207,7 @@ async def pause_agent_session(session, agent_process_id, agent_tool_name):
|
|
|
192
207
|
if not await wait_until(lambda: process_is_stopped(agent_process_id), SECONDS_TO_WAIT_FOR_SIGTSTP):
|
|
193
208
|
send_signal_to_processes([agent_process_id], signal.SIGSTOP)
|
|
194
209
|
processes_started_meanwhile, other_users_process_ids_started_meanwhile = list_processes_below_the_agent_to_stop(
|
|
195
|
-
agent_process_id)
|
|
210
|
+
agent_process_id, detached_processes)
|
|
196
211
|
processes_below.update(processes_started_meanwhile)
|
|
197
212
|
other_users_process_ids_below = sorted(set(other_users_process_ids_below) | set(other_users_process_ids_started_meanwhile))
|
|
198
213
|
stopped_process_ids = set(send_signal_to_processes(sorted(processes_below), signal.SIGSTOP))
|