webbee 0.7.32__tar.gz → 0.7.34__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.
- {webbee-0.7.32 → webbee-0.7.34}/CHANGELOG.md +16 -0
- {webbee-0.7.32 → webbee-0.7.34}/PKG-INFO +1 -1
- {webbee-0.7.32 → webbee-0.7.34}/pyproject.toml +1 -1
- webbee-0.7.34/src/webbee/__init__.py +1 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/jobs.py +6 -1
- webbee-0.7.34/src/webbee/jobs_panel.py +101 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/jobwatch.py +13 -4
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/repl.py +25 -1
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/session.py +50 -30
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/slots.py +2 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/tools.py +16 -5
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/tui.py +60 -6
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_jobs_1127.py +168 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_tui.py +10 -3
- {webbee-0.7.32 → webbee-0.7.34}/uv.lock +1 -1
- webbee-0.7.32/src/webbee/__init__.py +0 -1
- {webbee-0.7.32 → webbee-0.7.34}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/.github/pull_request_template.md +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/.github/workflows/os-check.yml +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/.github/workflows/publish.yml +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/.gitignore +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/LICENSE +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/PRIVACY.md +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/README.md +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/SECURITY.md +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/assets/architecture.png +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/assets/demo.gif +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/assets/hero.png +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/assets/social-preview.png +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/__init__.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/__init__.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/drivers.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/fixture.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/fixture_long.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/fixture_wait.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/provision_user.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/registry.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/replay.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/run.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/scenarios_account.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/scenarios_code.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/scenarios_contract.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/scenarios_long.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/scenarios_wait.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/test_drivers.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/test_fixture.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/test_fixture_long.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/test_fixture_wait.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/test_registry.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/test_replay.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/field_gate/wipe.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/ci/os_check.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/dev-webbee +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/install.sh +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/__main__.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/_launch.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/account.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/active_sessions.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/autoupdate.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/banner_art.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/boot.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/browser.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/checkpoints.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/cli.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/clipboard.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/clipboard_read.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/clipboard_session.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/coding_context.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/commands.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/config.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/consent.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/details.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/events.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/expand.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/frames.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/home.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/home_view.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/http.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/instance_lock.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/intel/__init__.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/intel/graph.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/intel/outline.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/intel/query.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/intel/service.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/intel/store.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/intel/tree.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/intel/watch.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/loop_errors.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/media.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/modals.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/mode_store.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/native_files.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/native_read.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/newtab_mode.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/output_pane.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/pricing_constants.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/queue_panel.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/reflow.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/remote.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/render.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/repo.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/selection.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/sessions.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/sizing.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/stallwatch.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/steer.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/stream.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/tab_store.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/tabs.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/thread.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/tier_store.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/todo_panel.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/tokens.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/update.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/urlopen.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/wallet.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/src/webbee/worktrees.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/__init__.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/conftest.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_account.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_active_sessions.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_append_file.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_audit_2026_07_25_findings.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_autoupdate.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_checkpoints.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_checkpoints_nested_1030.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_cli.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_clipboard.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_clipboard_read.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_code_map_fresh.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_coding_context.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_commands.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_config.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_cpc_contract_stable.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_cpc_outline.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_cross_loop_token.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_details.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_events.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_expand.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_field_test_1113.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_freeze_fix.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_home.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_home_view.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_home_view_mouse.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_inspect_page.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_instance_lock.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_intel_any_folder.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_intel_cache_and_sync_worker.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_intel_checksum_tree.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_intel_chunker.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_intel_embed.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_intel_folder_1106.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_intel_graph.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_intel_no_numpy.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_intel_query.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_intel_service.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_intel_store.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_intel_watch.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_launch.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_loop_errors.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_marathon.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_modals_e2e.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_mode_and_remote_0_6_8.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_mode_store.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_native_files.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_newtab_mode.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_packaging.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_probe_cost.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_queue_manage_0337.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_read_never_waits_for_the_repo.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_reflow.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_remote_code_reads.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_render.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_repl.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_repo.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_resilient_http.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_result_fits_the_door.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_review_fixes_1030.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_session.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_session_review_1030.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_sessions.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_sizing.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_slots.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_ssh_guard.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_stallwatch.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_steer.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_stream.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_tab_bar_stability.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_tab_restore_0337.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_tabs.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_terminal_ux_0336.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_thread.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_tier_invalidation.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_tier_store.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_todo_panel.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_tokens.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_tool_ack.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_tools.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_tools_eol_cancel_1030.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_tools_vision_websearch.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_tray_1126.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_tui_hardening.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_update.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_update_badge_0340.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_urlopen.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_version.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_version_badge_corner.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_voice_outcome.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_wallet.py +0 -0
- {webbee-0.7.32 → webbee-0.7.34}/tests/test_worktrees.py +0 -0
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.34
|
|
4
|
+
|
|
5
|
+
* A command that outlasts its wait is no longer killed. When the time Webbee gave a command runs out, the command
|
|
6
|
+
runs on as a background job of the session and she is told its number, so she goes on with other work and
|
|
7
|
+
hears of its end. A test run cut a minute before its end used to start again from nothing. If the kernel cannot
|
|
8
|
+
take the job, the command is stopped as before.
|
|
9
|
+
|
|
10
|
+
## 0.7.33
|
|
11
|
+
|
|
12
|
+
* The background strip. A narrow panel above the input shows the session's jobs on this machine: each running
|
|
13
|
+
one with how long it has run, and one that ended in the last ten minutes. A click on a job prints its output
|
|
14
|
+
so far, the ✕ of a running one ends it, a click on the head folds the strip to one line. It takes no room at
|
|
15
|
+
all while the session has no job.
|
|
16
|
+
* The status line offers the background when it can really be done: a command Webbee has waited for longer than
|
|
17
|
+
eight seconds shows "Ctrl+Z ⇢ run it in the background" in the hint's place.
|
|
18
|
+
|
|
3
19
|
## 0.7.32
|
|
4
20
|
|
|
5
21
|
* A step says what it is about. A call that names no file, pattern or command - a read of a stored output, a
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.7.34"
|
|
@@ -172,10 +172,15 @@ def mine(session_id: str, home: str = "") -> list:
|
|
|
172
172
|
started = os.stat(os.path.join(path, "pid")).st_mtime
|
|
173
173
|
except OSError:
|
|
174
174
|
started = 0.0
|
|
175
|
+
try:
|
|
176
|
+
told_at = os.stat(os.path.join(path, REPORTED)).st_mtime
|
|
177
|
+
except OSError:
|
|
178
|
+
told_at = 0.0
|
|
175
179
|
out.append({"n": got[1], "id": sj.job_id(got[1]), "path": path,
|
|
176
180
|
"title": _read(os.path.join(path, "title"), 400).strip(),
|
|
177
181
|
"command": _read(os.path.join(path, "cmd"), 2000).strip(),
|
|
178
|
-
"reported": _read(os.path.join(path, REPORTED), 40).strip(), "started": started
|
|
182
|
+
"reported": _read(os.path.join(path, REPORTED), 40).strip(), "started": started,
|
|
183
|
+
"reported_at": told_at})
|
|
179
184
|
return sorted(out, key=lambda j: j["n"])
|
|
180
185
|
|
|
181
186
|
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"""The background strip: a narrow panel pinned above the input that shows the session's jobs on this machine and
|
|
2
|
+
lets the person act on one (the owner, 2026-11-27: "a narrow, handy field above the prompt where you see that
|
|
3
|
+
something is in the background and can interact with it -- neat, useful, without breaking the look").
|
|
4
|
+
|
|
5
|
+
It follows the queue strip (``queue_panel``) in everything that makes that one safe: the builders are PURE, the
|
|
6
|
+
dock mounts them in a ConditionalContainer that takes ZERO rows while there is nothing to show, each row is one
|
|
7
|
+
line, a row's mouse handler fires on MOUSE_UP only and gives the output pane first refusal (a drag released here is
|
|
8
|
+
not a click). So a session with no job looks exactly as before.
|
|
9
|
+
|
|
10
|
+
⚙ background (2) ▾ · click a job for its output · ✕ ends it
|
|
11
|
+
j2 · done · npm run build
|
|
12
|
+
j3 · running 2:14 · make test ✕
|
|
13
|
+
|
|
14
|
+
A row is a job that runs, or one that ended a short while ago (so its end is seen without scrolling the output);
|
|
15
|
+
the newest stands nearest the input. A click on a row prints that job's output so far; ✕ on a running one ends it."""
|
|
16
|
+
import time
|
|
17
|
+
|
|
18
|
+
from webbee.queue_panel import _item_handler, _toggle_handler, one_line
|
|
19
|
+
|
|
20
|
+
JP_MAX_ITEMS = 3 # rows shown; more add one "… +K more" row -- the strip stays narrow
|
|
21
|
+
RECENT_S = 600.0 # an ended job stays in the strip this long
|
|
22
|
+
_STATE = {"running": "running", "done": "done", "failed": "failed", "cancelled": "cancelled", "lost": "lost",
|
|
23
|
+
"unknown": "ended"}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def shown(rows, now: float = 0.0, recent_s: float = RECENT_S) -> list:
|
|
27
|
+
"""PURE. The jobs the strip shows, oldest first: every running one, and one that ended within ``recent_s``."""
|
|
28
|
+
now = now or time.time()
|
|
29
|
+
out = []
|
|
30
|
+
for r in rows or ():
|
|
31
|
+
if not isinstance(r, dict):
|
|
32
|
+
continue
|
|
33
|
+
if r.get("state") == "running" or now - float(r.get("ended_at") or 0.0) <= recent_s:
|
|
34
|
+
out.append(r)
|
|
35
|
+
return sorted(out, key=lambda r: int(r.get("n") or 0))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def jobs_height(rows, collapsed: bool = False, max_items: int = JP_MAX_ITEMS, now: float = 0.0) -> int:
|
|
39
|
+
"""PURE. Rows the strip takes: 0 with nothing to show, 1 collapsed, else the header and one per shown job (and
|
|
40
|
+
one "+K more" row for the rest)."""
|
|
41
|
+
n = len(shown(rows, now))
|
|
42
|
+
if not n:
|
|
43
|
+
return 0
|
|
44
|
+
if collapsed:
|
|
45
|
+
return 1
|
|
46
|
+
return 1 + min(n, max_items) + (1 if n > max_items else 0)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _elapsed(seconds: float) -> str:
|
|
50
|
+
s = max(0, int(seconds))
|
|
51
|
+
return f"{s // 3600}:{s % 3600 // 60:02d}:{s % 60:02d}" if s >= 3600 else f"{s // 60}:{s % 60:02d}"
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def row_text(job: dict, now: float) -> str:
|
|
55
|
+
"""PURE. One job as its row says it: id, state (a running one with how long), what it is."""
|
|
56
|
+
state = str(job.get("state") or "")
|
|
57
|
+
word = _STATE.get(state, state or "?")
|
|
58
|
+
if state == "running" and job.get("started"):
|
|
59
|
+
word += " " + _elapsed(now - float(job["started"]))
|
|
60
|
+
elif state == "failed" and job.get("exit_code") is not None:
|
|
61
|
+
word += f" (exit {job['exit_code']})"
|
|
62
|
+
what = str(job.get("title") or job.get("command") or "").strip()
|
|
63
|
+
return f"{job.get('id') or 'j?'} · {word}" + (f" · {what}" if what else "")
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def jobs_fragments(rows, width: int = 0, collapsed: bool = False, toggle=None, open_job=None, end_job=None,
|
|
67
|
+
max_items: int = JP_MAX_ITEMS, forward=None, now: float = 0.0) -> list:
|
|
68
|
+
"""PURE builder: the strip as prompt_toolkit formatted text, re-made at every redraw. ``open_job(n)`` /
|
|
69
|
+
``end_job(n)`` are the dock's actions for a click on a row and on its ✕; without them the rows are plain."""
|
|
70
|
+
now = now or time.time()
|
|
71
|
+
jobs = shown(rows, now)
|
|
72
|
+
if not jobs:
|
|
73
|
+
return []
|
|
74
|
+
running = sum(1 for j in jobs if j.get("state") == "running")
|
|
75
|
+
marker = "" if toggle is None else (" ▸" if collapsed else " ▾")
|
|
76
|
+
head = f" ⚙ background ({running} running)" if running else f" ⚙ background ({len(jobs)} ended)"
|
|
77
|
+
header = ("class:jp.header", head + marker)
|
|
78
|
+
if toggle is not None:
|
|
79
|
+
header = header + (_toggle_handler(toggle, forward),)
|
|
80
|
+
frags = [header]
|
|
81
|
+
if collapsed:
|
|
82
|
+
return frags
|
|
83
|
+
if open_job is not None:
|
|
84
|
+
frags.append(("class:jp.item", " · click a job for its output" + (" · ✕ ends it" if end_job and running else "")))
|
|
85
|
+
start = max(0, len(jobs) - max_items)
|
|
86
|
+
if start:
|
|
87
|
+
frags.append(("class:jp.item", f"\n … +{start} more · /jobs lists them all"))
|
|
88
|
+
for job in jobs[start:]:
|
|
89
|
+
n = int(job.get("n") or 0)
|
|
90
|
+
live = job.get("state") == "running"
|
|
91
|
+
can_end = live and end_job is not None
|
|
92
|
+
avail = (width - 4 - (2 if can_end else 0)) if width > 0 else 0
|
|
93
|
+
text = "\n " + one_line(row_text(job, now), avail)
|
|
94
|
+
style = "class:jp.live" if live else ("class:jp.bad" if job.get("state") in ("failed", "lost") else "class:jp.item")
|
|
95
|
+
if open_job is None:
|
|
96
|
+
frags.append((style, text))
|
|
97
|
+
else:
|
|
98
|
+
frags.append((style, text, _item_handler(open_job, n, forward)))
|
|
99
|
+
if can_end:
|
|
100
|
+
frags.append(("class:jp.end", " ✕", _item_handler(end_job, n, forward)))
|
|
101
|
+
return frags
|
|
@@ -31,7 +31,7 @@ def due(prev, state: str, now: float, heartbeat: float = HEARTBEAT_S) -> bool:
|
|
|
31
31
|
return prev is None or prev[0] != state or now - prev[1] >= heartbeat
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
async def watch(*, session_id, post, on_line=None, on_count=None, tick: float = TICK_S,
|
|
34
|
+
async def watch(*, session_id, post, on_line=None, on_count=None, on_rows=None, tick: float = TICK_S,
|
|
35
35
|
heartbeat: float = HEARTBEAT_S,
|
|
36
36
|
home: str = "", _monotonic=None, _sleep=None) -> None:
|
|
37
37
|
"""Run until cancelled. Seams, all given by the terminal's wiring:
|
|
@@ -39,7 +39,9 @@ async def watch(*, session_id, post, on_line=None, on_count=None, tick: float =
|
|
|
39
39
|
* post(sid, n, stdout) -- async; sends one report and returns the kernel's answer
|
|
40
40
|
(``{ok, state, ended, already, line}``) or None when it did not get through (told again at the next tick);
|
|
41
41
|
* on_line(text) -- sync; shows the person a job's line when the kernel took its end;
|
|
42
|
-
* on_count(n) -- sync; how many of the session's jobs run on this machine now (the toolbar's number)
|
|
42
|
+
* on_count(n) -- sync; how many of the session's jobs run on this machine now (the toolbar's number);
|
|
43
|
+
* on_rows(rows) -- sync; every job of the session on this machine as the background strip shows it
|
|
44
|
+
(``{n, id, title, command, state, exit_code, started, ended_at}``), read at this look.
|
|
43
45
|
Fail-soft: any error skips the tick; the jobs are on disk and the next tick reads them again."""
|
|
44
46
|
if not jobs.supported():
|
|
45
47
|
return
|
|
@@ -58,14 +60,19 @@ async def watch(*, session_id, post, on_line=None, on_count=None, tick: float =
|
|
|
58
60
|
sid = str(await session_id() or "")
|
|
59
61
|
if not sid:
|
|
60
62
|
continue
|
|
61
|
-
running = 0
|
|
63
|
+
running, rows = 0, []
|
|
62
64
|
for job in await asyncio.to_thread(jobs.mine, sid, home):
|
|
65
|
+
row = {k: job[k] for k in ("n", "id", "title", "command", "started")}
|
|
63
66
|
if job["reported"]:
|
|
67
|
+
rows.append({**row, "state": job["reported"], "exit_code": None, "ended_at": job["reported_at"]})
|
|
64
68
|
continue
|
|
65
69
|
key = (sid, job["n"])
|
|
66
70
|
out = await asyncio.to_thread(jobs.poll, sid, job["n"], home)
|
|
67
|
-
|
|
71
|
+
got = sj.read_poll(out)
|
|
72
|
+
state = got["state"]
|
|
68
73
|
running += state == sj.RUNNING
|
|
74
|
+
rows.append({**row, "state": state or sj.RUNNING, "exit_code": got["exit_code"],
|
|
75
|
+
"ended_at": time.time() if state in sj.ENDED else 0.0})
|
|
69
76
|
if not state or retry.get(key, 0.0) > now() or not due(told.get(key), state, now(), heartbeat):
|
|
70
77
|
continue
|
|
71
78
|
answer = await post(sid, job["n"], out)
|
|
@@ -86,6 +93,8 @@ async def watch(*, session_id, post, on_line=None, on_count=None, tick: float =
|
|
|
86
93
|
jobs.mark_reported(job["path"], "unknown")
|
|
87
94
|
if on_count is not None:
|
|
88
95
|
on_count(running)
|
|
96
|
+
if on_rows is not None:
|
|
97
|
+
on_rows(rows)
|
|
89
98
|
except asyncio.CancelledError:
|
|
90
99
|
raise
|
|
91
100
|
except Exception:
|
|
@@ -1684,11 +1684,34 @@ async def run_repl(cfg, mode: str = "default", *, once: bool = False, sink=None,
|
|
|
1684
1684
|
for line in said or ["Nothing is running in front: there is no command to send to the background."]:
|
|
1685
1685
|
_say(slot, "⚙ " + line)
|
|
1686
1686
|
|
|
1687
|
+
def _waited_s(slot: SessionSlot) -> float:
|
|
1688
|
+
"""How long the oldest command this tab's turn waits for has run; 0 when it waits for none."""
|
|
1689
|
+
executor = getattr(slot.agent, "_executor", None)
|
|
1690
|
+
held = executor.held_running() if executor is not None and hasattr(executor, "held_running") else []
|
|
1691
|
+
return max(0.0, time.time() - held[0].started) if held else 0.0
|
|
1692
|
+
|
|
1687
1693
|
job_keys = {
|
|
1694
|
+
"waited_s": _waited_s,
|
|
1688
1695
|
"background": lambda slot: asyncio.ensure_future(_to_background(slot)),
|
|
1689
1696
|
"jobs": lambda slot: asyncio.ensure_future(_handle("/jobs", slot)),
|
|
1697
|
+
"open": lambda slot, n: asyncio.ensure_future(_handle(f"/job {int(n)}", slot)),
|
|
1698
|
+
"end": lambda slot, n: asyncio.ensure_future(_handle(f"/job {int(n)} cancel", slot)),
|
|
1690
1699
|
}
|
|
1691
1700
|
|
|
1701
|
+
def _show_jobs(slot: SessionSlot, rows: list) -> None:
|
|
1702
|
+
"""The watch's newest look at the slot's jobs goes to the background strip; the screen is redrawn when
|
|
1703
|
+
what the strip shows changed (a job began, ended, or left it)."""
|
|
1704
|
+
seen = [(r.get("n"), r.get("state")) for r in slot.jobs_rows]
|
|
1705
|
+
slot.jobs_rows = list(rows)
|
|
1706
|
+
if seen != [(r.get("n"), r.get("state")) for r in rows]:
|
|
1707
|
+
try:
|
|
1708
|
+
from prompt_toolkit.application import get_app_or_none
|
|
1709
|
+
app = get_app_or_none()
|
|
1710
|
+
if app is not None:
|
|
1711
|
+
app.invalidate()
|
|
1712
|
+
except Exception:
|
|
1713
|
+
pass
|
|
1714
|
+
|
|
1692
1715
|
def _spawn_slot_jobwatch(slot: SessionSlot) -> None:
|
|
1693
1716
|
"""One watch per session slot over its jobs on this machine (webbee.jobwatch): it tells the kernel what
|
|
1694
1717
|
each job's poll line prints, and shows the job's line when the kernel took its end. In `slot.bg_tasks`,
|
|
@@ -1700,7 +1723,8 @@ async def run_repl(cfg, mode: str = "default", *, once: bool = False, sink=None,
|
|
|
1700
1723
|
session_id=lambda: _slot_session_id(slot),
|
|
1701
1724
|
post=lambda sid, n, out: slot.agent.report_job(sid, n, out),
|
|
1702
1725
|
on_line=lambda text: _say(slot, "⚙ " + text),
|
|
1703
|
-
on_count=lambda n: setattr(slot, "jobs_running", int(n))
|
|
1726
|
+
on_count=lambda n: setattr(slot, "jobs_running", int(n)),
|
|
1727
|
+
on_rows=lambda rows: _show_jobs(slot, rows))))
|
|
1704
1728
|
|
|
1705
1729
|
async def _run_turn(slot: SessionSlot, line: str, surface: str = "", steer_iid: str = "") -> None:
|
|
1706
1730
|
"""ONE agent turn -- the typed-line path (FIX1: slot-explicit
|
|
@@ -427,40 +427,56 @@ class AgentSession:
|
|
|
427
427
|
(``SessionJobAdoptWorkflow``), its run folder takes the job's name, and the wait ends -- the process is
|
|
428
428
|
not touched. Returns one line per command, saying what happened; [] when nothing is being waited for.
|
|
429
429
|
A command the kernel did not take stays in the foreground, said with the reason."""
|
|
430
|
+
executor = self._executor
|
|
431
|
+
held = executor.held_running() if executor is not None and hasattr(executor, "held_running") else []
|
|
432
|
+
return [(await self._adopt(h))[1] for h in held]
|
|
433
|
+
|
|
434
|
+
async def _adopt(self, h) -> tuple:
|
|
435
|
+
"""One waited command becomes a job of the session: ``(moved?, the line that says what happened)``. The
|
|
436
|
+
kernel gives the number and writes the record; the run folder takes the job's name; the wait ends. A
|
|
437
|
+
command the kernel did not take stays where it is."""
|
|
430
438
|
from imperal_sdk import session_jobs as sj
|
|
431
439
|
|
|
432
440
|
from webbee import jobs
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
441
|
+
sid = self.session_id
|
|
442
|
+
title = " ".join(h.command.split())[:sj.TITLE_CHARS]
|
|
443
|
+
got = await self._job_door(sid, "adopt", {"command": h.command[:2000], "title": title,
|
|
444
|
+
"started_ts": h.started})
|
|
445
|
+
try:
|
|
446
|
+
n = int((got or {}).get("n") or 0)
|
|
447
|
+
except (TypeError, ValueError):
|
|
448
|
+
n = 0
|
|
449
|
+
# the folder is the one the SDK names for this session and number -- what the answer says of it is
|
|
450
|
+
# compared, never used
|
|
451
|
+
if not (got or {}).get("ok") or n < 1 or (got or {}).get("dir") != sj.job_dir(sid, n):
|
|
452
|
+
return False, ("not sent to the background: "
|
|
453
|
+
+ (str((got or {}).get("error") or "the kernel gave it no job number")
|
|
454
|
+
if got else "the kernel could not be reached") + f" -- `{title}` stays in front")
|
|
455
|
+
if h.proc.poll() is not None:
|
|
456
|
+
return False, f"`{title}` ended before it was moved: its result is the call's own"
|
|
457
|
+
try:
|
|
458
|
+
jobs.link(h, sid, n, title)
|
|
459
|
+
except OSError as exc:
|
|
460
|
+
return False, (f"not sent to the background: {type(exc).__name__} naming job {sj.job_id(n)} on this "
|
|
461
|
+
f"machine -- `{title}` stays in front")
|
|
462
|
+
jobs.release(h, n)
|
|
463
|
+
return True, (f"{sj.job_id(n)} in the background: `{title}` -- /jobs lists, /job {n} shows its output, "
|
|
464
|
+
f"/job {n} cancel ends it")
|
|
465
|
+
|
|
466
|
+
def keep_on_timeout(self, loop):
|
|
467
|
+
"""What the executor does with a command that outlasts its wait: ``(held) -> bool``, run from the
|
|
468
|
+
executor's own thread. The command is not stopped -- it becomes a job (``_adopt``, on the session's
|
|
469
|
+
loop); False when the kernel did not take it in time, and the executor then stops it as before."""
|
|
470
|
+
import asyncio as _asyncio
|
|
471
|
+
|
|
472
|
+
def keep(held) -> bool:
|
|
473
|
+
if loop is None or loop.is_closed() or not self.session_id:
|
|
474
|
+
return False
|
|
454
475
|
try:
|
|
455
|
-
|
|
456
|
-
except
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
continue
|
|
460
|
-
jobs.release(h, n)
|
|
461
|
-
said.append(f"{sj.job_id(n)} in the background: `{title}` -- /jobs lists, /job {n} shows its output, "
|
|
462
|
-
f"/job {n} cancel ends it")
|
|
463
|
-
return said
|
|
476
|
+
return bool(_asyncio.run_coroutine_threadsafe(self._adopt(held), loop).result(timeout=30)[0])
|
|
477
|
+
except Exception:
|
|
478
|
+
return False
|
|
479
|
+
return keep
|
|
464
480
|
|
|
465
481
|
async def post_mode(self, mode: str) -> bool:
|
|
466
482
|
"""Tell the running session its new coding mode (the kernel's ``set_mode``): autopilot is asked nothing
|
|
@@ -631,6 +647,10 @@ class AgentSession:
|
|
|
631
647
|
_own_frames = False # -> True the instant ANY non-foreign frame lands
|
|
632
648
|
from webbee.tools import _WRITE_TIER, PLAN_SAFE_TOOLS
|
|
633
649
|
self._executor = executor # stop() kills what it still runs
|
|
650
|
+
try: # a command that outlasts its wait runs on as a job, never killed
|
|
651
|
+
executor.keep_on_timeout = self.keep_on_timeout(asyncio.get_running_loop())
|
|
652
|
+
except Exception:
|
|
653
|
+
pass
|
|
634
654
|
store = _ResultStore(session_id, task_id)
|
|
635
655
|
loop = asyncio.get_running_loop()
|
|
636
656
|
# a running local command is seen live: the executor names each newest line of its output from its worker
|
|
@@ -125,6 +125,8 @@ class SessionSlot:
|
|
|
125
125
|
steer_backlog: deque = field(default_factory=deque) # reserved (W4b)
|
|
126
126
|
bg_tasks: list = field(default_factory=list) # per-slot cancellables
|
|
127
127
|
jobs_running: int = 0 # the session's background jobs running on this machine now
|
|
128
|
+
jobs_rows: list = field(default_factory=list) # the same jobs as the background strip shows them
|
|
129
|
+
jp_ui: dict = field(default_factory=lambda: {"collapsed": False})
|
|
128
130
|
_last_fill: float = 0.0 # Home only (Task 6): monotonic ts of the last fill_home run
|
|
129
131
|
_filling: bool = False # Home only (Task 6): a fill_home is in flight -- re-entrancy guard
|
|
130
132
|
started_at: float = 0.0 # home-tab-durations-v1: monotonic ts this slot was opened --
|
|
@@ -159,15 +159,19 @@ def _whole_log(held) -> bytes:
|
|
|
159
159
|
return b""
|
|
160
160
|
|
|
161
161
|
|
|
162
|
-
def _backgrounded(held, out: str) -> dict:
|
|
163
|
-
"""The result of a command
|
|
164
|
-
|
|
162
|
+
def _backgrounded(held, out: str, waited: int = 0) -> dict:
|
|
163
|
+
"""The result of a command that went to the background while the agent's call was waiting for it -- sent there
|
|
164
|
+
by the person, or (``waited``: the call's own bound, in seconds) because it outlasted the wait. It did NOT
|
|
165
|
+
finish: the result says so first and is never ``ok`` -- an unfinished command is no proof of anything."""
|
|
165
166
|
from imperal_sdk import session_jobs as sj
|
|
166
167
|
jid = sj.job_id(held.job)
|
|
167
|
-
|
|
168
|
+
why = (f"STILL RUNNING AFTER {int(waited)} s -- NOT STOPPED, NOT FINISHED" if waited
|
|
169
|
+
else "SENT TO THE BACKGROUND BY THE PERSON -- NOT FINISHED")
|
|
170
|
+
head = (f"[{why}: this command runs on as job {jid} of this "
|
|
168
171
|
f"session on the person's own machine; its outcome is not known yet. job_status(id=\"{jid}\") reads "
|
|
169
172
|
f"the end of its output, job_cancel(id=\"{jid}\") ends it, and this session is told when it ends. "
|
|
170
|
-
"Do not run it again
|
|
173
|
+
"Do not run it again"
|
|
174
|
+
+ ("; go on with what does not need its result." if waited else ".") + "]")
|
|
171
175
|
full = len(out)
|
|
172
176
|
out = _truncated(out, _BASH_OUT_CAP)
|
|
173
177
|
return {"ok": False, "content": head + ("\nits output until now:\n" + out if out.strip() else ""),
|
|
@@ -401,6 +405,9 @@ class LocalToolExecutor:
|
|
|
401
405
|
# the commands this terminal WAITS for, by their process (webbee.jobs.Held): the person can send one to the
|
|
402
406
|
# background -- the wait ends, the command runs on as a job
|
|
403
407
|
self._held: dict = {}
|
|
408
|
+
# (held) -> bool, set by the session: a command that outlasts its wait becomes a job instead of being
|
|
409
|
+
# stopped; None (no session behind this executor): it is stopped, as before
|
|
410
|
+
self.keep_on_timeout = None
|
|
404
411
|
# the surface's ear for a running command's output (the newest line, as it is printed); None: no one listens
|
|
405
412
|
self.on_output = None
|
|
406
413
|
|
|
@@ -1074,6 +1081,10 @@ class LocalToolExecutor:
|
|
|
1074
1081
|
tell = self.on_output
|
|
1075
1082
|
raw, how = jobs.follow(held, timeout, (lambda piece: tell(_last_line(piece))) if tell else None)
|
|
1076
1083
|
timed_out = how == "timeout"
|
|
1084
|
+
if timed_out and self.keep_on_timeout is not None and self.keep_on_timeout(held):
|
|
1085
|
+
# the wait is over, the work is not: it runs on as a job (2026-11-27 -- a timeout used to
|
|
1086
|
+
# kill a test run minutes before its end, and the next call started it from nothing)
|
|
1087
|
+
return _backgrounded(held, _decoded(raw or b""), waited=timeout)
|
|
1077
1088
|
if timed_out:
|
|
1078
1089
|
_stop_group(proc, posix)
|
|
1079
1090
|
raw = _whole_log(held) or raw
|
|
@@ -25,6 +25,7 @@ from prompt_toolkit.layout.dimension import Dimension
|
|
|
25
25
|
|
|
26
26
|
from webbee import __version__, sizing
|
|
27
27
|
from webbee.output_pane import OutputPane # noqa: F401 — re-exported (webbee.tui.OutputPane)
|
|
28
|
+
from webbee.jobs_panel import JP_MAX_ITEMS, jobs_fragments, jobs_height
|
|
28
29
|
from webbee.queue_panel import (drop_item, one_line, pull_item, queue_fragments,
|
|
29
30
|
queue_height)
|
|
30
31
|
from webbee.render import _fmt_tokens
|
|
@@ -146,6 +147,11 @@ _STYLE_DICT = {
|
|
|
146
147
|
"tab.new": "#e8a317 bold", # new tab chip
|
|
147
148
|
"tab.new.hover": "bg:#e8a317 #000000 bold", # new tab hover
|
|
148
149
|
"tab.sep": "#3a3a3a", # the │ between tabs
|
|
150
|
+
"jp.header": "#e8a317", # ⚙ background -- the strip's head, in the accent
|
|
151
|
+
"jp.item": "#8a8a8a", # an ended job, the hint
|
|
152
|
+
"jp.live": "#00afd7", # a running job
|
|
153
|
+
"jp.bad": "#d75f5f", # one that failed or was lost
|
|
154
|
+
"jp.end": "#af0000 bold", # the ✕ that ends a running job
|
|
149
155
|
"tb.dim": "#8a8a8a", # idle chrome
|
|
150
156
|
"tb.spin": "#e8a317 bold", # animated spinner
|
|
151
157
|
"tb.working": "#e8a317", # 'working'
|
|
@@ -347,11 +353,16 @@ def toolbar_tip(now: "float | None" = None, every: float = 8.0) -> str:
|
|
|
347
353
|
return TOOLBAR_TIPS[int((_t.monotonic() if now is None else now) // every) % len(TOOLBAR_TIPS)]
|
|
348
354
|
|
|
349
355
|
|
|
356
|
+
BACKGROUND_HINT = " · Ctrl+Z ⇢ run it in the background"
|
|
357
|
+
BACKGROUND_HINT_AFTER_S = 8.0 # a command waited for this long is worth sending away; a quick one is not
|
|
358
|
+
|
|
359
|
+
|
|
350
360
|
def build_toolbar(mode: str, tokens: int, credits: int, *, busy: bool = False,
|
|
351
361
|
current: str = "", elapsed: float = 0.0, tools: int = 0,
|
|
352
362
|
consent: bool = False, queued: int = 0,
|
|
353
363
|
reconnecting: int = 0, width: int = 0, live: str = "",
|
|
354
|
-
tier: str = "", tier_now: "float | None" = None, jobs: int = 0
|
|
364
|
+
tier: str = "", tier_now: "float | None" = None, jobs: int = 0,
|
|
365
|
+
can_background: bool = False) -> list:
|
|
355
366
|
"""The status line under the pinned input box, as prompt_toolkit formatted
|
|
356
367
|
text (per-segment styled). Four states: consent (awaiting a reply),
|
|
357
368
|
reconnecting (the stream transport is down mid-turn — honest, not a fake
|
|
@@ -392,9 +403,15 @@ def build_toolbar(mode: str, tokens: int, credits: int, *, busy: bool = False,
|
|
|
392
403
|
# the terminal's edge, and the version badge keeps its reserved columns.
|
|
393
404
|
tails = [f" · {took} · {n} · {_fmt_tokens(tokens)} tok · {_fmt_tokens(credits)} credits",
|
|
394
405
|
f" · {took} · {n}", f" · {took}"]
|
|
395
|
-
|
|
406
|
+
# A command she has been waiting for long enough to be worth it can go to the background -- said only
|
|
407
|
+
# while that is really so (a waited command runs, this system has jobs), in the hint's own place and in
|
|
408
|
+
# the accent, so it is seen the moment it applies (the owner, 2026-11-27: "a simple, clear instruction
|
|
409
|
+
# right when it can be done -- neat").
|
|
410
|
+
hint = BACKGROUND_HINT if can_background else " · Esc to stop"
|
|
396
411
|
used = sum(len(t) for _, t in head) + sum(len(t) for _, t in q)
|
|
397
|
-
|
|
412
|
+
# the background hint outlives the figures on a narrow terminal: it is the one thing the person can act on
|
|
413
|
+
options = ([(tails[0], hint)] + ([(t, hint) for t in tails[1:]] if can_background else [])
|
|
414
|
+
+ [(t, "") for t in tails])
|
|
398
415
|
tail, tip = options[-1]
|
|
399
416
|
least = min(len(doing), 24) # what of the action's text is kept before figures go
|
|
400
417
|
for i, (t, h) in enumerate(options):
|
|
@@ -406,7 +423,7 @@ def build_toolbar(mode: str, tokens: int, credits: int, *, busy: bool = False,
|
|
|
406
423
|
doing = (doing[:max(1, room - 1)] + "…") if room > 1 else doing[:max(0, room)]
|
|
407
424
|
frags = head + [("class:tb.action", doing), ("class:tb.dim", tail)] + q
|
|
408
425
|
if tip:
|
|
409
|
-
frags.append(("class:tb.dim", tip))
|
|
426
|
+
frags.append(("class:tb.working" if can_background else "class:tb.dim", tip))
|
|
410
427
|
return frags
|
|
411
428
|
# the spend says less before it says nothing: a narrow terminal keeps the figures and drops the words
|
|
412
429
|
spends = [f" · {_fmt_tokens(tokens)} tok · {_fmt_tokens(credits)} credits this session",
|
|
@@ -1333,6 +1350,14 @@ async def run_session(*, slots, on_line, on_cycle, on_tier_cycle=None,
|
|
|
1333
1350
|
# background": the command the tab's turn is waiting for runs on as a job. Ctrl+O lists the tab's jobs.
|
|
1334
1351
|
_has_jobs = Condition(lambda: bool(job_keys) and _a().kind != "home")
|
|
1335
1352
|
|
|
1353
|
+
def _can_background(slot) -> bool:
|
|
1354
|
+
"""A command this tab is waiting for has run long enough to be worth sending to the background."""
|
|
1355
|
+
waited = (job_keys or {}).get("waited_s")
|
|
1356
|
+
try:
|
|
1357
|
+
return bool(waited) and float(waited(slot)) >= BACKGROUND_HINT_AFTER_S
|
|
1358
|
+
except Exception:
|
|
1359
|
+
return False
|
|
1360
|
+
|
|
1336
1361
|
@kb.add("c-z", filter=_has_jobs)
|
|
1337
1362
|
def _to_background_key(event):
|
|
1338
1363
|
job_keys["background"](_a())
|
|
@@ -1768,7 +1793,8 @@ async def run_session(*, slots, on_line, on_cycle, on_tier_cycle=None,
|
|
|
1768
1793
|
width=_toolbar_fit_width(),
|
|
1769
1794
|
live=str((live or {}).get("text") or ""),
|
|
1770
1795
|
tier=getattr(slot, "model_tier", "") or "",
|
|
1771
|
-
jobs=int(getattr(slot, "jobs_running", 0) or 0)
|
|
1796
|
+
jobs=int(getattr(slot, "jobs_running", 0) or 0),
|
|
1797
|
+
can_background=_can_background(slot))
|
|
1772
1798
|
else:
|
|
1773
1799
|
# Home has no sink of its OWN, but it is the dock's summary
|
|
1774
1800
|
# page: show the SESSION TOTAL across every open tab (0.3.36)
|
|
@@ -2143,6 +2169,34 @@ async def run_session(*, slots, on_line, on_cycle, on_tier_cycle=None,
|
|
|
2143
2169
|
always_hide_cursor=True, wrap_lines=False),
|
|
2144
2170
|
filter=Condition(lambda: bool(_sink_attr("current_todos", []))))
|
|
2145
2171
|
|
|
2172
|
+
def _toggle_jobs():
|
|
2173
|
+
slot = _a()
|
|
2174
|
+
slot.jp_ui["collapsed"] = not slot.jp_ui["collapsed"]
|
|
2175
|
+
get_app().invalidate()
|
|
2176
|
+
|
|
2177
|
+
def _jobs_rows():
|
|
2178
|
+
return getattr(_a(), "jobs_rows", None) or []
|
|
2179
|
+
|
|
2180
|
+
def _jobs_fragments():
|
|
2181
|
+
# Live like the queue strip: re-made every redraw from the active slot's own rows (webbee.jobwatch fills
|
|
2182
|
+
# them); a click on a row prints that job's output, its ✕ ends it -- both through the same commands the
|
|
2183
|
+
# person can type.
|
|
2184
|
+
slot = _a()
|
|
2185
|
+
act = job_keys or {}
|
|
2186
|
+
return jobs_fragments(
|
|
2187
|
+
_jobs_rows(), width=_panel_size(JP_MAX_ITEMS)[0], collapsed=slot.jp_ui["collapsed"],
|
|
2188
|
+
toggle=_toggle_jobs, forward=_pane().forward_mouse,
|
|
2189
|
+
open_job=(lambda n: act["open"](slot, n)) if act.get("open") else None,
|
|
2190
|
+
end_job=(lambda n: act["end"](slot, n)) if act.get("end") else None)
|
|
2191
|
+
|
|
2192
|
+
# The background strip -- nearest the input (a job is what the person may act on next), under the queue; zero
|
|
2193
|
+
# rows while the session has no job to show, so the dock without jobs is unchanged.
|
|
2194
|
+
jobs_panel = ConditionalContainer(
|
|
2195
|
+
content=Window(FormattedTextControl(_jobs_fragments, focusable=False),
|
|
2196
|
+
height=lambda: jobs_height(_jobs_rows(), getattr(_a(), "jp_ui", {}).get("collapsed", False)),
|
|
2197
|
+
always_hide_cursor=True, wrap_lines=False),
|
|
2198
|
+
filter=Condition(lambda: _a().kind != "home" and jobs_height(_jobs_rows()) > 0))
|
|
2199
|
+
|
|
2146
2200
|
def _line_prefix(line_no, wrap_count):
|
|
2147
2201
|
# 0.3.36: with multi-line prompts, line 2+ gets a dim continuation
|
|
2148
2202
|
# gutter so it reads as ONE message still being composed, never as
|
|
@@ -2442,7 +2496,7 @@ async def run_session(*, slots, on_line, on_cycle, on_tier_cycle=None,
|
|
|
2442
2496
|
|
|
2443
2497
|
modal_container = DynamicContainer(_get_active_modal)
|
|
2444
2498
|
|
|
2445
|
-
root = HSplit([tab_bar, tab_bar_spacer, pane_container, todo_panel, queue_panel,
|
|
2499
|
+
root = HSplit([tab_bar, tab_bar_spacer, pane_container, todo_panel, queue_panel, jobs_panel,
|
|
2446
2500
|
modal_container, Frame(input_win), toolbar])
|
|
2447
2501
|
style = Style.from_dict(_STYLE_DICT)
|
|
2448
2502
|
app = Application(layout=Layout(root, focused_element=input_win), key_bindings=kb,
|