webbee 0.7.28__tar.gz → 0.7.30__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.28 → webbee-0.7.30}/CHANGELOG.md +19 -0
- {webbee-0.7.28 → webbee-0.7.30}/PKG-INFO +3 -3
- {webbee-0.7.28 → webbee-0.7.30}/pyproject.toml +3 -3
- webbee-0.7.30/src/webbee/__init__.py +1 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/commands.py +12 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/home_view.py +13 -4
- webbee-0.7.30/src/webbee/jobs.py +314 -0
- webbee-0.7.30/src/webbee/jobwatch.py +92 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/render.py +26 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/repl.py +87 -1
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/session.py +70 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/slots.py +1 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/tools.py +73 -7
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/tui.py +20 -3
- webbee-0.7.30/tests/test_jobs_1127.py +320 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_render.py +20 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_tools.py +13 -8
- {webbee-0.7.28 → webbee-0.7.30}/uv.lock +9 -9
- webbee-0.7.28/src/webbee/__init__.py +0 -1
- {webbee-0.7.28 → webbee-0.7.30}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/.github/pull_request_template.md +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/.github/workflows/os-check.yml +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/.github/workflows/publish.yml +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/.gitignore +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/LICENSE +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/PRIVACY.md +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/README.md +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/SECURITY.md +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/assets/architecture.png +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/assets/demo.gif +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/assets/hero.png +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/assets/social-preview.png +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/__init__.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/__init__.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/drivers.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/fixture.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/fixture_long.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/fixture_wait.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/provision_user.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/registry.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/replay.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/run.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/scenarios_account.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/scenarios_code.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/scenarios_contract.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/scenarios_long.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/scenarios_wait.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/test_drivers.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/test_fixture.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/test_fixture_long.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/test_fixture_wait.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/test_registry.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/test_replay.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/field_gate/wipe.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/ci/os_check.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/dev-webbee +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/install.sh +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/__main__.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/_launch.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/account.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/active_sessions.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/autoupdate.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/banner_art.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/boot.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/browser.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/checkpoints.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/cli.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/clipboard.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/clipboard_read.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/clipboard_session.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/coding_context.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/config.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/consent.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/details.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/events.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/expand.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/frames.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/home.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/http.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/instance_lock.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/intel/__init__.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/intel/graph.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/intel/outline.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/intel/query.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/intel/service.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/intel/store.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/intel/tree.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/intel/watch.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/loop_errors.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/media.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/modals.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/mode_store.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/native_files.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/native_read.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/newtab_mode.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/output_pane.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/pricing_constants.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/queue_panel.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/reflow.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/remote.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/repo.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/selection.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/sessions.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/sizing.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/stallwatch.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/steer.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/stream.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/tab_store.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/tabs.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/thread.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/tier_store.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/todo_panel.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/tokens.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/update.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/urlopen.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/wallet.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/src/webbee/worktrees.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/__init__.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/conftest.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_account.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_active_sessions.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_append_file.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_audit_2026_07_25_findings.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_autoupdate.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_checkpoints.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_checkpoints_nested_1030.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_cli.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_clipboard.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_clipboard_read.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_code_map_fresh.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_coding_context.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_commands.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_config.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_cpc_contract_stable.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_cpc_outline.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_cross_loop_token.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_details.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_events.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_expand.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_field_test_1113.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_freeze_fix.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_home.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_home_view.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_home_view_mouse.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_inspect_page.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_instance_lock.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_intel_any_folder.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_intel_cache_and_sync_worker.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_intel_checksum_tree.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_intel_chunker.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_intel_embed.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_intel_folder_1106.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_intel_graph.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_intel_no_numpy.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_intel_query.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_intel_service.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_intel_store.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_intel_watch.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_launch.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_loop_errors.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_marathon.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_modals_e2e.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_mode_and_remote_0_6_8.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_mode_store.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_native_files.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_newtab_mode.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_packaging.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_probe_cost.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_queue_manage_0337.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_read_never_waits_for_the_repo.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_reflow.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_remote_code_reads.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_repl.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_repo.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_resilient_http.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_result_fits_the_door.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_review_fixes_1030.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_session.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_session_review_1030.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_sessions.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_sizing.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_slots.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_ssh_guard.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_stallwatch.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_steer.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_stream.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_tab_bar_stability.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_tab_restore_0337.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_tabs.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_terminal_ux_0336.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_thread.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_tier_invalidation.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_tier_store.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_todo_panel.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_tokens.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_tool_ack.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_tools_eol_cancel_1030.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_tools_vision_websearch.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_tray_1126.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_tui.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_tui_hardening.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_update.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_update_badge_0340.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_urlopen.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_version.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_version_badge_corner.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_voice_outcome.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_wallet.py +0 -0
- {webbee-0.7.28 → webbee-0.7.30}/tests/test_worktrees.py +0 -0
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.30
|
|
4
|
+
|
|
5
|
+
* You see what Webbee herself sends. A message she writes to another session is shown in her own terminal: to
|
|
6
|
+
whom, the message as it was written, and - when the kernel did not let it through - that it was NOT sent and
|
|
7
|
+
why (with the kernel release that tells the terminal of it).
|
|
8
|
+
|
|
9
|
+
## 0.7.29
|
|
10
|
+
|
|
11
|
+
* Background work on your machine, in full. A command Webbee is waiting for goes to the background with Ctrl+Z
|
|
12
|
+
(or `/bg`): it is not restarted or touched - the wait ends, the command runs on as a job of the session and
|
|
13
|
+
outlives the terminal. `/jobs` (Ctrl+O) lists the session's jobs, `/job N` shows a job's output so far,
|
|
14
|
+
`/job N cancel` ends it. The status line counts what runs in the background.
|
|
15
|
+
* Webbee is told when a job ends, by the kernel itself - also for a job that ended while the terminal was closed:
|
|
16
|
+
the next start reports it.
|
|
17
|
+
* Every shell command now writes its output to a file of its own folder instead of a pipe to the terminal, so a
|
|
18
|
+
command that leaves a child running returns when it is done, not when the child closes its output.
|
|
19
|
+
* The version badge says "installed" or "is out" only of a version newer than the running one.
|
|
20
|
+
* Needs imperal-sdk 6.13.0.
|
|
21
|
+
|
|
3
22
|
## 0.7.28
|
|
4
23
|
|
|
5
24
|
* You see what she reads. A shell command that only reads is listed as "Read (shell)", a check as "Check" - by
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: webbee
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.30
|
|
4
4
|
Summary: Webbee 🐝 — the Imperal Cloud coding agent in your terminal
|
|
5
5
|
Project-URL: Homepage, https://imperal.io/webbee-code
|
|
6
6
|
Project-URL: Documentation, https://docs.imperal.io
|
|
@@ -31,8 +31,8 @@ Requires-Python: >=3.7
|
|
|
31
31
|
Requires-Dist: asyncssh>=2.14; python_version >= '3.10'
|
|
32
32
|
Requires-Dist: httpx-sse>=0.4; python_version >= '3.10'
|
|
33
33
|
Requires-Dist: httpx>=0.27; python_version >= '3.10'
|
|
34
|
-
Requires-Dist: imperal-mcp>=0.9.
|
|
35
|
-
Requires-Dist: imperal-sdk[universal-index]>=6.
|
|
34
|
+
Requires-Dist: imperal-mcp>=0.9.24; python_version >= '3.10'
|
|
35
|
+
Requires-Dist: imperal-sdk[universal-index]>=6.13.0; python_version >= '3.10'
|
|
36
36
|
Requires-Dist: pillow>=10; python_version >= '3.10'
|
|
37
37
|
Requires-Dist: prompt-toolkit>=3; python_version >= '3.10'
|
|
38
38
|
Requires-Dist: rich>=13.7; python_version >= '3.10'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "webbee"
|
|
3
|
-
version = "0.7.
|
|
3
|
+
version = "0.7.30"
|
|
4
4
|
description = "Webbee 🐝 — the Imperal Cloud coding agent in your terminal"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "GPL-3.0-or-later"
|
|
@@ -13,8 +13,8 @@ dependencies = [
|
|
|
13
13
|
# release on a Python 3.12 it sets up once with uv -- `uv` comes as a wheel on 3.8+,
|
|
14
14
|
# 3.7 fetches it with uv's own installer.
|
|
15
15
|
'uv>=0.4; python_version >= "3.8" and python_version < "3.10"',
|
|
16
|
-
'imperal-mcp>=0.9.
|
|
17
|
-
'imperal-sdk[universal-index]>=6.
|
|
16
|
+
'imperal-mcp>=0.9.24; python_version >= "3.10"', # raised to the newest at each release
|
|
17
|
+
'imperal-sdk[universal-index]>=6.13.0; python_version >= "3.10"',
|
|
18
18
|
'asyncssh>=2.14; python_version >= "3.10"',
|
|
19
19
|
'httpx>=0.27; python_version >= "3.10"',
|
|
20
20
|
'httpx-sse>=0.4; python_version >= "3.10"',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.7.30"
|
|
@@ -24,6 +24,9 @@ _HELP = """Commands:
|
|
|
24
24
|
/attach <path> attach a local file (or several, space-separated/glob) to the next message
|
|
25
25
|
/queue [clear] messages queued while Webbee works (clear drops them all)
|
|
26
26
|
/steps [N] last turn's steps; N expands one (also: Up/Down + Enter)
|
|
27
|
+
/jobs background jobs of this session on this machine
|
|
28
|
+
/job N [cancel] the output of job N so far (cancel ends it)
|
|
29
|
+
/bg send the command Webbee is waiting for to the background (it runs on)
|
|
27
30
|
/checkpoints the reversibility time machine — list workspace checkpoints
|
|
28
31
|
/rollback <ref> restore the workspace to a checkpoint (id, cp-N or N)
|
|
29
32
|
/sessions list active sessions (this + other devices)
|
|
@@ -36,6 +39,7 @@ Keys:
|
|
|
36
39
|
Alt+↵ (or Shift+↵, or Ctrl+J) new line in the prompt — Enter still sends
|
|
37
40
|
Shift+TAB switch mode Ctrl+T new tab
|
|
38
41
|
Ctrl+B cycle model tier
|
|
42
|
+
Ctrl+Z send the running command to the background Ctrl+O list jobs
|
|
39
43
|
Alt+№ switch to tab № Ctrl+W close tab"""
|
|
40
44
|
|
|
41
45
|
|
|
@@ -154,6 +158,14 @@ def dispatch(line: str, ctx: CommandContext) -> SlashResult:
|
|
|
154
158
|
message=(f"Queued ({len(ctx.queued)}) — runs in order, "
|
|
155
159
|
f"one per finished turn:\n{lines}\n"
|
|
156
160
|
f" /queue drop <n> · /queue edit <n> · /queue clear"))
|
|
161
|
+
if cmd == "/jobs":
|
|
162
|
+
return SlashResult(handled=True, action="jobs")
|
|
163
|
+
if cmd == "/job":
|
|
164
|
+
if not args:
|
|
165
|
+
return SlashResult(handled=True, action="jobs")
|
|
166
|
+
return SlashResult(handled=True, action="job", arg=" ".join(a.lower() for a in args[:2]))
|
|
167
|
+
if cmd == "/bg":
|
|
168
|
+
return SlashResult(handled=True, action="background")
|
|
157
169
|
if cmd == "/steps":
|
|
158
170
|
if args:
|
|
159
171
|
return SlashResult(handled=True, action="step_detail", arg=args[0])
|
|
@@ -189,6 +189,15 @@ def _cycle(options, current: str, delta: int) -> str:
|
|
|
189
189
|
return options[(i + delta) % len(options)]
|
|
190
190
|
|
|
191
191
|
|
|
192
|
+
def _newer(other: str, running: str) -> bool:
|
|
193
|
+
"""PURE. ``other`` is a NEWER release than the running one. "Installed, restart" and "is out" are said of a newer
|
|
194
|
+
version only: one that merely differs (an older file on disk, a version that does not parse) is no upgrade, and
|
|
195
|
+
the badge then claims nothing (the owner, 2026-11-27: it said "installed" when nothing had been installed)."""
|
|
196
|
+
from webbee.update import _ver
|
|
197
|
+
a, b = _ver(other), _ver(running)
|
|
198
|
+
return bool(other) and bool(a) and bool(b) and a > b
|
|
199
|
+
|
|
200
|
+
|
|
192
201
|
def version_badge(version: str, update_notice: str = "", checked: bool = True, *,
|
|
193
202
|
latest: str = "", installed: str = "") -> "tuple[str, str]":
|
|
194
203
|
"""(text, style_class) for Home's bottom-right version badge (0.3.36).
|
|
@@ -211,9 +220,9 @@ def version_badge(version: str, update_notice: str = "", checked: bool = True, *
|
|
|
211
220
|
# newer release exists), never out of the notice's words -- the badge once took the last "vN" word of the
|
|
212
221
|
# restart sentence, which names the RUNNING version last: "v0.7.18 → 0.7.18 available" (live 2026-11-26).
|
|
213
222
|
installed, latest = (installed or "").strip().lstrip("v"), (latest or "").strip().lstrip("v")
|
|
214
|
-
if installed
|
|
223
|
+
if _newer(installed, v):
|
|
215
224
|
return (f"{vtxt} → {installed} · restart", "class:home.update")
|
|
216
|
-
if latest
|
|
225
|
+
if _newer(latest, v):
|
|
217
226
|
return (f"{vtxt} → {latest} available", "class:home.update")
|
|
218
227
|
if notice:
|
|
219
228
|
return (f"{vtxt} · update available", "class:home.update") # a notice with no number: none is guessed
|
|
@@ -236,9 +245,9 @@ def badge_beats(version: str, update_notice: str = "", checked: "bool | None" =
|
|
|
236
245
|
v = (version or "").strip()
|
|
237
246
|
vtxt = f"v{v}" if v else "v?"
|
|
238
247
|
installed, latest = (installed or "").strip().lstrip("v"), (latest or "").strip().lstrip("v")
|
|
239
|
-
if installed
|
|
248
|
+
if _newer(installed, v):
|
|
240
249
|
return (vtxt, f"{installed} installed", "restart to use it")
|
|
241
|
-
if latest
|
|
250
|
+
if _newer(latest, v):
|
|
242
251
|
return (vtxt, f"{latest} is out", "click to upgrade")
|
|
243
252
|
if (update_notice or "").strip():
|
|
244
253
|
return (vtxt, "update available", "click to upgrade")
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
"""The jobs of a session ON THIS MACHINE, as the terminal sees them (one-loop plan 2026-11-26, rule 8; the owner,
|
|
2
|
+
2026-11-27: "to throw it into the background myself, to come back to it, to ask about it, to see its result").
|
|
3
|
+
|
|
4
|
+
A job is a folder under ``~/.imperal-jobs`` -- its log, its exit code, its process -- in the form the SDK owns
|
|
5
|
+
(``imperal_sdk.session_jobs``): the kernel writes the lines that start, read and end one, this module runs them here
|
|
6
|
+
and never writes a shell line of its own.
|
|
7
|
+
|
|
8
|
+
One form for every command of the terminal: a command the terminal WAITS for runs in that same form (``start_held``
|
|
9
|
+
-- its output goes to a file, never down a pipe to this process). So "to the background" changes nothing of the
|
|
10
|
+
process: the terminal stops waiting, the folder gets the job's name (``link``) and the command outlives the
|
|
11
|
+
terminal. Before, a command's output was a pipe to the terminal and the command lived exactly as long as the call
|
|
12
|
+
that waited for it.
|
|
13
|
+
|
|
14
|
+
Everything here is this machine's files and processes; no network. POSIX only: on Windows the terminal keeps its
|
|
15
|
+
old way of running a command and has no jobs."""
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
import os
|
|
19
|
+
import shutil
|
|
20
|
+
import subprocess
|
|
21
|
+
import threading
|
|
22
|
+
import time
|
|
23
|
+
|
|
24
|
+
from imperal_sdk import session_jobs as sj
|
|
25
|
+
|
|
26
|
+
FOLLOW_TICK_S = 0.1 # how often a waiting terminal reads its command's log
|
|
27
|
+
POLL_TIMEOUT_S = 10.0 # a poll line reads four small files: longer than this is a hung machine, not a job
|
|
28
|
+
KEEP_DAYS = 14 # an ended job's folder stays this long: its log is what "see its result" reads
|
|
29
|
+
REPORTED = "reported" # in a job's folder: the kernel holds its end (the state it took), nothing more to tell
|
|
30
|
+
_SEQ = [0]
|
|
31
|
+
_SEQ_LOCK = threading.Lock()
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def supported() -> bool:
|
|
35
|
+
return os.name != "nt"
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def home_dir() -> str:
|
|
39
|
+
return os.path.expanduser("~")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def root(home: str = "") -> str:
|
|
43
|
+
return os.path.join(home or home_dir(), ".imperal-jobs")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _env(home: str = "") -> dict:
|
|
47
|
+
return {"HOME": home or home_dir(), "PATH": os.environ.get("PATH") or "/usr/bin:/bin"}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _read(path: str, limit: int = 4000) -> str:
|
|
51
|
+
try:
|
|
52
|
+
with open(path, "rb") as f:
|
|
53
|
+
return f.read(limit).decode("utf-8", errors="replace")
|
|
54
|
+
except OSError:
|
|
55
|
+
return ""
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# ---- a command the terminal waits for ---------------------------------------------------------------------------
|
|
59
|
+
|
|
60
|
+
class Held:
|
|
61
|
+
"""One command the terminal started and waits for. ``released`` is set when the person sends it to the
|
|
62
|
+
background (``job`` then holds its number); ``folder`` is where it writes."""
|
|
63
|
+
__slots__ = ("command", "folder", "proc", "started", "released", "job", "why")
|
|
64
|
+
|
|
65
|
+
def __init__(self, command: str, folder: str, proc, started: float) -> None:
|
|
66
|
+
self.command, self.folder, self.proc, self.started = command, folder, proc, started
|
|
67
|
+
self.released = threading.Event()
|
|
68
|
+
self.job = 0
|
|
69
|
+
self.why = ""
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def start_held(command: str, *, cwd: str, env: dict, shell: str = "", home: str = "") -> Held:
|
|
73
|
+
"""Start ``command`` in the job's form and return at once: a new session (its own process group), output to the
|
|
74
|
+
run folder's ``log``, its exit code written by the command's own wrapper (``sj.held_command``). The folder is the
|
|
75
|
+
terminal's own (``.runs/<name>``) until the command is adopted as a job."""
|
|
76
|
+
with _SEQ_LOCK:
|
|
77
|
+
_SEQ[0] += 1
|
|
78
|
+
seq = _SEQ[0]
|
|
79
|
+
folder = os.path.join(root(home), sj.RUNS, f"{int(time.time())}.{os.getpid()}.{seq}")
|
|
80
|
+
os.makedirs(folder, mode=0o700, exist_ok=True)
|
|
81
|
+
with open(os.path.join(folder, "cmd"), "w", encoding="utf-8") as f:
|
|
82
|
+
f.write(command)
|
|
83
|
+
sh = shell or shutil.which("bash") or "sh"
|
|
84
|
+
with open(os.path.join(folder, "log"), "wb") as log:
|
|
85
|
+
proc = subprocess.Popen([sh, "-c", sj.held_command(command, folder, sh)], cwd=cwd, env=env,
|
|
86
|
+
stdin=subprocess.DEVNULL, stdout=log, stderr=subprocess.STDOUT,
|
|
87
|
+
start_new_session=True)
|
|
88
|
+
with open(os.path.join(folder, "pid"), "w", encoding="utf-8") as f:
|
|
89
|
+
f.write(str(proc.pid))
|
|
90
|
+
return Held(command, folder, proc, time.time())
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def follow(held: Held, timeout: float, on_piece=None, tick: float = FOLLOW_TICK_S) -> tuple:
|
|
94
|
+
"""Wait for a held command, reading its log AS IT GROWS: ``(all it wrote until now, how)`` where ``how`` is
|
|
95
|
+
``"done"`` (it ended), ``"released"`` (the person sent it to the background -- it runs on) or ``"timeout"``
|
|
96
|
+
(the caller's bound passed; the caller stops it). ``on_piece(bytes)`` gets each new piece the moment it is read;
|
|
97
|
+
it never breaks the wait."""
|
|
98
|
+
chunks: list = []
|
|
99
|
+
began = time.monotonic()
|
|
100
|
+
how = ""
|
|
101
|
+
with open(os.path.join(held.folder, "log"), "rb") as log:
|
|
102
|
+
def take() -> None:
|
|
103
|
+
while True:
|
|
104
|
+
piece = log.read(65536)
|
|
105
|
+
if not piece:
|
|
106
|
+
return
|
|
107
|
+
chunks.append(piece)
|
|
108
|
+
if on_piece is not None:
|
|
109
|
+
try:
|
|
110
|
+
on_piece(piece)
|
|
111
|
+
except Exception:
|
|
112
|
+
pass
|
|
113
|
+
while not how:
|
|
114
|
+
take()
|
|
115
|
+
if held.released.is_set():
|
|
116
|
+
how = "released"
|
|
117
|
+
elif held.proc.poll() is not None:
|
|
118
|
+
how = "done"
|
|
119
|
+
elif time.monotonic() - began >= timeout:
|
|
120
|
+
how = "timeout"
|
|
121
|
+
else:
|
|
122
|
+
time.sleep(tick)
|
|
123
|
+
take()
|
|
124
|
+
return b"".join(chunks), how
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def release(held: Held, n: int) -> None:
|
|
128
|
+
"""The wait for ``held`` ends: it is job ``n`` now. From here nobody waits for the process, so a thread takes its
|
|
129
|
+
end when it comes -- without that the ended process stays a zombie of this terminal, and a zombie's group still
|
|
130
|
+
answers a signal: the job would read as running until the terminal closed (found by this module's own test)."""
|
|
131
|
+
held.job = int(n)
|
|
132
|
+
threading.Thread(target=held.proc.wait, name="webbee-job-end", daemon=True).start()
|
|
133
|
+
held.released.set()
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def drop(held: Held) -> None:
|
|
137
|
+
"""A command that ended while the terminal waited leaves nothing behind: its output went back with the call."""
|
|
138
|
+
if not held.released.is_set():
|
|
139
|
+
shutil.rmtree(held.folder, ignore_errors=True)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def link(held: Held, session_id: str, n: int, title: str = "", home: str = "") -> str:
|
|
143
|
+
"""The held command becomes job ``n`` of ``session_id`` on this machine: the job's name leads to its run folder,
|
|
144
|
+
so the SDK's lines read it as any job. Raises ``FileExistsError`` when that job's folder is already there (a
|
|
145
|
+
number is never given twice on one machine) -- the caller then leaves the command in the foreground."""
|
|
146
|
+
dest = sj.local_dir(sj.job_dir(session_id, n), home or home_dir())
|
|
147
|
+
os.symlink(held.folder, dest) # fails, atomically, if the name is taken
|
|
148
|
+
with open(os.path.join(held.folder, "title"), "w", encoding="utf-8") as f:
|
|
149
|
+
f.write(" ".join(str(title or "").split())[:sj.TITLE_CHARS])
|
|
150
|
+
return dest
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
# ---- the jobs of a session, read from this machine ----------------------------------------------------------------
|
|
154
|
+
|
|
155
|
+
def mine(session_id: str, home: str = "") -> list:
|
|
156
|
+
"""The jobs of ``session_id`` this machine holds, oldest first: ``{n, id, path, title, command, reported,
|
|
157
|
+
started}``. A folder is a job when its name is the session's and it holds a process id (a start that never ran
|
|
158
|
+
left none)."""
|
|
159
|
+
base, part, out = root(home), sj.session_part(session_id), []
|
|
160
|
+
try:
|
|
161
|
+
names = os.listdir(base)
|
|
162
|
+
except OSError:
|
|
163
|
+
return out
|
|
164
|
+
for name in names:
|
|
165
|
+
got = sj.job_of_dir(name)
|
|
166
|
+
if not got or got[0] != part:
|
|
167
|
+
continue
|
|
168
|
+
path = os.path.join(base, name)
|
|
169
|
+
if not os.path.isfile(os.path.join(path, "pid")):
|
|
170
|
+
continue
|
|
171
|
+
try:
|
|
172
|
+
started = os.stat(os.path.join(path, "pid")).st_mtime
|
|
173
|
+
except OSError:
|
|
174
|
+
started = 0.0
|
|
175
|
+
out.append({"n": got[1], "id": sj.job_id(got[1]), "path": path,
|
|
176
|
+
"title": _read(os.path.join(path, "title"), 400).strip(),
|
|
177
|
+
"command": _read(os.path.join(path, "cmd"), 2000).strip(),
|
|
178
|
+
"reported": _read(os.path.join(path, REPORTED), 40).strip(), "started": started})
|
|
179
|
+
return sorted(out, key=lambda j: j["n"])
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def find(session_id: str, ident, home: str = ""):
|
|
183
|
+
"""The job named ``j3`` / ``3``, or None."""
|
|
184
|
+
want = str(ident or "").strip().lower().lstrip("j")
|
|
185
|
+
return next((j for j in mine(session_id, home) if str(j["n"]) == want), None) if want.isdigit() else None
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def poll(session_id: str, n: int, home: str = "") -> str:
|
|
189
|
+
"""The raw output of the job's poll line, run here -- what the kernel reads with its own reader. "" when the
|
|
190
|
+
line could not run."""
|
|
191
|
+
try:
|
|
192
|
+
got = subprocess.run(["sh", "-c", sj.poll_line(sj.job_dir(session_id, n))], env=_env(home),
|
|
193
|
+
stdin=subprocess.DEVNULL, capture_output=True, timeout=POLL_TIMEOUT_S)
|
|
194
|
+
except (OSError, subprocess.SubprocessError, ValueError):
|
|
195
|
+
return ""
|
|
196
|
+
return got.stdout.decode("utf-8", errors="replace")
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def state_of(session_id: str, n: int, home: str = "") -> dict:
|
|
200
|
+
"""``{state, exit_code, tail}`` of a job, read now (``sj.read_poll``); state "" when nothing could be read."""
|
|
201
|
+
return sj.read_poll(poll(session_id, n, home))
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def cancel(session_id: str, n: int, home: str = "") -> tuple:
|
|
205
|
+
"""End job ``n``: ``(sent?, the line's own words)``."""
|
|
206
|
+
try:
|
|
207
|
+
got = subprocess.run(["sh", "-c", sj.cancel_line(sj.job_dir(session_id, n))], env=_env(home),
|
|
208
|
+
stdin=subprocess.DEVNULL, capture_output=True, timeout=POLL_TIMEOUT_S)
|
|
209
|
+
except (OSError, subprocess.SubprocessError, ValueError) as exc:
|
|
210
|
+
return False, type(exc).__name__
|
|
211
|
+
text = got.stdout.decode("utf-8", errors="replace")
|
|
212
|
+
return got.returncode == 0 and "cancel sent" in text, text.strip()
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def mark_reported(path: str, state: str) -> None:
|
|
216
|
+
try:
|
|
217
|
+
with open(os.path.join(path, REPORTED), "w", encoding="utf-8") as f:
|
|
218
|
+
f.write(str(state or "ended"))
|
|
219
|
+
except OSError:
|
|
220
|
+
pass
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def log_tail(path: str, max_bytes: int = 16000) -> str:
|
|
224
|
+
"""The end of a job's log, whole lines where it was cut."""
|
|
225
|
+
try:
|
|
226
|
+
with open(os.path.join(path, "log"), "rb") as f:
|
|
227
|
+
f.seek(0, os.SEEK_END)
|
|
228
|
+
size = f.tell()
|
|
229
|
+
f.seek(max(0, size - max_bytes))
|
|
230
|
+
raw = f.read()
|
|
231
|
+
except OSError:
|
|
232
|
+
return ""
|
|
233
|
+
text = raw.decode("utf-8", errors="replace")
|
|
234
|
+
return text.split("\n", 1)[-1] if size > max_bytes and "\n" in text else text
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def line_of(job: dict, got: dict, now: float = 0.0) -> str:
|
|
238
|
+
"""One job as the terminal lists it: its id, its state read now, how long, what it is."""
|
|
239
|
+
state, code = str(got.get("state") or "unreadable"), got.get("exit_code")
|
|
240
|
+
how = {sj.RUNNING: "running", sj.DONE: "done (exit 0)", sj.FAILED: f"failed (exit {code})",
|
|
241
|
+
sj.CANCELLED: "cancelled", sj.LOST: "lost (its process is gone and left no exit code)"}.get(state, state)
|
|
242
|
+
if state == sj.RUNNING and job.get("started"):
|
|
243
|
+
secs = max(0, int((now or time.time()) - float(job["started"])))
|
|
244
|
+
how += f" for {secs // 60} min {secs % 60} s" if secs >= 60 else f" for {secs} s"
|
|
245
|
+
what = job.get("title") or job.get("command") or ""
|
|
246
|
+
cmd = job.get("command") or ""
|
|
247
|
+
return f"{job['id']} {how} {what}" + (f" `{cmd}`" if cmd and cmd != what else "")
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def prune(home: str = "", now: float = 0.0, keep_days: float = KEEP_DAYS) -> int:
|
|
251
|
+
"""Remove what nobody will read again: a job's folder whose end the kernel holds and that is older than
|
|
252
|
+
``keep_days``, and a run folder no job leads to whose process is gone (a terminal that died mid-command).
|
|
253
|
+
Returns how many folders went. Never touches a running process's folder."""
|
|
254
|
+
base, now, gone = root(home), now or time.time(), 0
|
|
255
|
+
runs = os.path.join(base, sj.RUNS)
|
|
256
|
+
try:
|
|
257
|
+
names = os.listdir(base)
|
|
258
|
+
except OSError:
|
|
259
|
+
return 0
|
|
260
|
+
linked = set()
|
|
261
|
+
for name in names:
|
|
262
|
+
path = os.path.join(base, name)
|
|
263
|
+
if name == sj.RUNS or not sj.job_of_dir(name):
|
|
264
|
+
continue
|
|
265
|
+
target = os.path.realpath(path)
|
|
266
|
+
old = False
|
|
267
|
+
try:
|
|
268
|
+
old = now - os.stat(os.path.join(target, "pid")).st_mtime > keep_days * 86400
|
|
269
|
+
except OSError:
|
|
270
|
+
old = os.path.islink(path) # a link to nothing: its run folder is gone
|
|
271
|
+
if old and (os.path.isfile(os.path.join(target, REPORTED)) or not os.path.isdir(target)):
|
|
272
|
+
if os.path.islink(path):
|
|
273
|
+
os.unlink(path)
|
|
274
|
+
if os.path.dirname(target) == os.path.realpath(runs):
|
|
275
|
+
shutil.rmtree(target, ignore_errors=True)
|
|
276
|
+
else:
|
|
277
|
+
shutil.rmtree(path, ignore_errors=True)
|
|
278
|
+
gone += 1
|
|
279
|
+
elif os.path.islink(path):
|
|
280
|
+
linked.add(target)
|
|
281
|
+
try:
|
|
282
|
+
held = os.listdir(runs)
|
|
283
|
+
except OSError:
|
|
284
|
+
return gone
|
|
285
|
+
for name in held:
|
|
286
|
+
path = os.path.join(runs, name)
|
|
287
|
+
# only a real folder of the terminal's own is ever removed: a link put here leads somewhere this module
|
|
288
|
+
# did not make (security read 2026-11-27)
|
|
289
|
+
if os.path.islink(path) or not os.path.isdir(path) or os.path.realpath(path) in linked:
|
|
290
|
+
continue
|
|
291
|
+
try:
|
|
292
|
+
pid = int(_read(os.path.join(path, "pid"), 20).strip() or 0)
|
|
293
|
+
fresh = now - os.stat(path).st_mtime < 3600
|
|
294
|
+
except (OSError, ValueError):
|
|
295
|
+
continue
|
|
296
|
+
if fresh or _alive(pid):
|
|
297
|
+
continue
|
|
298
|
+
shutil.rmtree(path, ignore_errors=True)
|
|
299
|
+
gone += 1
|
|
300
|
+
return gone
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
def _alive(pid: int) -> bool:
|
|
304
|
+
if pid <= 0:
|
|
305
|
+
return False
|
|
306
|
+
for target in (-pid, pid): # the group, or the process itself
|
|
307
|
+
try:
|
|
308
|
+
os.kill(target, 0)
|
|
309
|
+
return True
|
|
310
|
+
except ProcessLookupError:
|
|
311
|
+
continue
|
|
312
|
+
except OSError:
|
|
313
|
+
return True # it is there and not ours to signal
|
|
314
|
+
return False
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""The terminal's watch over the jobs of its session on this machine (one-loop plan, rule 8, design
|
|
2
|
+
``p8-local-jobs-design-v1.md``).
|
|
3
|
+
|
|
4
|
+
The kernel reaches the person's machine only through their terminal, so the terminal reads its jobs and TELLS the
|
|
5
|
+
kernel: it runs each unfinished job's poll line (the kernel's own read-only line, ``imperal_sdk.session_jobs``) and
|
|
6
|
+
posts the line's raw output to the gateway's door. It says nothing of the state itself -- the kernel reads the output
|
|
7
|
+
with its own reader, writes the record and, at a job's end, tells the session in its own words. The terminal only
|
|
8
|
+
shows the line the kernel answered with.
|
|
9
|
+
|
|
10
|
+
A report goes when the state changed and, while nothing changes, once per ``HEARTBEAT_S`` -- the kernel reads
|
|
11
|
+
three missed heartbeats as silence (``core.session_jobs.QUIET_S``). Jobs are found on disk at every tick, so one that
|
|
12
|
+
ended while the terminal was closed is reported at the terminal's next start with no list kept anywhere else."""
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import asyncio
|
|
16
|
+
import time
|
|
17
|
+
|
|
18
|
+
from imperal_sdk import session_jobs as sj
|
|
19
|
+
|
|
20
|
+
from webbee import jobs
|
|
21
|
+
|
|
22
|
+
TICK_S = 5.0 # one look at the session's jobs; the look is local and reads four small files a job
|
|
23
|
+
HEARTBEAT_S = 60.0 # a running job is told of this often while nothing changes
|
|
24
|
+
RETRY_S = 15.0 # a report that did not get through is sent again after this, not at every look
|
|
25
|
+
MISSES_KNOWN = 3 # the kernel said this often that the session has no such job: it is not the session's
|
|
26
|
+
PRUNE_EVERY_S = 3600.0
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def due(prev, state: str, now: float, heartbeat: float = HEARTBEAT_S) -> bool:
|
|
30
|
+
"""PURE. Whether a job's state is told now: never told, changed since, or a heartbeat has passed."""
|
|
31
|
+
return prev is None or prev[0] != state or now - prev[1] >= heartbeat
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
async def watch(*, session_id, post, on_line=None, on_count=None, tick: float = TICK_S,
|
|
35
|
+
heartbeat: float = HEARTBEAT_S,
|
|
36
|
+
home: str = "", _monotonic=None, _sleep=None) -> None:
|
|
37
|
+
"""Run until cancelled. Seams, all given by the terminal's wiring:
|
|
38
|
+
* session_id() -- async; the session this terminal's turns use ("" while it is not known yet);
|
|
39
|
+
* post(sid, n, stdout) -- async; sends one report and returns the kernel's answer
|
|
40
|
+
(``{ok, state, ended, already, line}``) or None when it did not get through (told again at the next tick);
|
|
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).
|
|
43
|
+
Fail-soft: any error skips the tick; the jobs are on disk and the next tick reads them again."""
|
|
44
|
+
if not jobs.supported():
|
|
45
|
+
return
|
|
46
|
+
now = _monotonic or time.monotonic
|
|
47
|
+
sleep = _sleep or asyncio.sleep
|
|
48
|
+
told: dict = {} # (sid, n) -> (state, when)
|
|
49
|
+
misses: dict = {}
|
|
50
|
+
retry: dict = {} # (sid, n) -> not before
|
|
51
|
+
pruned = None
|
|
52
|
+
while True:
|
|
53
|
+
await sleep(tick)
|
|
54
|
+
try:
|
|
55
|
+
if pruned is None or now() - pruned >= PRUNE_EVERY_S:
|
|
56
|
+
pruned = now()
|
|
57
|
+
await asyncio.to_thread(jobs.prune, home)
|
|
58
|
+
sid = str(await session_id() or "")
|
|
59
|
+
if not sid:
|
|
60
|
+
continue
|
|
61
|
+
running = 0
|
|
62
|
+
for job in await asyncio.to_thread(jobs.mine, sid, home):
|
|
63
|
+
if job["reported"]:
|
|
64
|
+
continue
|
|
65
|
+
key = (sid, job["n"])
|
|
66
|
+
out = await asyncio.to_thread(jobs.poll, sid, job["n"], home)
|
|
67
|
+
state = sj.read_poll(out)["state"]
|
|
68
|
+
running += state == sj.RUNNING
|
|
69
|
+
if not state or retry.get(key, 0.0) > now() or not due(told.get(key), state, now(), heartbeat):
|
|
70
|
+
continue
|
|
71
|
+
answer = await post(sid, job["n"], out)
|
|
72
|
+
if not isinstance(answer, dict):
|
|
73
|
+
retry[key] = now() + RETRY_S # not through (the network, a gateway without the door):
|
|
74
|
+
continue # the same state is told again, a little later
|
|
75
|
+
told[key] = (state, now())
|
|
76
|
+
if answer.get("ok"):
|
|
77
|
+
misses.pop(key, None)
|
|
78
|
+
if answer.get("ended"):
|
|
79
|
+
jobs.mark_reported(job["path"], str(answer.get("state") or state))
|
|
80
|
+
if on_line is not None and not answer.get("already"):
|
|
81
|
+
on_line(str(answer.get("line") or jobs.line_of(job, {"state": state})))
|
|
82
|
+
continue
|
|
83
|
+
misses[key] = misses.get(key, 0) + 1
|
|
84
|
+
if misses[key] >= MISSES_KNOWN and state in sj.ENDED:
|
|
85
|
+
# the kernel holds no such job of this session (a folder of another time): nothing more to tell
|
|
86
|
+
jobs.mark_reported(job["path"], "unknown")
|
|
87
|
+
if on_count is not None:
|
|
88
|
+
on_count(running)
|
|
89
|
+
except asyncio.CancelledError:
|
|
90
|
+
raise
|
|
91
|
+
except Exception:
|
|
92
|
+
continue
|
|
@@ -578,6 +578,32 @@ class RichSink:
|
|
|
578
578
|
self.console.print(_pad(block))
|
|
579
579
|
self._nudge()
|
|
580
580
|
|
|
581
|
+
def agent_sent(self, to: str, whole: str, ok: bool = True, note: str = "", iid: str = "") -> None:
|
|
582
|
+
"""THIS session's agent wrote to another session (a kernel ``agent_message_sent`` frame; the owner,
|
|
583
|
+
2026-11-27: "I do not see in the terminal when Webbee herself sends a message and what is in it"): to
|
|
584
|
+
whom, the message as it was written, and what became of it -- the same block an incoming message gets,
|
|
585
|
+
with an arrow, and one more line when it was NOT sent, saying why. Display-only; a frame delivered twice
|
|
586
|
+
prints once."""
|
|
587
|
+
iid = str(iid or "")
|
|
588
|
+
seen = self.__dict__.setdefault("_agent_seen", set())
|
|
589
|
+
if iid and iid in seen:
|
|
590
|
+
return
|
|
591
|
+
if iid:
|
|
592
|
+
seen.add(iid)
|
|
593
|
+
body = _clean(str(whole or "")).strip()
|
|
594
|
+
head = f"{AGENT_MARK}→ {_clean(str(to or '')).strip() or 'another session'} · {len(body)} chars"
|
|
595
|
+
block = Text.assemble((f"{time.strftime('%H:%M:%S')} ", "dim grey50"),
|
|
596
|
+
(head + ("" if ok else " · NOT SENT"), f"bold {_BEE}" if ok else "bold red"))
|
|
597
|
+
for row in body.splitlines():
|
|
598
|
+
block.append(chr(10))
|
|
599
|
+
block.append(" │ ", style="dim grey50")
|
|
600
|
+
block.append(row)
|
|
601
|
+
if not ok and str(note or "").strip():
|
|
602
|
+
block.append(chr(10))
|
|
603
|
+
block.append(" └ " + _clean(str(note)).strip(), style="red")
|
|
604
|
+
self.console.print(_pad(block))
|
|
605
|
+
self._nudge()
|
|
606
|
+
|
|
581
607
|
def remote_dequeued(self, origin: str, iid: str) -> None:
|
|
582
608
|
"""The kernel drained (or dedup-dropped) one queued item
|
|
583
609
|
(`task_dequeued` frame): remove its panel row by `iid`. The
|