vibego 1.0.11__py3-none-any.whl → 1.0.13__py3-none-any.whl

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.
bot.py CHANGED
@@ -20,6 +20,7 @@ from aiogram.filters import Command, CommandStart
20
20
  from aiogram.filters.command import CommandObject
21
21
  from aiogram.fsm.context import FSMContext
22
22
  from aiogram.fsm.storage.memory import MemoryStorage
23
+ from aiogram.dispatcher.event.bases import SkipHandler
23
24
  from aiogram.types import (
24
25
  Message,
25
26
  BufferedInputFile,
@@ -990,6 +991,22 @@ async def _dispatch_prompt_to_model(
990
991
  ) -> tuple[bool, Optional[Path]]:
991
992
  """Handle session binding, acknowledgement, and watcher setup after pushing a prompt."""
992
993
 
994
+ if _is_menu_control_message(prompt):
995
+ worker_log.warning(
996
+ "Rejected menu control prompt before tmux dispatch",
997
+ extra={
998
+ "chat": chat_id,
999
+ **_session_extra(),
1000
+ "token": _normalize_choice_token(prompt),
1001
+ },
1002
+ )
1003
+ await _reply_to_chat(
1004
+ chat_id,
1005
+ "Skip/Cancel inputs are ignored outside interactive menus. Please send an actual prompt.",
1006
+ reply_to=reply_to,
1007
+ )
1008
+ return False, None
1009
+
993
1010
  prev_watcher = CHAT_WATCHERS.pop(chat_id, None)
994
1011
  if prev_watcher is not None:
995
1012
  if not prev_watcher.done():
@@ -1816,6 +1833,17 @@ async def _enqueue_media_group_message(message: Message, text_part: Optional[str
1816
1833
  async def _handle_prompt_dispatch(message: Message, prompt: str) -> None:
1817
1834
  """Wrapper routine that pushes prompts to the model."""
1818
1835
 
1836
+ if _is_menu_control_message(prompt):
1837
+ worker_log.info(
1838
+ "Dropped menu control prompt during dispatch",
1839
+ extra={
1840
+ **_session_extra(),
1841
+ "chat": getattr(message.chat, "id", None),
1842
+ "token": _normalize_choice_token(prompt),
1843
+ },
1844
+ )
1845
+ return
1846
+
1819
1847
  if ENV_ISSUES:
1820
1848
  message_text = _format_env_issue_message()
1821
1849
  worker_log.warning(
@@ -2299,6 +2327,12 @@ def _is_cancel_message(value: Optional[str]) -> bool:
2299
2327
  return lowered in cancel_tokens
2300
2328
 
2301
2329
 
2330
+ def _is_menu_control_message(value: Optional[str]) -> bool:
2331
+ """Return True when the payload represents a generic Skip/Cancel menu action."""
2332
+
2333
+ return _is_skip_message(value) or _is_cancel_message(value)
2334
+
2335
+
2302
2336
  _MARKDOWN_ESCAPE_RE = re.compile(r"([_*\[\]()~`>#+=|{}.!])")
2303
2337
  TASK_REFERENCE_PATTERN = re.compile(r"/?TASK[_]?\d{4,}")
2304
2338
 
@@ -7021,18 +7055,18 @@ async def on_task_push_model_supplement(message: Message, state: FSMContext) ->
7021
7055
  if resolved == "Cancel" or trimmed == "Cancel":
7022
7056
  await state.clear()
7023
7057
  await message.answer("Push to the model cancelled.", reply_markup=_build_worker_main_keyboard())
7024
- return
7058
+ raise SkipHandler()
7025
7059
  data = await state.get_data()
7026
7060
  task_id = data.get("task_id")
7027
7061
  if not task_id:
7028
7062
  await state.clear()
7029
7063
  await message.answer("The push session has expired, please click the button again.", reply_markup=_build_worker_main_keyboard())
7030
- return
7064
+ raise SkipHandler()
7031
7065
  task = await TASK_SERVICE.get_task(task_id)
7032
7066
  if task is None:
7033
7067
  await state.clear()
7034
7068
  await message.answer("Task not found. Push cancelled.", reply_markup=_build_worker_main_keyboard())
7035
- return
7069
+ raise SkipHandler()
7036
7070
  supplement: Optional[str] = None
7037
7071
  if trimmed and resolved != SKIP_TEXT:
7038
7072
  if len(trimmed) > DESCRIPTION_MAX_LENGTH:
@@ -7040,7 +7074,7 @@ async def on_task_push_model_supplement(message: Message, state: FSMContext) ->
7040
7074
  f"Supplementary task description cannot exceed {DESCRIPTION_MAX_LENGTH} characters. Please re-enter:",
7041
7075
  reply_markup=_build_description_keyboard(),
7042
7076
  )
7043
- return
7077
+ raise SkipHandler()
7044
7078
  supplement = raw_text.strip()
7045
7079
  chat_id = data.get("chat_id") or message.chat.id
7046
7080
  origin_message = data.get("origin_message")
@@ -7061,11 +7095,11 @@ async def on_task_push_model_supplement(message: Message, state: FSMContext) ->
7061
7095
  extra={"task_id": task_id, "status": task.status if task else None},
7062
7096
  )
7063
7097
  await message.answer("Push failed: missing template configuration.", reply_markup=_build_worker_main_keyboard())
7064
- return
7098
+ raise SkipHandler()
7065
7099
  await state.clear()
7066
7100
  if not success:
7067
7101
  await message.answer("Push failed: model is not ready. Please retry shortly.", reply_markup=_build_worker_main_keyboard())
7068
- return
7102
+ raise SkipHandler()
7069
7103
  preview_block, preview_parse_mode = _wrap_text_in_code_block(prompt)
7070
7104
  await _reply_to_chat(
7071
7105
  chat_id,
@@ -7076,6 +7110,7 @@ async def on_task_push_model_supplement(message: Message, state: FSMContext) ->
7076
7110
  )
7077
7111
  if session_path is not None:
7078
7112
  await _send_session_ack(chat_id, session_path, reply_to=origin_message)
7113
+ raise SkipHandler()
7079
7114
 
7080
7115
 
7081
7116
  @router.callback_query(F.data.startswith("task:history:"))
@@ -8196,6 +8231,16 @@ async def on_text(m: Message, state: FSMContext | None = None):
8196
8231
  extra={**_session_extra(), "chat": m.chat.id, "state": current_state},
8197
8232
  )
8198
8233
  return
8234
+ if _is_menu_control_message(prompt):
8235
+ worker_log.info(
8236
+ "Suppressed stray menu control input without active wizard",
8237
+ extra={
8238
+ **_session_extra(),
8239
+ "chat": getattr(m.chat, "id", None),
8240
+ "token": _normalize_choice_token(prompt),
8241
+ },
8242
+ )
8243
+ return
8199
8244
  await _handle_prompt_dispatch(m, prompt)
8200
8245
 
8201
8246
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vibego
3
- Version: 1.0.11
3
+ Version: 1.0.13
4
4
  Summary: vibego CLI: tools for bootstrapping and managing the Telegram Master Bot
5
5
  Author: DavidChan
6
6
  License-Expression: LicenseRef-Proprietary
@@ -1,4 +1,4 @@
1
- bot.py,sha256=CZhCSzPAqoZnL_LDaO_qSNDTP562aU3JvHvafjPUz4s,302812
1
+ bot.py,sha256=CYafcUAWUSm2jiYLQR0B41jeacMcIuIhKyBqU33o7OE,304395
2
2
  logging_setup.py,sha256=ViXK11TNVakIbA8QMLKXa6ywpAV_j1ydcws0Hx2QqNo,5084
3
3
  master.py,sha256=bpcqGsUpk8kHW8sqD6QG6ss-5LGO1OsQ7zsdvkgDJ3E,132763
4
4
  project_repository.py,sha256=fdO3xzvt7eBLvek_3mXjXkFpALwllrNWDWeSjtscW2I,17675
@@ -427,15 +427,15 @@ tasks/constants.py,sha256=BNMxSnswF-PTij-p7paMK0G5Tj6wKN-6qpUlMwo1JQA,318
427
427
  tasks/fsm.py,sha256=6n0hdFNF3j6ZUcpdJ_TwZBgkrE8aMYHNLHppdGbXGO4,1494
428
428
  tasks/models.py,sha256=3OJL3F3nVZIQIejL6LplZkPQxYJXgOhCNA9Rikg8ihk,2461
429
429
  tasks/service.py,sha256=rzd2v3kZaRpTi54cEAg2GJbeg45VTufC8bGSL1nGJWc,40115
430
- vibego-1.0.11.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
431
- vibego_cli/__init__.py,sha256=vIcx509KPFkxx_WGt0hrTRW9L4_1JAbHnojdgL2RZ7w,350
430
+ vibego-1.0.13.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
431
+ vibego_cli/__init__.py,sha256=kDTL5x8W9WpwZMorsUDzSw8PmcBEXF5_gcQsTfAPkJM,350
432
432
  vibego_cli/__main__.py,sha256=lM_m-i1x3yVNQhzRt8wqvuIYeeo1OlLNAEVoJVD7tmw,155
433
433
  vibego_cli/config.py,sha256=W-n5y4CTrRpencadWlmhpdrhUHX6tdXQEGXJG1pRM0U,3149
434
434
  vibego_cli/deps.py,sha256=nFT-DMsfAiD1lLFnDotxe6aYfeeD9V5TrIPbIbAMTF4,1478
435
435
  vibego_cli/main.py,sha256=CZAUHWr45GzzEfALoLuSrnvG2VUuCexiFuCpIvyH8Jc,12506
436
436
  vibego_cli/data/worker_requirements.txt,sha256=QSt30DSSSHtfucTFPpc7twk9kLS5rVLNTcvDiagxrZg,62
437
- vibego-1.0.11.dist-info/METADATA,sha256=miT7a3hXzn39mpDcBtCQHHRY8gLVz0rnNw4_mHccn0g,11901
438
- vibego-1.0.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
439
- vibego-1.0.11.dist-info/entry_points.txt,sha256=Lsy_zm-dlyxt8-9DL9blBReIwU2k22c8-kifr46ND1M,48
440
- vibego-1.0.11.dist-info/top_level.txt,sha256=R56CT3nW5H5v3ce0l3QDN4-C4qxTrNWzRTwrxnkDX4U,69
441
- vibego-1.0.11.dist-info/RECORD,,
437
+ vibego-1.0.13.dist-info/METADATA,sha256=LxftGfu-gPYEuPCl4Yt5XgvSBM1USH7xDQsWSoab8-s,11901
438
+ vibego-1.0.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
439
+ vibego-1.0.13.dist-info/entry_points.txt,sha256=Lsy_zm-dlyxt8-9DL9blBReIwU2k22c8-kifr46ND1M,48
440
+ vibego-1.0.13.dist-info/top_level.txt,sha256=R56CT3nW5H5v3ce0l3QDN4-C4qxTrNWzRTwrxnkDX4U,69
441
+ vibego-1.0.13.dist-info/RECORD,,
vibego_cli/__init__.py CHANGED
@@ -8,6 +8,6 @@ from __future__ import annotations
8
8
 
9
9
  __all__ = ["main", "__version__"]
10
10
 
11
- __version__ = "1.0.11"
11
+ __version__ = "1.0.13"
12
12
 
13
13
  from .main import main # noqa: E402