@agentikos/omega-os 0.19.40 → 0.19.41

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.
@@ -188,7 +188,7 @@ from omega_engine.genesis import (
188
188
  )
189
189
  from omega_engine import plan as plan_v7
190
190
 
191
- __version__ = "0.19.40"
191
+ __version__ = "0.19.41"
192
192
 
193
193
  __all__ = [
194
194
  "__version__",
@@ -2989,14 +2989,43 @@ def cmd_menu(_args: argparse.Namespace) -> int:
2989
2989
  return 2
2990
2990
 
2991
2991
  if os.environ.get("TMUX"):
2992
- # We're already in a tmux session. Don't try to attach (tmux
2993
- # refuses nested attach). Tell the user how to switch.
2992
+ # We're already inside a tmux client. Nested `tmux attach` is
2993
+ # rejected by tmux, but `tmux switch-client` works fine — and is
2994
+ # what the user wants when they type `omega` from inside tmux.
2995
+ # v0.19.41 — actually DO the switch instead of just printing
2996
+ # instructions. Print is the v0.19.40 bug ("ça lance rien du tout").
2997
+ import subprocess
2994
2998
  if not tmux.is_alive(OMEGA_SESSION):
2995
2999
  tmux.spawn_omega_master(_omega_home())
2996
- print(f" Omega session is running. Switch to it with:")
2997
- print(f" tmux switch-client -t {OMEGA_SESSION}")
2998
- print(f" Or use Ctrl-b s to pick from the session list,")
2999
- print(f" or Ctrl-b z for the tmux-claude session manager.")
3000
+ # Are we already INSIDE the Omega session?
3001
+ proc = subprocess.run(
3002
+ ["tmux", "display-message", "-p", "#S"],
3003
+ capture_output=True, text=True,
3004
+ )
3005
+ current = (proc.stdout or "").strip()
3006
+ if current == OMEGA_SESSION:
3007
+ # Already in Omega — just jump to the menu window. If the
3008
+ # menu window was killed, recreate it.
3009
+ wins = subprocess.run(
3010
+ ["tmux", "list-windows", "-t", OMEGA_SESSION, "-F", "#W"],
3011
+ capture_output=True, text=True,
3012
+ )
3013
+ if "menu" not in (wins.stdout or "").split():
3014
+ subprocess.run(
3015
+ ["tmux", "new-window", "-t", OMEGA_SESSION, "-n",
3016
+ "menu", "omega menu-tui"],
3017
+ capture_output=True,
3018
+ )
3019
+ subprocess.run(
3020
+ ["tmux", "select-window", "-t", f"{OMEGA_SESSION}:menu"],
3021
+ capture_output=True,
3022
+ )
3023
+ else:
3024
+ # Different session — switch the client to Omega.
3025
+ subprocess.run(
3026
+ ["tmux", "switch-client", "-t", OMEGA_SESSION],
3027
+ capture_output=True,
3028
+ )
3000
3029
  return 0
3001
3030
 
3002
3031
  if not tmux.is_alive(OMEGA_SESSION):
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "omega-engine"
3
- version = "0.19.40"
3
+ version = "0.19.41"
4
4
  description = "The Omega OS orchestration engine — event-sourced, verified-completion agent graphs."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -219,5 +219,99 @@ class TestAisbChat(unittest.TestCase):
219
219
  self.assertEqual(history[1].text, "ok, will look into it")
220
220
 
221
221
 
222
+ class TestBareOmegaAttachesNotPrints(unittest.TestCase):
223
+ """v0.19.41 — bug fix. `omega` (no args) used to PRINT instructions
224
+ instead of doing the switch when invoked from inside tmux. Lock in
225
+ that cmd_menu calls tmux switch-client / select-window directly."""
226
+
227
+ def test_cmd_menu_when_in_tmux_calls_switch_client(self):
228
+ """When $TMUX is set AND we're in a DIFFERENT session than Omega,
229
+ cmd_menu must run `tmux switch-client -t Omega` itself — not
230
+ print a hint and exit."""
231
+ import argparse
232
+ with mock.patch.dict("os.environ", {"TMUX": "/tmp/tmux-fake,1,0"}):
233
+ calls = []
234
+ class _FakeProc:
235
+ stdout = "some-other-session\n"
236
+ returncode = 0
237
+ def _fake_run(cmd, **kw):
238
+ calls.append(cmd)
239
+ return _FakeProc()
240
+ with mock.patch("subprocess.run", side_effect=_fake_run), \
241
+ mock.patch("shutil.which", return_value="/usr/bin/tmux"), \
242
+ mock.patch("omega_engine.tmux.is_alive", return_value=True):
243
+ from omega_engine.cli import cmd_menu
244
+ rc = cmd_menu(argparse.Namespace())
245
+ self.assertEqual(rc, 0)
246
+ switch_calls = [c for c in calls
247
+ if isinstance(c, list)
248
+ and len(c) >= 4
249
+ and c[:2] == ["tmux", "switch-client"]]
250
+ self.assertTrue(switch_calls,
251
+ f"cmd_menu must call `tmux switch-client -t Omega` when "
252
+ f"invoked from inside a different tmux session. "
253
+ f"Captured calls: {calls}")
254
+
255
+ def test_cmd_menu_when_already_in_omega_selects_menu_window(self):
256
+ """If the user is ALREADY in the Omega session, cmd_menu must
257
+ select the :menu window (not switch-client — that'd be a no-op)."""
258
+ import argparse
259
+ with mock.patch.dict("os.environ", {"TMUX": "/tmp/tmux-fake,1,0"}):
260
+ calls = []
261
+ class _ProcS:
262
+ stdout = "Omega\n"; returncode = 0
263
+ class _ProcWins:
264
+ stdout = "menu\naisb\nhermes\n"; returncode = 0
265
+ def _fake_run(cmd, **kw):
266
+ calls.append(cmd)
267
+ if cmd[:3] == ["tmux", "display-message", "-p"]:
268
+ return _ProcS()
269
+ if cmd[:3] == ["tmux", "list-windows", "-t"]:
270
+ return _ProcWins()
271
+ class R: returncode = 0; stdout = ""
272
+ return R()
273
+ with mock.patch("subprocess.run", side_effect=_fake_run), \
274
+ mock.patch("shutil.which", return_value="/usr/bin/tmux"), \
275
+ mock.patch("omega_engine.tmux.is_alive", return_value=True):
276
+ from omega_engine.cli import cmd_menu
277
+ rc = cmd_menu(argparse.Namespace())
278
+ self.assertEqual(rc, 0)
279
+ select_calls = [c for c in calls
280
+ if isinstance(c, list)
281
+ and len(c) >= 4
282
+ and c[:2] == ["tmux", "select-window"]
283
+ and "Omega:menu" in c]
284
+ self.assertTrue(select_calls,
285
+ f"cmd_menu must call `tmux select-window -t Omega:menu` "
286
+ f"when already inside Omega. Captured: {calls}")
287
+ switch_calls = [c for c in calls
288
+ if isinstance(c, list)
289
+ and len(c) >= 2
290
+ and c[:2] == ["tmux", "switch-client"]]
291
+ self.assertEqual(switch_calls, [],
292
+ f"cmd_menu must NOT switch-client when already in Omega.")
293
+
294
+ def test_cmd_menu_does_not_print_hint_when_in_tmux(self):
295
+ """REGRESSION — the v0.19.40 bug: cmd_menu printed
296
+ 'Omega session is running. Switch to it with: ...' instead of
297
+ actually switching."""
298
+ import argparse, io, sys as _sys
299
+ with mock.patch.dict("os.environ", {"TMUX": "/tmp/tmux-fake,1,0"}):
300
+ class _Proc:
301
+ stdout = "Other\n"; returncode = 0
302
+ with mock.patch("subprocess.run", return_value=_Proc()), \
303
+ mock.patch("shutil.which", return_value="/usr/bin/tmux"), \
304
+ mock.patch("omega_engine.tmux.is_alive", return_value=True), \
305
+ mock.patch.object(_sys, "stdout", new_callable=io.StringIO) as captured:
306
+ from omega_engine.cli import cmd_menu
307
+ cmd_menu(argparse.Namespace())
308
+ out = captured.getvalue()
309
+ self.assertNotIn("Switch to it with", out,
310
+ f"v0.19.40 regression: cmd_menu printed switch instructions "
311
+ f"instead of switching. Output: {out!r}")
312
+ self.assertNotIn("tmux switch-client -t Omega", out,
313
+ "cmd_menu must DO the switch, not print the command")
314
+
315
+
222
316
  if __name__ == "__main__":
223
317
  unittest.main(verbosity=2)
@@ -1 +1 @@
1
- 0.19.40
1
+ 0.19.41
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentikos/omega-os",
3
- "version": "0.19.40",
3
+ "version": "0.19.41",
4
4
  "description": "Omega OS — installable agentic operating system with verified-completion orchestration. Event-sourced engine, 8-block rack, autonomous agents, MCP.",
5
5
  "bin": {
6
6
  "omega-os": "bin/omega-os.js"