assistant 2.0.1b2__tar.gz → 2.0.2b1__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 (89) hide show
  1. {assistant-2.0.1b2/assistant.egg-info → assistant-2.0.2b1}/PKG-INFO +1 -1
  2. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/__init__.py +13 -26
  3. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/agent.py +34 -5
  4. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/builtin_cmds.py +0 -10
  5. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/config.py +12 -0
  6. assistant-2.0.2b1/assistant/entry_points/run_assistant.py +24 -0
  7. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/main.py +209 -217
  8. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/nlp/http_client.py +87 -12
  9. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/nlp/interface.py +58 -1
  10. assistant-2.0.2b1/assistant/nlp/message.py +60 -0
  11. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/nlp/providers/__init__.py +1 -0
  12. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/nlp/providers/google.py +2 -1
  13. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/nlp/providers/llama_cpp.py +2 -0
  14. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/nlp/providers/nim.py +2 -1
  15. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/nlp/providers/ollama.py +2 -0
  16. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/nlp/providers/openai.py +2 -0
  17. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/nlp/providers/openrouter.py +2 -1
  18. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/nlp/providers/vllm.py +2 -1
  19. assistant-2.0.2b1/assistant/nlp/xonsh.py +114 -0
  20. assistant-2.0.2b1/assistant/ptk_shell/bindings.py +539 -0
  21. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/ptk_shell/completer.py +136 -25
  22. assistant-2.0.2b1/assistant/ptk_shell/operators.py +407 -0
  23. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/ptk_shell/shell.py +387 -794
  24. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/setup_wizard.py +46 -12
  25. assistant-2.0.2b1/assistant/tools.py +648 -0
  26. assistant-2.0.2b1/assistant/tools_worker.py +64 -0
  27. {assistant-2.0.1b2 → assistant-2.0.2b1/assistant.egg-info}/PKG-INFO +1 -1
  28. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant.egg-info/SOURCES.txt +11 -10
  29. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant.egg-info/entry_points.txt +3 -0
  30. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant.egg-info/top_level.txt +1 -0
  31. {assistant-2.0.1b2 → assistant-2.0.2b1}/setup.cfg +2 -0
  32. {assistant-2.0.1b2 → assistant-2.0.2b1}/setup.py +7 -6
  33. assistant-2.0.2b1/tests/test_config.py +335 -0
  34. assistant-2.0.2b1/tests/test_init.py +193 -0
  35. assistant-2.0.2b1/tests/test_tools.py +505 -0
  36. assistant-2.0.2b1/tests/test_utils.py +236 -0
  37. assistant-2.0.2b1/tests/test_xontrib.py +445 -0
  38. assistant-2.0.2b1/xontrib/__init__.py +1 -0
  39. assistant-2.0.2b1/xontrib/assistant.py +504 -0
  40. assistant-2.0.1b2/assistant/_execer.py +0 -204
  41. assistant-2.0.1b2/assistant/entry_points/run_assistant.py +0 -16
  42. assistant-2.0.1b2/assistant/icons.py +0 -24
  43. assistant-2.0.1b2/assistant/procs/pipelines.py +0 -21
  44. assistant-2.0.1b2/assistant/procs/specs.py +0 -51
  45. assistant-2.0.1b2/assistant/ptk_shell/bindings.py +0 -43
  46. assistant-2.0.1b2/assistant/tools.py +0 -1749
  47. assistant-2.0.1b2/tests/test_asssistant_nl.py +0 -25
  48. assistant-2.0.1b2/tests/test_nl_robustness.py +0 -38
  49. assistant-2.0.1b2/tests/test_robustness_and_environment.py +0 -56
  50. assistant-2.0.1b2/tests/test_tools_execution.py +0 -470
  51. assistant-2.0.1b2/tests/test_xonsh_advanced_features.py +0 -61
  52. assistant-2.0.1b2/tests/test_xonsh_syntax.py +0 -228
  53. {assistant-2.0.1b2 → assistant-2.0.2b1}/LICENSE +0 -0
  54. {assistant-2.0.1b2 → assistant-2.0.2b1}/MANIFEST.in +0 -0
  55. {assistant-2.0.1b2 → assistant-2.0.2b1}/README.md +0 -0
  56. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/__main__.py +0 -0
  57. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/as_client.py +0 -0
  58. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/as_service.py +0 -0
  59. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/codecache.py +0 -0
  60. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/conditions.py +0 -0
  61. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/entry_points/__init__.py +0 -0
  62. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/execer.py +0 -0
  63. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/history.py +0 -0
  64. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/listen/__init__.py +0 -0
  65. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/listen/__main__.py +0 -0
  66. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/listen/interface.py +0 -0
  67. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/listen/main.py +0 -0
  68. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/memory.py +0 -0
  69. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/nlp/__init__.py +0 -0
  70. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/nlp/clear.py +0 -0
  71. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/nlp/exit.py +0 -0
  72. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/nlp/think.py +0 -0
  73. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/parser.py +0 -0
  74. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/ptk_shell/__init__.py +0 -0
  75. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/ptk_shell/dialogs.py +0 -0
  76. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/ptk_shell/floats.py +0 -0
  77. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/ptk_shell/layout.py +0 -0
  78. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/ptk_shell/strformat_utils.py +0 -0
  79. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/ptk_shell/styles.py +0 -0
  80. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/ptk_shell/windows.py +0 -0
  81. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/say/__init__.py +0 -0
  82. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/say/interface.py +0 -0
  83. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/time.py +0 -0
  84. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/utils.py +0 -0
  85. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/version.py +0 -0
  86. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant/vocabulary.py +0 -0
  87. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant.egg-info/dependency_links.txt +0 -0
  88. {assistant-2.0.1b2 → assistant-2.0.2b1}/assistant.egg-info/requires.txt +0 -0
  89. {assistant-2.0.1b2 → assistant-2.0.2b1}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: assistant
3
- Version: 2.0.1b2
3
+ Version: 2.0.2b1
4
4
  Summary: Your very own Assistant. Because you deserve it.
5
5
  Home-page: https://gitlab.com/waser-technologies/technologies/assistant
6
6
  Author: Danny Waser
@@ -1,7 +1,7 @@
1
1
  # from xonsh.main import setup
2
2
  import os
3
3
 
4
- __version__ = "2.0.1b2"
4
+ __version__ = "2.0.2b1"
5
5
 
6
6
  USERNAME = os.environ.get("USER", "root")
7
7
  HOME = os.environ.get("HOME", f"/home/{USERNAME}" if USERNAME != "root" else "/root")
@@ -22,9 +22,9 @@ SYSTEM_ROLE = """Your role is to act as a natural language interface between the
22
22
  The common Xonsh shell session is a shared Xonsh REPL when you and the user can type valid shell command and python code seamlessly in the same environment."""
23
23
 
24
24
  DEFAULT_MODELS_BY_PROVIDER = {
25
- "ollama": ["qwen3.5:latest"],
25
+ "ollama": ["qwen3.6:latest"],
26
26
  "llama_cpp": ["qwen3.5:latest"],
27
- "lmstudio": ["qwen3.5:latest"],
27
+ "lmstudio": ["qwen3.6-35b-a3bt"],
28
28
  "openrouter": ["openrouter/free"],
29
29
  "google": ["gemini-flash-lite-latest"],
30
30
  "nvidia": [
@@ -42,7 +42,7 @@ DEFAULT_MODELS_BY_PROVIDER = {
42
42
 
43
43
  DEFAULT_CONFIG_PATH = os.path.expanduser("~/.assistant/config.toml")
44
44
 
45
- # TODO: improve prompts to imporove conversation flow for agents. (act as one, understand xonsh repl properly)
45
+ # TODO: improve prompts to improve conversation flow for agents. (act as one, understand xonsh repl properly)
46
46
  DEFAULT_CONFIG = {
47
47
  "provider": {
48
48
  "ollama": {
@@ -58,7 +58,7 @@ DEFAULT_CONFIG = {
58
58
  "context_length": 256000,
59
59
  "think": False,
60
60
  "temperature": 0.1,
61
- "max_token": 50,
61
+ "max_token": 1,
62
62
  },
63
63
  },
64
64
  "agent": {
@@ -70,10 +70,10 @@ DEFAULT_CONFIG = {
70
70
  "tools": [
71
71
  "xonsh",
72
72
  "web_search",
73
- "memory_search",
74
- "memory_add",
73
+ # "memory_search",
74
+ # "memory_add",
75
75
  ],
76
- "handoffs": ["system", "web", "memory"],
76
+ # "handoffs": ["system", "web", "memory"],
77
77
  },
78
78
  "system": {
79
79
  "name": "System",
@@ -109,7 +109,11 @@ DEFAULT_CONFIG = {
109
109
  },
110
110
  },
111
111
  "web_search": {"enabled": True, "searxng_url": "http://localhost:8888"},
112
- "completion": {"enabled": True},
112
+ "completion": {
113
+ "enabled": True,
114
+ "wait_timeout": 1,
115
+ "request_timeout": (10.0, 300.0),
116
+ },
113
117
  "execution": {
114
118
  "max_turns": 50,
115
119
  "temperature": 0.1,
@@ -124,21 +128,4 @@ DEFAULT_CONFIG = {
124
128
  "sliding_window_last": 8,
125
129
  "use_summarization": True,
126
130
  },
127
- "tuis": [
128
- "sudo",
129
- "vi",
130
- "vim",
131
- "nvim",
132
- "htop",
133
- "top",
134
- "gping",
135
- "less",
136
- "more",
137
- "man",
138
- "nano",
139
- "view",
140
- "edit",
141
- "xonsh",
142
- "ipython",
143
- ],
144
131
  }
@@ -16,6 +16,7 @@ from assistant.tools import TOOL_REGISTRY
16
16
  from assistant.utils import count_messages_tokens, count_message_tokens
17
17
  from assistant import ASSISTANT_PATH
18
18
  from assistant.nlp.providers import get_provider
19
+ from assistant.nlp.xonsh import XONSH_INTRO
19
20
  from assistant.main import get_random_thinking_sentence
20
21
 
21
22
 
@@ -366,6 +367,17 @@ class Orchestrator:
366
367
  # Clear abort event at start of new request
367
368
  self._abort_event.clear()
368
369
 
370
+ # Install signal handler only right before streaming
371
+ import signal as _sig
372
+
373
+ def _sigint_handler(signum, frame):
374
+ for _ag in self.agents.values():
375
+ if hasattr(_ag, "close_client"):
376
+ _ag.close_client()
377
+ raise KeyboardInterrupt("Ctrl+C")
378
+
379
+ _sig.signal(_sig.SIGINT, _sigint_handler)
380
+
369
381
  self._emit({"type": "status", "text": "Searching memory..."})
370
382
 
371
383
  # Memory Search (if enabled)
@@ -402,6 +414,14 @@ class Orchestrator:
402
414
  # Sync the static sys prompt once per session if possible
403
415
  # Cache for system prompt tokens to avoid re-calculating identical blocks
404
416
  while total_turns < max_turns:
417
+ # Check for abort at start of each turn
418
+ if self._abort_event.is_set():
419
+ self._abort_event.clear()
420
+ context_messages.append(
421
+ {"role": "assistant", "content": "Aborted by user."}
422
+ )
423
+ break
424
+
405
425
  _turn_t0 = time.perf_counter()
406
426
  agent = self.agents.get(active_agent_id)
407
427
  if not agent:
@@ -416,7 +436,7 @@ class Orchestrator:
416
436
  )
417
437
 
418
438
  # Construct system prompt (instructions + env + memory)
419
- sys_prompt = agent.instructions + "\n\n" + env_summary
439
+ sys_prompt = agent.instructions + f"\n{XONSH_INTRO}\n" + env_summary
420
440
  if memory_str:
421
441
  sys_prompt += memory_str
422
442
 
@@ -519,7 +539,9 @@ class Orchestrator:
519
539
  if _is_debug:
520
540
  sys.stderr.write(f"[ERROR] API Call failed: {e}\n")
521
541
  # Check if this is an abort
522
- if "Aborted" in str(e) or isinstance(e, KeyboardInterrupt):
542
+ if isinstance(e, KeyboardInterrupt):
543
+ raise
544
+ if "Aborted" in str(e):
523
545
  if _is_debug:
524
546
  sys.stderr.write(
525
547
  "[DEBUG] Abort exception caught, returning empty response\n"
@@ -737,7 +759,7 @@ class Orchestrator:
737
759
  temp_content = ""
738
760
 
739
761
  # 3. Tool calls
740
- if delta.tool_calls:
762
+ if hasattr(delta, "tool_calls") and delta.tool_calls:
741
763
  for tc_delta in delta.tool_calls:
742
764
  idx = int(getattr(tc_delta, "index", 0) or 0)
743
765
  while len(tool_calls) <= idx:
@@ -830,7 +852,14 @@ class Orchestrator:
830
852
  "args": args,
831
853
  }
832
854
  )
855
+
833
856
  res = TOOL_REGISTRY[fn_name]["fn"](args)
857
+
858
+ # Check for abort after tool execution
859
+ if self._abort_event.is_set():
860
+ self._abort_event.clear()
861
+ return None
862
+
834
863
  self._emit(
835
864
  {
836
865
  "type": "tool_output",
@@ -839,12 +868,12 @@ class Orchestrator:
839
868
  "is_error": res["is_error"],
840
869
  }
841
870
  )
842
-
871
+
843
872
  tool_msg = {
844
873
  "role": "tool",
845
874
  "tool_call_id": t.id,
846
875
  "name": fn_name,
847
- "content": res["content"],
876
+ "content": res["content"] or "",
848
877
  }
849
878
  # Optimization: populate cache immediately
850
879
  tool_msg["_tokens"] = count_message_tokens(tool_msg)
@@ -766,16 +766,6 @@ BUILTIN_COMMANDS = {
766
766
  "description": "Text-to-speech output (requires TTS module)",
767
767
  "usage": "Usage: say [stop|STRING...]",
768
768
  },
769
- "exit": {
770
- "fn": None,
771
- "description": "Exit the shell",
772
- "usage": "Usage: exit",
773
- },
774
- "clear": {
775
- "fn": None,
776
- "description": "Clear the screen",
777
- "usage": "Usage: clear",
778
- },
779
769
  "echo": {
780
770
  "fn": echo_fn,
781
771
  "description": "Echo the STRING(s) to standard output",
@@ -225,6 +225,18 @@ class Config:
225
225
  "enabled", DEFAULT_CONFIG["completion"]["enabled"]
226
226
  )
227
227
 
228
+ @property
229
+ def completion_wait_timeout(self) -> float:
230
+ return self.raw.get("completion", {}).get(
231
+ "wait_timeout", DEFAULT_CONFIG["completion"]["wait_timeout"]
232
+ )
233
+
234
+ @property
235
+ def completion_request_timeout(self) -> tuple:
236
+ return self.raw.get("completion", {}).get(
237
+ "request_timeout", DEFAULT_CONFIG["completion"]["request_timeout"]
238
+ )
239
+
228
240
 
229
241
  _config_instance = None
230
242
  _config_path: Optional[str] = None
@@ -0,0 +1,24 @@
1
+ import signal
2
+ import sys
3
+
4
+
5
+ def _handle_sigint(signum, frame):
6
+ """Handle SIGINT during import by exiting immediately."""
7
+ sys.exit(130)
8
+
9
+
10
+ signal.signal(signal.SIGINT, _handle_sigint)
11
+
12
+ from assistant.main import main
13
+
14
+
15
+ def run():
16
+ try:
17
+ exit_code = main()
18
+ sys.exit(exit_code)
19
+ except SystemExit as e:
20
+ sys.exit(e.code if e.code is not None else 0)
21
+
22
+
23
+ if __name__ == "__main__":
24
+ run()