webbee 0.7.28__tar.gz → 0.7.29__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.
Files changed (210) hide show
  1. {webbee-0.7.28 → webbee-0.7.29}/CHANGELOG.md +13 -0
  2. {webbee-0.7.28 → webbee-0.7.29}/PKG-INFO +3 -3
  3. {webbee-0.7.28 → webbee-0.7.29}/pyproject.toml +3 -3
  4. webbee-0.7.29/src/webbee/__init__.py +1 -0
  5. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/commands.py +12 -0
  6. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/home_view.py +13 -4
  7. webbee-0.7.29/src/webbee/jobs.py +314 -0
  8. webbee-0.7.29/src/webbee/jobwatch.py +92 -0
  9. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/repl.py +87 -1
  10. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/session.py +60 -0
  11. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/slots.py +1 -0
  12. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/tools.py +73 -7
  13. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/tui.py +20 -3
  14. webbee-0.7.29/tests/test_jobs_1127.py +320 -0
  15. {webbee-0.7.28 → webbee-0.7.29}/tests/test_tools.py +13 -8
  16. {webbee-0.7.28 → webbee-0.7.29}/uv.lock +9 -9
  17. webbee-0.7.28/src/webbee/__init__.py +0 -1
  18. {webbee-0.7.28 → webbee-0.7.29}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  19. {webbee-0.7.28 → webbee-0.7.29}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  20. {webbee-0.7.28 → webbee-0.7.29}/.github/pull_request_template.md +0 -0
  21. {webbee-0.7.28 → webbee-0.7.29}/.github/workflows/os-check.yml +0 -0
  22. {webbee-0.7.28 → webbee-0.7.29}/.github/workflows/publish.yml +0 -0
  23. {webbee-0.7.28 → webbee-0.7.29}/.gitignore +0 -0
  24. {webbee-0.7.28 → webbee-0.7.29}/LICENSE +0 -0
  25. {webbee-0.7.28 → webbee-0.7.29}/PRIVACY.md +0 -0
  26. {webbee-0.7.28 → webbee-0.7.29}/README.md +0 -0
  27. {webbee-0.7.28 → webbee-0.7.29}/SECURITY.md +0 -0
  28. {webbee-0.7.28 → webbee-0.7.29}/assets/architecture.png +0 -0
  29. {webbee-0.7.28 → webbee-0.7.29}/assets/demo.gif +0 -0
  30. {webbee-0.7.28 → webbee-0.7.29}/assets/hero.png +0 -0
  31. {webbee-0.7.28 → webbee-0.7.29}/assets/social-preview.png +0 -0
  32. {webbee-0.7.28 → webbee-0.7.29}/ci/__init__.py +0 -0
  33. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/__init__.py +0 -0
  34. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/drivers.py +0 -0
  35. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/fixture.py +0 -0
  36. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/fixture_long.py +0 -0
  37. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/fixture_wait.py +0 -0
  38. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/provision_user.py +0 -0
  39. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/registry.py +0 -0
  40. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/replay.py +0 -0
  41. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/run.py +0 -0
  42. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/scenarios_account.py +0 -0
  43. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/scenarios_code.py +0 -0
  44. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/scenarios_contract.py +0 -0
  45. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/scenarios_long.py +0 -0
  46. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/scenarios_wait.py +0 -0
  47. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/test_drivers.py +0 -0
  48. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/test_fixture.py +0 -0
  49. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/test_fixture_long.py +0 -0
  50. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/test_fixture_wait.py +0 -0
  51. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/test_registry.py +0 -0
  52. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/test_replay.py +0 -0
  53. {webbee-0.7.28 → webbee-0.7.29}/ci/field_gate/wipe.py +0 -0
  54. {webbee-0.7.28 → webbee-0.7.29}/ci/os_check.py +0 -0
  55. {webbee-0.7.28 → webbee-0.7.29}/dev-webbee +0 -0
  56. {webbee-0.7.28 → webbee-0.7.29}/install.sh +0 -0
  57. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/__main__.py +0 -0
  58. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/_launch.py +0 -0
  59. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/account.py +0 -0
  60. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/active_sessions.py +0 -0
  61. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/autoupdate.py +0 -0
  62. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/banner_art.py +0 -0
  63. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/boot.py +0 -0
  64. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/browser.py +0 -0
  65. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/checkpoints.py +0 -0
  66. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/cli.py +0 -0
  67. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/clipboard.py +0 -0
  68. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/clipboard_read.py +0 -0
  69. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/clipboard_session.py +0 -0
  70. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/coding_context.py +0 -0
  71. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/config.py +0 -0
  72. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/consent.py +0 -0
  73. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/details.py +0 -0
  74. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/events.py +0 -0
  75. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/expand.py +0 -0
  76. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/frames.py +0 -0
  77. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/home.py +0 -0
  78. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/http.py +0 -0
  79. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/instance_lock.py +0 -0
  80. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/intel/__init__.py +0 -0
  81. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/intel/graph.py +0 -0
  82. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/intel/outline.py +0 -0
  83. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/intel/query.py +0 -0
  84. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/intel/service.py +0 -0
  85. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/intel/store.py +0 -0
  86. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/intel/tree.py +0 -0
  87. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/intel/watch.py +0 -0
  88. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/loop_errors.py +0 -0
  89. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/media.py +0 -0
  90. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/modals.py +0 -0
  91. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/mode_store.py +0 -0
  92. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/native_files.py +0 -0
  93. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/native_read.py +0 -0
  94. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/newtab_mode.py +0 -0
  95. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/output_pane.py +0 -0
  96. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/pricing_constants.py +0 -0
  97. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/queue_panel.py +0 -0
  98. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/reflow.py +0 -0
  99. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/remote.py +0 -0
  100. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/render.py +0 -0
  101. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/repo.py +0 -0
  102. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/selection.py +0 -0
  103. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/sessions.py +0 -0
  104. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/sizing.py +0 -0
  105. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/stallwatch.py +0 -0
  106. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/steer.py +0 -0
  107. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/stream.py +0 -0
  108. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/tab_store.py +0 -0
  109. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/tabs.py +0 -0
  110. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/thread.py +0 -0
  111. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/tier_store.py +0 -0
  112. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/todo_panel.py +0 -0
  113. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/tokens.py +0 -0
  114. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/update.py +0 -0
  115. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/urlopen.py +0 -0
  116. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/wallet.py +0 -0
  117. {webbee-0.7.28 → webbee-0.7.29}/src/webbee/worktrees.py +0 -0
  118. {webbee-0.7.28 → webbee-0.7.29}/tests/__init__.py +0 -0
  119. {webbee-0.7.28 → webbee-0.7.29}/tests/conftest.py +0 -0
  120. {webbee-0.7.28 → webbee-0.7.29}/tests/test_account.py +0 -0
  121. {webbee-0.7.28 → webbee-0.7.29}/tests/test_active_sessions.py +0 -0
  122. {webbee-0.7.28 → webbee-0.7.29}/tests/test_append_file.py +0 -0
  123. {webbee-0.7.28 → webbee-0.7.29}/tests/test_audit_2026_07_25_findings.py +0 -0
  124. {webbee-0.7.28 → webbee-0.7.29}/tests/test_autoupdate.py +0 -0
  125. {webbee-0.7.28 → webbee-0.7.29}/tests/test_checkpoints.py +0 -0
  126. {webbee-0.7.28 → webbee-0.7.29}/tests/test_checkpoints_nested_1030.py +0 -0
  127. {webbee-0.7.28 → webbee-0.7.29}/tests/test_cli.py +0 -0
  128. {webbee-0.7.28 → webbee-0.7.29}/tests/test_clipboard.py +0 -0
  129. {webbee-0.7.28 → webbee-0.7.29}/tests/test_clipboard_read.py +0 -0
  130. {webbee-0.7.28 → webbee-0.7.29}/tests/test_code_map_fresh.py +0 -0
  131. {webbee-0.7.28 → webbee-0.7.29}/tests/test_coding_context.py +0 -0
  132. {webbee-0.7.28 → webbee-0.7.29}/tests/test_commands.py +0 -0
  133. {webbee-0.7.28 → webbee-0.7.29}/tests/test_config.py +0 -0
  134. {webbee-0.7.28 → webbee-0.7.29}/tests/test_cpc_contract_stable.py +0 -0
  135. {webbee-0.7.28 → webbee-0.7.29}/tests/test_cpc_outline.py +0 -0
  136. {webbee-0.7.28 → webbee-0.7.29}/tests/test_cross_loop_token.py +0 -0
  137. {webbee-0.7.28 → webbee-0.7.29}/tests/test_details.py +0 -0
  138. {webbee-0.7.28 → webbee-0.7.29}/tests/test_events.py +0 -0
  139. {webbee-0.7.28 → webbee-0.7.29}/tests/test_expand.py +0 -0
  140. {webbee-0.7.28 → webbee-0.7.29}/tests/test_field_test_1113.py +0 -0
  141. {webbee-0.7.28 → webbee-0.7.29}/tests/test_freeze_fix.py +0 -0
  142. {webbee-0.7.28 → webbee-0.7.29}/tests/test_home.py +0 -0
  143. {webbee-0.7.28 → webbee-0.7.29}/tests/test_home_view.py +0 -0
  144. {webbee-0.7.28 → webbee-0.7.29}/tests/test_home_view_mouse.py +0 -0
  145. {webbee-0.7.28 → webbee-0.7.29}/tests/test_inspect_page.py +0 -0
  146. {webbee-0.7.28 → webbee-0.7.29}/tests/test_instance_lock.py +0 -0
  147. {webbee-0.7.28 → webbee-0.7.29}/tests/test_intel_any_folder.py +0 -0
  148. {webbee-0.7.28 → webbee-0.7.29}/tests/test_intel_cache_and_sync_worker.py +0 -0
  149. {webbee-0.7.28 → webbee-0.7.29}/tests/test_intel_checksum_tree.py +0 -0
  150. {webbee-0.7.28 → webbee-0.7.29}/tests/test_intel_chunker.py +0 -0
  151. {webbee-0.7.28 → webbee-0.7.29}/tests/test_intel_embed.py +0 -0
  152. {webbee-0.7.28 → webbee-0.7.29}/tests/test_intel_folder_1106.py +0 -0
  153. {webbee-0.7.28 → webbee-0.7.29}/tests/test_intel_graph.py +0 -0
  154. {webbee-0.7.28 → webbee-0.7.29}/tests/test_intel_no_numpy.py +0 -0
  155. {webbee-0.7.28 → webbee-0.7.29}/tests/test_intel_query.py +0 -0
  156. {webbee-0.7.28 → webbee-0.7.29}/tests/test_intel_service.py +0 -0
  157. {webbee-0.7.28 → webbee-0.7.29}/tests/test_intel_store.py +0 -0
  158. {webbee-0.7.28 → webbee-0.7.29}/tests/test_intel_watch.py +0 -0
  159. {webbee-0.7.28 → webbee-0.7.29}/tests/test_launch.py +0 -0
  160. {webbee-0.7.28 → webbee-0.7.29}/tests/test_loop_errors.py +0 -0
  161. {webbee-0.7.28 → webbee-0.7.29}/tests/test_marathon.py +0 -0
  162. {webbee-0.7.28 → webbee-0.7.29}/tests/test_modals_e2e.py +0 -0
  163. {webbee-0.7.28 → webbee-0.7.29}/tests/test_mode_and_remote_0_6_8.py +0 -0
  164. {webbee-0.7.28 → webbee-0.7.29}/tests/test_mode_store.py +0 -0
  165. {webbee-0.7.28 → webbee-0.7.29}/tests/test_native_files.py +0 -0
  166. {webbee-0.7.28 → webbee-0.7.29}/tests/test_newtab_mode.py +0 -0
  167. {webbee-0.7.28 → webbee-0.7.29}/tests/test_packaging.py +0 -0
  168. {webbee-0.7.28 → webbee-0.7.29}/tests/test_probe_cost.py +0 -0
  169. {webbee-0.7.28 → webbee-0.7.29}/tests/test_queue_manage_0337.py +0 -0
  170. {webbee-0.7.28 → webbee-0.7.29}/tests/test_read_never_waits_for_the_repo.py +0 -0
  171. {webbee-0.7.28 → webbee-0.7.29}/tests/test_reflow.py +0 -0
  172. {webbee-0.7.28 → webbee-0.7.29}/tests/test_remote_code_reads.py +0 -0
  173. {webbee-0.7.28 → webbee-0.7.29}/tests/test_render.py +0 -0
  174. {webbee-0.7.28 → webbee-0.7.29}/tests/test_repl.py +0 -0
  175. {webbee-0.7.28 → webbee-0.7.29}/tests/test_repo.py +0 -0
  176. {webbee-0.7.28 → webbee-0.7.29}/tests/test_resilient_http.py +0 -0
  177. {webbee-0.7.28 → webbee-0.7.29}/tests/test_result_fits_the_door.py +0 -0
  178. {webbee-0.7.28 → webbee-0.7.29}/tests/test_review_fixes_1030.py +0 -0
  179. {webbee-0.7.28 → webbee-0.7.29}/tests/test_session.py +0 -0
  180. {webbee-0.7.28 → webbee-0.7.29}/tests/test_session_review_1030.py +0 -0
  181. {webbee-0.7.28 → webbee-0.7.29}/tests/test_sessions.py +0 -0
  182. {webbee-0.7.28 → webbee-0.7.29}/tests/test_sizing.py +0 -0
  183. {webbee-0.7.28 → webbee-0.7.29}/tests/test_slots.py +0 -0
  184. {webbee-0.7.28 → webbee-0.7.29}/tests/test_ssh_guard.py +0 -0
  185. {webbee-0.7.28 → webbee-0.7.29}/tests/test_stallwatch.py +0 -0
  186. {webbee-0.7.28 → webbee-0.7.29}/tests/test_steer.py +0 -0
  187. {webbee-0.7.28 → webbee-0.7.29}/tests/test_stream.py +0 -0
  188. {webbee-0.7.28 → webbee-0.7.29}/tests/test_tab_bar_stability.py +0 -0
  189. {webbee-0.7.28 → webbee-0.7.29}/tests/test_tab_restore_0337.py +0 -0
  190. {webbee-0.7.28 → webbee-0.7.29}/tests/test_tabs.py +0 -0
  191. {webbee-0.7.28 → webbee-0.7.29}/tests/test_terminal_ux_0336.py +0 -0
  192. {webbee-0.7.28 → webbee-0.7.29}/tests/test_thread.py +0 -0
  193. {webbee-0.7.28 → webbee-0.7.29}/tests/test_tier_invalidation.py +0 -0
  194. {webbee-0.7.28 → webbee-0.7.29}/tests/test_tier_store.py +0 -0
  195. {webbee-0.7.28 → webbee-0.7.29}/tests/test_todo_panel.py +0 -0
  196. {webbee-0.7.28 → webbee-0.7.29}/tests/test_tokens.py +0 -0
  197. {webbee-0.7.28 → webbee-0.7.29}/tests/test_tool_ack.py +0 -0
  198. {webbee-0.7.28 → webbee-0.7.29}/tests/test_tools_eol_cancel_1030.py +0 -0
  199. {webbee-0.7.28 → webbee-0.7.29}/tests/test_tools_vision_websearch.py +0 -0
  200. {webbee-0.7.28 → webbee-0.7.29}/tests/test_tray_1126.py +0 -0
  201. {webbee-0.7.28 → webbee-0.7.29}/tests/test_tui.py +0 -0
  202. {webbee-0.7.28 → webbee-0.7.29}/tests/test_tui_hardening.py +0 -0
  203. {webbee-0.7.28 → webbee-0.7.29}/tests/test_update.py +0 -0
  204. {webbee-0.7.28 → webbee-0.7.29}/tests/test_update_badge_0340.py +0 -0
  205. {webbee-0.7.28 → webbee-0.7.29}/tests/test_urlopen.py +0 -0
  206. {webbee-0.7.28 → webbee-0.7.29}/tests/test_version.py +0 -0
  207. {webbee-0.7.28 → webbee-0.7.29}/tests/test_version_badge_corner.py +0 -0
  208. {webbee-0.7.28 → webbee-0.7.29}/tests/test_voice_outcome.py +0 -0
  209. {webbee-0.7.28 → webbee-0.7.29}/tests/test_wallet.py +0 -0
  210. {webbee-0.7.28 → webbee-0.7.29}/tests/test_worktrees.py +0 -0
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.7.29
4
+
5
+ * Background work on your machine, in full. A command Webbee is waiting for goes to the background with Ctrl+Z
6
+ (or `/bg`): it is not restarted or touched - the wait ends, the command runs on as a job of the session and
7
+ outlives the terminal. `/jobs` (Ctrl+O) lists the session's jobs, `/job N` shows a job's output so far,
8
+ `/job N cancel` ends it. The status line counts what runs in the background.
9
+ * Webbee is told when a job ends, by the kernel itself - also for a job that ended while the terminal was closed:
10
+ the next start reports it.
11
+ * Every shell command now writes its output to a file of its own folder instead of a pipe to the terminal, so a
12
+ command that leaves a child running returns when it is done, not when the child closes its output.
13
+ * The version badge says "installed" or "is out" only of a version newer than the running one.
14
+ * Needs imperal-sdk 6.13.0.
15
+
3
16
  ## 0.7.28
4
17
 
5
18
  * 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.28
3
+ Version: 0.7.29
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.23; python_version >= '3.10'
35
- Requires-Dist: imperal-sdk[universal-index]>=6.10.1; python_version >= '3.10'
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.28"
3
+ version = "0.7.29"
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.23; python_version >= "3.10"', # raised to the newest at each release
17
- 'imperal-sdk[universal-index]>=6.10.1; python_version >= "3.10"',
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.29"
@@ -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 and installed != v:
223
+ if _newer(installed, v):
215
224
  return (f"{vtxt} → {installed} · restart", "class:home.update")
216
- if latest and latest != v:
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 and installed != v:
248
+ if _newer(installed, v):
240
249
  return (vtxt, f"{installed} installed", "restart to use it")
241
- if latest and latest != v:
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
@@ -192,7 +192,7 @@ def _slot_ctx(slot: SessionSlot, *, logged_in: bool, slots=None) -> CommandConte
192
192
  _HOME_GATED_ACTIONS = frozenset({
193
193
  "steps", "step_detail", "checkpoints", "rollback", "notify", "mode",
194
194
  "model_tier", "queue", "queue_clear", "queue_drop", "queue_edit",
195
- "rename", "attach",
195
+ "rename", "attach", "jobs", "job", "background",
196
196
  })
197
197
 
198
198
  _HOME_GATE_NOTE = "open a session tab first — Ctrl+T or type a task"
@@ -1323,6 +1323,15 @@ async def run_repl(cfg, mode: str = "default", *, once: bool = False, sink=None,
1323
1323
  else:
1324
1324
  _say(slot, "Detail unavailable (expired or not recorded).")
1325
1325
  return "continue"
1326
+ if res.action == "jobs":
1327
+ _say(slot, await _jobs_text(slot))
1328
+ return "continue"
1329
+ if res.action == "job":
1330
+ _say(slot, await _job_text(slot, res.arg))
1331
+ return "continue"
1332
+ if res.action == "background":
1333
+ await _to_background(slot)
1334
+ return "continue"
1326
1335
  if res.action == "checkpoints":
1327
1336
  shadow = _resources_for(slot.workspace).get("shadow")
1328
1337
  if shadow is None:
@@ -1606,6 +1615,81 @@ async def run_repl(cfg, mode: str = "default", *, once: bool = False, sink=None,
1606
1615
  return
1607
1616
  _sink.end_turn(text)
1608
1617
 
1618
+ async def _slot_session_id(slot: SessionSlot) -> str:
1619
+ """The session id of a slot: the one its turns got from the gateway, else the one they will get (derived
1620
+ the way the idle poll derives it) -- a job of the session is found before its first turn here too."""
1621
+ sid = getattr(slot.agent, "session_id", "") or ""
1622
+ if sid:
1623
+ return sid
1624
+ from webbee.steer import derive_session_id
1625
+ try:
1626
+ return await derive_session_id(cfg, token_provider, slot.workspace, marathon=not once,
1627
+ slot_id=slot.slot_id)
1628
+ except Exception:
1629
+ return ""
1630
+
1631
+ async def _jobs_text(slot: SessionSlot) -> str:
1632
+ """`/jobs`: the session's jobs on this machine, each read now."""
1633
+ from webbee import jobs
1634
+ if not jobs.supported():
1635
+ return "Background jobs are not available on this system."
1636
+ sid = await _slot_session_id(slot)
1637
+ mine = await asyncio.to_thread(jobs.mine, sid) if sid else []
1638
+ if not mine:
1639
+ return ("No background jobs in this session. Ctrl+Z (or /bg) sends the command Webbee is waiting for "
1640
+ "to the background; she can start one herself too.")
1641
+ rows = []
1642
+ for job in mine:
1643
+ got = await asyncio.to_thread(jobs.state_of, sid, job["n"])
1644
+ rows.append(" " + jobs.line_of(job, got))
1645
+ return "Background jobs:\n" + "\n".join(rows) + "\n /job N shows a job's output · /job N cancel ends it"
1646
+
1647
+ async def _job_text(slot: SessionSlot, arg: str) -> str:
1648
+ """`/job N [cancel]`: one job's state and the end of its output, read now -- or its end."""
1649
+ from webbee import jobs
1650
+ if not jobs.supported():
1651
+ return "Background jobs are not available on this system."
1652
+ parts = arg.split()
1653
+ sid = await _slot_session_id(slot)
1654
+ job = await asyncio.to_thread(jobs.find, sid, parts[0]) if sid and parts else None
1655
+ if job is None:
1656
+ return f"No job {parts[0] if parts else ''} in this session (see /jobs)."
1657
+ if len(parts) > 1 and parts[1] == "cancel":
1658
+ sent, said = await asyncio.to_thread(jobs.cancel, sid, job["n"])
1659
+ return (f"{job['id']}: told to end -- Webbee is told when it has ended." if sent
1660
+ else f"{job['id']} was not ended: it is not running (see /job {job['n']}).")
1661
+ if len(parts) > 1:
1662
+ return f"Usage: /job {job['n']} or /job {job['n']} cancel"
1663
+ got = await asyncio.to_thread(jobs.state_of, sid, job["n"])
1664
+ tail = (await asyncio.to_thread(jobs.log_tail, job["path"])).rstrip()
1665
+ return (jobs.line_of(job, got) + "\n" + (tail if tail else "(no output yet)")
1666
+ + f"\nlog: {job['path']}/log")
1667
+
1668
+ async def _to_background(slot: SessionSlot) -> None:
1669
+ """Ctrl+Z / `/bg`: what this tab's turn is waiting for goes to the background."""
1670
+ fn = getattr(slot.agent, "background_running", None)
1671
+ said = (await fn()) if fn is not None else []
1672
+ for line in said or ["Nothing is running in front: there is no command to send to the background."]:
1673
+ _say(slot, "⚙ " + line)
1674
+
1675
+ job_keys = {
1676
+ "background": lambda slot: asyncio.ensure_future(_to_background(slot)),
1677
+ "jobs": lambda slot: asyncio.ensure_future(_handle("/jobs", slot)),
1678
+ }
1679
+
1680
+ def _spawn_slot_jobwatch(slot: SessionSlot) -> None:
1681
+ """One watch per session slot over its jobs on this machine (webbee.jobwatch): it tells the kernel what
1682
+ each job's poll line prints, and shows the job's line when the kernel took its end. In `slot.bg_tasks`,
1683
+ so the slot's own teardown cancels it."""
1684
+ from webbee import jobwatch
1685
+ if not hasattr(slot.agent, "report_job"):
1686
+ return
1687
+ slot.bg_tasks.append(asyncio.ensure_future(jobwatch.watch(
1688
+ session_id=lambda: _slot_session_id(slot),
1689
+ post=lambda sid, n, out: slot.agent.report_job(sid, n, out),
1690
+ on_line=lambda text: _say(slot, "⚙ " + text),
1691
+ on_count=lambda n: setattr(slot, "jobs_running", int(n)))))
1692
+
1609
1693
  async def _run_turn(slot: SessionSlot, line: str, surface: str = "", steer_iid: str = "") -> None:
1610
1694
  """ONE agent turn -- the typed-line path (FIX1: slot-explicit
1611
1695
  end-to-end, was: resolved `slots.active()` internally, map §1's
@@ -1765,6 +1849,7 @@ async def run_repl(cfg, mode: str = "default", *, once: bool = False, sink=None,
1765
1849
  attach_turn=lambda attach_info: _attach_turn_on(slot, attach_info),
1766
1850
  client=shared_client, slot_id=slot.slot_id, initial_delay=offset))
1767
1851
  slot.bg_tasks.append(task)
1852
+ _spawn_slot_jobwatch(slot)
1768
1853
 
1769
1854
  async def _open_new_tab(path: str = "") -> SessionSlot:
1770
1855
  """The shared "open a new tab" flow (Task 5's `/new` action; W4c
@@ -2047,6 +2132,7 @@ async def run_repl(cfg, mode: str = "default", *, once: bool = False, sink=None,
2047
2132
  on_paste=_on_paste,
2048
2133
  live=_live_state,
2049
2134
  update_state=_update_state,
2135
+ job_keys=job_keys,
2050
2136
  )
2051
2137
  finally:
2052
2138
  # 0.3.37: remember the tab layout BEFORE teardown, while the