abstractcode 0.1.0__py3-none-any.whl → 0.2.0__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.
abstractcode/__init__.py CHANGED
@@ -9,46 +9,15 @@ Email: contact@abstractcore.ai
9
9
  Website: https://abstractcore.ai
10
10
  """
11
11
 
12
- __version__ = "0.1.0"
12
+ __version__ = "0.2.0"
13
13
  __author__ = "Laurent-Philippe Albou"
14
14
  __email__ = "contact@abstractcore.ai"
15
15
  __license__ = "MIT"
16
16
 
17
- # Package metadata
18
- __all__ = [
19
- "__version__",
20
- "__author__",
21
- "__email__",
22
- "__license__",
23
- "main",
24
- ]
17
+ def main(argv=None):
18
+ """Console entrypoint for `abstractcode`."""
19
+ from .cli import main as _main
25
20
 
21
+ return _main(argv)
26
22
 
27
- def main():
28
- """
29
- Main entry point for the AbstractCode CLI.
30
-
31
- This is a placeholder implementation. Full functionality coming soon.
32
- """
33
- print(f"AbstractCode v{__version__}")
34
- print("=" * 50)
35
- print("🚧 Under Development")
36
- print("=" * 50)
37
- print()
38
- print("AbstractCode is currently under active development.")
39
- print("This is a placeholder release.")
40
- print()
41
- print("Stay tuned for updates!")
42
- print()
43
- print("Built on the Abstract Framework:")
44
- print(" • AbstractCore: https://github.com/lpalbou/abstractcore")
45
- print(" • AbstractRuntime: https://github.com/lpalbou/abstractruntime")
46
- print(" • AbstractAgent: https://github.com/lpalbou/abstractagent")
47
- print()
48
- print(f"Contact: {__email__}")
49
- print("Website: https://abstractcore.ai")
50
-
51
-
52
- if __name__ == "__main__":
53
- main()
54
-
23
+ __all__ = ["__version__", "__author__", "__email__", "__license__", "main"]
abstractcode/cli.py ADDED
@@ -0,0 +1,110 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import os
5
+ import sys
6
+ from pathlib import Path
7
+ from typing import Optional, Sequence
8
+
9
+ from .react_shell import ReactShell
10
+
11
+
12
+ def _default_state_file() -> str:
13
+ env = os.getenv("ABSTRACTCODE_STATE_FILE")
14
+ if env:
15
+ return env
16
+ return str(Path.home() / ".abstractcode" / "state.json")
17
+
18
+
19
+ def _default_max_iterations() -> int:
20
+ env = os.getenv("ABSTRACTCODE_MAX_ITERATIONS")
21
+ if env:
22
+ try:
23
+ value = int(env)
24
+ except ValueError:
25
+ raise SystemExit("ABSTRACTCODE_MAX_ITERATIONS must be an integer.")
26
+ if value < 1:
27
+ raise SystemExit("ABSTRACTCODE_MAX_ITERATIONS must be >= 1.")
28
+ return value
29
+ return 25
30
+
31
+
32
+ def _default_max_tokens() -> Optional[int]:
33
+ env = os.getenv("ABSTRACTCODE_MAX_TOKENS")
34
+ if env:
35
+ try:
36
+ value = int(env)
37
+ except ValueError:
38
+ raise SystemExit("ABSTRACTCODE_MAX_TOKENS must be an integer.")
39
+ if value < 1024:
40
+ raise SystemExit("ABSTRACTCODE_MAX_TOKENS must be >= 1024.")
41
+ return value
42
+ return 32768 # Default 32k context
43
+
44
+
45
+ def build_parser() -> argparse.ArgumentParser:
46
+ parser = argparse.ArgumentParser(
47
+ prog="abstractcode",
48
+ description="AbstractCode: an interactive terminal shell for AbstractFramework agents (MVP).",
49
+ )
50
+ parser.add_argument(
51
+ "--agent",
52
+ choices=("react", "codeact"),
53
+ default=os.getenv("ABSTRACTCODE_AGENT", "react"),
54
+ help="Agent type to run (react|codeact).",
55
+ )
56
+ parser.add_argument("--provider", default="ollama", help="LLM provider (e.g. ollama, openai)")
57
+ parser.add_argument("--model", default="qwen3:1.7b-q4_K_M", help="Model name")
58
+ parser.add_argument(
59
+ "--state-file",
60
+ default=_default_state_file(),
61
+ help="Path to save the current run reference (enables durable file-backed stores).",
62
+ )
63
+ parser.add_argument(
64
+ "--no-state",
65
+ action="store_true",
66
+ help="Disable persistence (keeps run state in memory; cannot resume after quitting).",
67
+ )
68
+ parser.add_argument(
69
+ "--auto-approve",
70
+ "--auto-accept",
71
+ action="store_true",
72
+ dest="auto_approve",
73
+ help="Automatically approve tool calls (unsafe; disables interactive approvals).",
74
+ )
75
+ parser.add_argument(
76
+ "--max-iterations",
77
+ type=int,
78
+ default=_default_max_iterations(),
79
+ help="Maximum ReAct reasoning iterations per task (default: 25).",
80
+ )
81
+ parser.add_argument(
82
+ "--max-tokens",
83
+ type=int,
84
+ default=_default_max_tokens(),
85
+ help="Maximum context tokens for LLM calls (default: 32768).",
86
+ )
87
+ parser.add_argument("--no-color", action="store_true", help="Disable ANSI colors")
88
+ return parser
89
+
90
+
91
+ def main(argv: Optional[Sequence[str]] = None) -> int:
92
+ args = build_parser().parse_args(list(argv) if argv is not None else None)
93
+ state_file = None if args.no_state else args.state_file
94
+
95
+ shell = ReactShell(
96
+ agent=str(args.agent),
97
+ provider=args.provider,
98
+ model=args.model,
99
+ state_file=state_file,
100
+ auto_approve=bool(args.auto_approve),
101
+ max_iterations=int(args.max_iterations),
102
+ max_tokens=args.max_tokens,
103
+ color=not bool(args.no_color),
104
+ )
105
+ shell.run()
106
+ return 0
107
+
108
+
109
+ if __name__ == "__main__":
110
+ raise SystemExit(main(sys.argv[1:]))