IncludeCPP 4.0.2__tar.gz → 4.1.0__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 (64) hide show
  1. {includecpp-4.0.2 → includecpp-4.1.0}/IncludeCPP.egg-info/PKG-INFO +101 -1
  2. {includecpp-4.0.2 → includecpp-4.1.0}/IncludeCPP.egg-info/SOURCES.txt +6 -1
  3. {includecpp-4.0.2 → includecpp-4.1.0}/PKG-INFO +101 -1
  4. {includecpp-4.0.2 → includecpp-4.1.0}/README.md +101 -1
  5. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/__init__.py +1 -1
  6. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/__init__.pyi +3 -1
  7. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/cli/commands.py +3 -3
  8. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/ai_integration.py +46 -13
  9. includecpp-4.1.0/includecpp/core/cpp_api_extensions.pyi +622 -0
  10. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/cssl/CSSL_DOCUMENTATION.md +186 -5
  11. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/cssl/cssl_builtins.py +87 -2
  12. includecpp-4.1.0/includecpp/core/cssl/cssl_languages.py +836 -0
  13. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/cssl/cssl_parser.py +138 -38
  14. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/cssl/cssl_runtime.py +364 -24
  15. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/cssl/cssl_syntax.py +88 -4
  16. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/cssl/cssl_types.py +172 -1
  17. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/cssl_bridge.py +194 -8
  18. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/cssl_bridge.pyi +148 -10
  19. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/vscode/cssl/package.json +43 -1
  20. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json +140 -17
  21. {includecpp-4.0.2 → includecpp-4.1.0}/pyproject.toml +1 -1
  22. includecpp-4.1.0/tests/test_multilang.py +511 -0
  23. {includecpp-4.0.2 → includecpp-4.1.0}/IncludeCPP.egg-info/dependency_links.txt +0 -0
  24. {includecpp-4.0.2 → includecpp-4.1.0}/IncludeCPP.egg-info/entry_points.txt +0 -0
  25. {includecpp-4.0.2 → includecpp-4.1.0}/IncludeCPP.egg-info/requires.txt +0 -0
  26. {includecpp-4.0.2 → includecpp-4.1.0}/IncludeCPP.egg-info/top_level.txt +0 -0
  27. {includecpp-4.0.2 → includecpp-4.1.0}/LICENSE +0 -0
  28. {includecpp-4.0.2 → includecpp-4.1.0}/MANIFEST.in +0 -0
  29. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/__main__.py +0 -0
  30. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/cli/__init__.py +0 -0
  31. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/cli/config_parser.py +0 -0
  32. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/__init__.py +0 -0
  33. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/build_manager.py +0 -0
  34. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/cpp_api.py +0 -0
  35. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/cpp_api.pyi +0 -0
  36. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/cppy_converter.py +0 -0
  37. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/cssl/CSSL_DOCUMENTATION_NEW.md +0 -0
  38. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/cssl/__init__.py +0 -0
  39. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/cssl/cssl_builtins.pyi +0 -0
  40. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/cssl/cssl_events.py +0 -0
  41. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/cssl/cssl_modules.py +0 -0
  42. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/error_catalog.py +0 -0
  43. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/error_formatter.py +0 -0
  44. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/exceptions.py +0 -0
  45. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/path_discovery.py +0 -0
  46. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/project_ui.py +0 -0
  47. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/core/settings_ui.py +0 -0
  48. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/generator/__init__.py +0 -0
  49. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/generator/parser.cpp +0 -0
  50. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/generator/parser.h +0 -0
  51. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/generator/type_resolver.cpp +0 -0
  52. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/generator/type_resolver.h +0 -0
  53. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/py.typed +0 -0
  54. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/templates/cpp.proj.template +0 -0
  55. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/vscode/__init__.py +0 -0
  56. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/vscode/cssl/__init__.py +0 -0
  57. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/vscode/cssl/extension.js +0 -0
  58. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/vscode/cssl/images/cssl.png +0 -0
  59. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/vscode/cssl/images/cssl_pl.png +0 -0
  60. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/vscode/cssl/language-configuration.json +0 -0
  61. {includecpp-4.0.2 → includecpp-4.1.0}/includecpp/vscode/cssl/snippets/cssl.snippets.json +0 -0
  62. {includecpp-4.0.2 → includecpp-4.1.0}/requirements.txt +0 -0
  63. {includecpp-4.0.2 → includecpp-4.1.0}/setup.cfg +0 -0
  64. {includecpp-4.0.2 → includecpp-4.1.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: IncludeCPP
3
- Version: 4.0.2
3
+ Version: 4.1.0
4
4
  Summary: Professional C++ Python bindings with type-generic templates, pystubs and native threading
5
5
  Home-page: https://github.com/liliassg/IncludeCPP
6
6
  Author: Lilias Hatterscheidt
@@ -906,3 +906,103 @@ print(greeter.name) # "Python"
906
906
  - `python::export(instance)` - Alias
907
907
 
908
908
  All three do the same thing: wrap a CSSL class instance for Python use.
909
+
910
+ ## Universal Instances (v4.0.3+)
911
+
912
+ Universal instances are shared containers accessible from CSSL, Python, and C++:
913
+
914
+ ```python
915
+ from includecpp import CSSL
916
+
917
+ cssl = CSSL.CsslLang()
918
+
919
+ # Create in CSSL
920
+ cssl.run('''
921
+ instance<"myContainer"> container;
922
+ container.data = "Hello";
923
+ container.count = 42;
924
+ ''')
925
+
926
+ # Access from Python
927
+ container = cssl.getInstance("myContainer")
928
+ print(container.data) # "Hello"
929
+ print(container.count) # 42
930
+
931
+ # Modify from Python
932
+ container.newValue = "Added from Python"
933
+
934
+ # Changes reflect in CSSL
935
+ cssl.run('''
936
+ instance<"myContainer"> c;
937
+ printl(c.newValue); // "Added from Python"
938
+ ''')
939
+ ```
940
+
941
+ ### Instance Methods
942
+
943
+ ```python
944
+ cssl.getInstance("name") # Get instance (None if not found)
945
+ cssl.createInstance("name") # Create or get instance
946
+ cssl.deleteInstance("name") # Delete instance
947
+ cssl.listInstances() # List all instance names
948
+ ```
949
+
950
+ ### Method Injection
951
+
952
+ Inject methods into instances using `+<<==`:
953
+
954
+ ```cssl
955
+ instance<"api"> api;
956
+
957
+ // Inject a method
958
+ api +<<== {
959
+ void greet(string name) {
960
+ printl("Hello, " + name + "!");
961
+ }
962
+ };
963
+
964
+ api.greet("World"); // Hello, World!
965
+ ```
966
+
967
+ ## Simplified Module API (v4.0.2+)
968
+
969
+ Create CSSL modules from files with payload binding:
970
+
971
+ ```python
972
+ from includecpp import CSSL
973
+
974
+ # Register payload from file
975
+ CSSL.makepayload("api", "lib/api/myapi.cssl-pl")
976
+
977
+ # Create module from file, binding to payload
978
+ mod = CSSL.makemodule("writer", "lib/writer.cssl", bind="api")
979
+ mod.SaySomething("Hello!") # Call functions directly
980
+ ```
981
+
982
+ ## VSCode Extension
983
+
984
+ IncludeCPP includes a VSCode extension for CSSL syntax highlighting.
985
+
986
+ ### Installation
987
+
988
+ ```bash
989
+ # Copy extension to VSCode extensions folder
990
+ # Windows: %USERPROFILE%\.vscode\extensions\
991
+ # Linux/Mac: ~/.vscode/extensions/
992
+
993
+ # Or install from included files
994
+ pip show includecpp # Find package location
995
+ # Copy vscode/cssl folder to extensions
996
+ ```
997
+
998
+ ### Features
999
+
1000
+ - Syntax highlighting for `.cssl`, `.cssl-pl`, `.cssl-mod` files
1001
+ - Snippets for common patterns
1002
+ - Run CSSL files with F5
1003
+ - Proper coloring for:
1004
+ - Keywords and control flow
1005
+ - Data types (purple/lilac)
1006
+ - Variable declarations (light blue)
1007
+ - Injection operators (`<<==`, `<==`)
1008
+ - Global (`@`), shared (`$`), and captured (`%`) references
@@ -16,6 +16,7 @@ setup.py
16
16
  ./includecpp/core/build_manager.py
17
17
  ./includecpp/core/cpp_api.py
18
18
  ./includecpp/core/cpp_api.pyi
19
+ ./includecpp/core/cpp_api_extensions.pyi
19
20
  ./includecpp/core/cppy_converter.py
20
21
  ./includecpp/core/cssl_bridge.py
21
22
  ./includecpp/core/cssl_bridge.pyi
@@ -31,6 +32,7 @@ setup.py
31
32
  ./includecpp/core/cssl/cssl_builtins.py
32
33
  ./includecpp/core/cssl/cssl_builtins.pyi
33
34
  ./includecpp/core/cssl/cssl_events.py
35
+ ./includecpp/core/cssl/cssl_languages.py
34
36
  ./includecpp/core/cssl/cssl_modules.py
35
37
  ./includecpp/core/cssl/cssl_parser.py
36
38
  ./includecpp/core/cssl/cssl_runtime.py
@@ -69,6 +71,7 @@ includecpp/core/ai_integration.py
69
71
  includecpp/core/build_manager.py
70
72
  includecpp/core/cpp_api.py
71
73
  includecpp/core/cpp_api.pyi
74
+ includecpp/core/cpp_api_extensions.pyi
72
75
  includecpp/core/cppy_converter.py
73
76
  includecpp/core/cssl_bridge.py
74
77
  includecpp/core/cssl_bridge.pyi
@@ -84,6 +87,7 @@ includecpp/core/cssl/__init__.py
84
87
  includecpp/core/cssl/cssl_builtins.py
85
88
  includecpp/core/cssl/cssl_builtins.pyi
86
89
  includecpp/core/cssl/cssl_events.py
90
+ includecpp/core/cssl/cssl_languages.py
87
91
  includecpp/core/cssl/cssl_modules.py
88
92
  includecpp/core/cssl/cssl_parser.py
89
93
  includecpp/core/cssl/cssl_runtime.py
@@ -103,4 +107,5 @@ includecpp/vscode/cssl/package.json
103
107
  includecpp/vscode/cssl/images/cssl.png
104
108
  includecpp/vscode/cssl/images/cssl_pl.png
105
109
  includecpp/vscode/cssl/snippets/cssl.snippets.json
106
- includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json
110
+ includecpp/vscode/cssl/syntaxes/cssl.tmLanguage.json
111
+ tests/test_multilang.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: IncludeCPP
3
- Version: 4.0.2
3
+ Version: 4.1.0
4
4
  Summary: Professional C++ Python bindings with type-generic templates, pystubs and native threading
5
5
  Home-page: https://github.com/liliassg/IncludeCPP
6
6
  Author: Lilias Hatterscheidt
@@ -906,3 +906,103 @@ print(greeter.name) # "Python"
906
906
  - `python::export(instance)` - Alias
907
907
 
908
908
  All three do the same thing: wrap a CSSL class instance for Python use.
909
+
910
+ ## Universal Instances (v4.0.3+)
911
+
912
+ Universal instances are shared containers accessible from CSSL, Python, and C++:
913
+
914
+ ```python
915
+ from includecpp import CSSL
916
+
917
+ cssl = CSSL.CsslLang()
918
+
919
+ # Create in CSSL
920
+ cssl.run('''
921
+ instance<"myContainer"> container;
922
+ container.data = "Hello";
923
+ container.count = 42;
924
+ ''')
925
+
926
+ # Access from Python
927
+ container = cssl.getInstance("myContainer")
928
+ print(container.data) # "Hello"
929
+ print(container.count) # 42
930
+
931
+ # Modify from Python
932
+ container.newValue = "Added from Python"
933
+
934
+ # Changes reflect in CSSL
935
+ cssl.run('''
936
+ instance<"myContainer"> c;
937
+ printl(c.newValue); // "Added from Python"
938
+ ''')
939
+ ```
940
+
941
+ ### Instance Methods
942
+
943
+ ```python
944
+ cssl.getInstance("name") # Get instance (None if not found)
945
+ cssl.createInstance("name") # Create or get instance
946
+ cssl.deleteInstance("name") # Delete instance
947
+ cssl.listInstances() # List all instance names
948
+ ```
949
+
950
+ ### Method Injection
951
+
952
+ Inject methods into instances using `+<<==`:
953
+
954
+ ```cssl
955
+ instance<"api"> api;
956
+
957
+ // Inject a method
958
+ api +<<== {
959
+ void greet(string name) {
960
+ printl("Hello, " + name + "!");
961
+ }
962
+ };
963
+
964
+ api.greet("World"); // Hello, World!
965
+ ```
966
+
967
+ ## Simplified Module API (v4.0.2+)
968
+
969
+ Create CSSL modules from files with payload binding:
970
+
971
+ ```python
972
+ from includecpp import CSSL
973
+
974
+ # Register payload from file
975
+ CSSL.makepayload("api", "lib/api/myapi.cssl-pl")
976
+
977
+ # Create module from file, binding to payload
978
+ mod = CSSL.makemodule("writer", "lib/writer.cssl", bind="api")
979
+ mod.SaySomething("Hello!") # Call functions directly
980
+ ```
981
+
982
+ ## VSCode Extension
983
+
984
+ IncludeCPP includes a VSCode extension for CSSL syntax highlighting.
985
+
986
+ ### Installation
987
+
988
+ ```bash
989
+ # Copy extension to VSCode extensions folder
990
+ # Windows: %USERPROFILE%\.vscode\extensions\
991
+ # Linux/Mac: ~/.vscode/extensions/
992
+
993
+ # Or install from included files
994
+ pip show includecpp # Find package location
995
+ # Copy vscode/cssl folder to extensions
996
+ ```
997
+
998
+ ### Features
999
+
1000
+ - Syntax highlighting for `.cssl`, `.cssl-pl`, `.cssl-mod` files
1001
+ - Snippets for common patterns
1002
+ - Run CSSL files with F5
1003
+ - Proper coloring for:
1004
+ - Keywords and control flow
1005
+ - Data types (purple/lilac)
1006
+ - Variable declarations (light blue)
1007
+ - Injection operators (`<<==`, `<==`)
1008
+ - Global (`@`), shared (`$`), and captured (`%`) references
@@ -870,4 +870,104 @@ print(greeter.name) # "Python"
870
870
  - `python::wrap(instance)` - Alias
871
871
  - `python::export(instance)` - Alias
872
872
 
873
- All three do the same thing: wrap a CSSL class instance for Python use.
873
+ All three do the same thing: wrap a CSSL class instance for Python use.
874
+
875
+ ## Universal Instances (v4.0.3+)
876
+
877
+ Universal instances are shared containers accessible from CSSL, Python, and C++:
878
+
879
+ ```python
880
+ from includecpp import CSSL
881
+
882
+ cssl = CSSL.CsslLang()
883
+
884
+ # Create in CSSL
885
+ cssl.run('''
886
+ instance<"myContainer"> container;
887
+ container.data = "Hello";
888
+ container.count = 42;
889
+ ''')
890
+
891
+ # Access from Python
892
+ container = cssl.getInstance("myContainer")
893
+ print(container.data) # "Hello"
894
+ print(container.count) # 42
895
+
896
+ # Modify from Python
897
+ container.newValue = "Added from Python"
898
+
899
+ # Changes reflect in CSSL
900
+ cssl.run('''
901
+ instance<"myContainer"> c;
902
+ printl(c.newValue); // "Added from Python"
903
+ ''')
904
+ ```
905
+
906
+ ### Instance Methods
907
+
908
+ ```python
909
+ cssl.getInstance("name") # Get instance (None if not found)
910
+ cssl.createInstance("name") # Create or get instance
911
+ cssl.deleteInstance("name") # Delete instance
912
+ cssl.listInstances() # List all instance names
913
+ ```
914
+
915
+ ### Method Injection
916
+
917
+ Inject methods into instances using `+<<==`:
918
+
919
+ ```cssl
920
+ instance<"api"> api;
921
+
922
+ // Inject a method
923
+ api +<<== {
924
+ void greet(string name) {
925
+ printl("Hello, " + name + "!");
926
+ }
927
+ };
928
+
929
+ api.greet("World"); // Hello, World!
930
+ ```
931
+
932
+ ## Simplified Module API (v4.0.2+)
933
+
934
+ Create CSSL modules from files with payload binding:
935
+
936
+ ```python
937
+ from includecpp import CSSL
938
+
939
+ # Register payload from file
940
+ CSSL.makepayload("api", "lib/api/myapi.cssl-pl")
941
+
942
+ # Create module from file, binding to payload
943
+ mod = CSSL.makemodule("writer", "lib/writer.cssl", bind="api")
944
+ mod.SaySomething("Hello!") # Call functions directly
945
+ ```
946
+
947
+ ## VSCode Extension
948
+
949
+ IncludeCPP includes a VSCode extension for CSSL syntax highlighting.
950
+
951
+ ### Installation
952
+
953
+ ```bash
954
+ # Copy extension to VSCode extensions folder
955
+ # Windows: %USERPROFILE%\.vscode\extensions\
956
+ # Linux/Mac: ~/.vscode/extensions/
957
+
958
+ # Or install from included files
959
+ pip show includecpp # Find package location
960
+ # Copy vscode/cssl folder to extensions
961
+ ```
962
+
963
+ ### Features
964
+
965
+ - Syntax highlighting for `.cssl`, `.cssl-pl`, `.cssl-mod` files
966
+ - Snippets for common patterns
967
+ - Run CSSL files with F5
968
+ - Proper coloring for:
969
+ - Keywords and control flow
970
+ - Data types (purple/lilac)
971
+ - Variable declarations (light blue)
972
+ - Injection operators (`<<==`, `<==`)
973
+ - Global (`@`), shared (`$`), and captured (`%`) references
@@ -2,7 +2,7 @@ from .core.cpp_api import CppApi
2
2
  from .core import cssl_bridge as CSSL
3
3
  import warnings
4
4
 
5
- __version__ = "4.0.2"
5
+ __version__ = "4.1.0"
6
6
  __all__ = ["CppApi", "CSSL"]
7
7
 
8
8
  # Module-level cache for C++ modules
@@ -147,7 +147,9 @@ __version__: str
147
147
  # Dynamic module access via: from includecpp import <module_name>
148
148
  # Auto-generated module declarations
149
149
  # These allow: from includecpp import <module_name>
150
- # (Run 'includecpp rebuild' to generate declarations for your modules)
150
+ combat_sim: Combat_simModuleWrapper
151
+ mcts_engine: Mcts_engineModuleWrapper
152
+ pathfinding: PathfindingModuleWrapper
151
153
 
152
154
  def __dir__() -> List[str]:
153
155
  """List available modules including dynamically loaded C++ modules."""
@@ -5199,7 +5199,7 @@ def ai_ask(question, module_name, files, all_modules, exclude, think_mode, think
5199
5199
  verbose.phase('init', 'Setting up context')
5200
5200
  verbose.detail('Question', question[:50] + '...' if len(question) > 50 else question)
5201
5201
  verbose.detail('Mode', mode)
5202
- verbose.detail('Model', ai_mgr.config.get('model', 'gpt-5'))
5202
+ verbose.detail('Model', ai_mgr.config.get('model', 'gpt-4o'))
5203
5203
 
5204
5204
  project_root = Path.cwd()
5205
5205
  plugins_dir = project_root / "plugins"
@@ -5220,7 +5220,7 @@ def ai_ask(question, module_name, files, all_modules, exclude, think_mode, think
5220
5220
  files=len(source_files) + len(plugin_files),
5221
5221
  lines=total_lines,
5222
5222
  tokens=total_lines * 4, # Approximate
5223
- model=ai_mgr.config.get('model', 'gpt-5')
5223
+ model=ai_mgr.config.get('model', 'gpt-4o')
5224
5224
  )
5225
5225
 
5226
5226
  if use_websearch:
@@ -6456,7 +6456,7 @@ def _convert_with_ai(content: str, module_name: str, source_file,
6456
6456
  )
6457
6457
 
6458
6458
  if not success:
6459
- ai_verbose.warning("AI conversion failed, using standard converter")
6459
+ ai_verbose.warning(f"AI conversion failed: {response}")
6460
6460
  ai_verbose.phase('fallback', 'Falling back to standard conversion')
6461
6461
  ai_verbose.end(success=True, message="Fallback successful")
6462
6462
  if to_cpp:
@@ -32,8 +32,12 @@ MODELS = {
32
32
  'gpt-3.5-turbo': {'context': 16385, 'endpoint': 'gpt-3.5-turbo'},
33
33
  'gpt-4-turbo': {'context': 128000, 'endpoint': 'gpt-4-turbo'},
34
34
  'gpt-4o': {'context': 128000, 'endpoint': 'gpt-4o'},
35
+ 'gpt-4o-mini': {'context': 128000, 'endpoint': 'gpt-4o-mini'},
35
36
  'gpt-5': {'context': 256000, 'endpoint': 'gpt-5'},
36
37
  'gpt-5-nano': {'context': 32000, 'endpoint': 'gpt-5-nano'},
38
+ 'o1': {'context': 200000, 'endpoint': 'o1'},
39
+ 'o1-mini': {'context': 128000, 'endpoint': 'o1-mini'},
40
+ 'o1-preview': {'context': 128000, 'endpoint': 'o1-preview'},
37
41
  }
38
42
 
39
43
  DEFAULT_MODEL = 'gpt-5'
@@ -981,18 +985,43 @@ class AIManager:
981
985
  'Content-Type': 'application/json'
982
986
  }
983
987
  token_limit = min(16000, model_info['context'] // 2)
984
- data = {
985
- 'model': model_info['endpoint'],
986
- 'messages': [
987
- {'role': 'system', 'content': system_prompt},
988
- {'role': 'user', 'content': user_prompt}
989
- ]
990
- }
991
- if model.startswith('gpt-5'):
992
- data['max_completion_tokens'] = token_limit
988
+
989
+ # o1 models use different message format (no system message, combined into user)
990
+ # gpt-5 models use max_completion_tokens instead of max_tokens
991
+ is_o1_model = model.startswith('o1')
992
+ is_gpt5_model = model.startswith('gpt-5')
993
+
994
+ if is_o1_model:
995
+ # o1 models: combine system + user into single user message
996
+ combined_content = f"{system_prompt}\n\n---\n\n{user_prompt}"
997
+ data = {
998
+ 'model': model_info['endpoint'],
999
+ 'messages': [
1000
+ {'role': 'user', 'content': combined_content}
1001
+ ],
1002
+ 'max_completion_tokens': token_limit
1003
+ }
1004
+ # o1 models don't support temperature
1005
+ elif is_gpt5_model:
1006
+ # gpt-5 models: use max_completion_tokens, no custom temperature
1007
+ data = {
1008
+ 'model': model_info['endpoint'],
1009
+ 'messages': [
1010
+ {'role': 'system', 'content': system_prompt},
1011
+ {'role': 'user', 'content': user_prompt}
1012
+ ],
1013
+ 'max_completion_tokens': token_limit
1014
+ }
993
1015
  else:
994
- data['max_tokens'] = token_limit
995
- data['temperature'] = temperature
1016
+ data = {
1017
+ 'model': model_info['endpoint'],
1018
+ 'messages': [
1019
+ {'role': 'system', 'content': system_prompt},
1020
+ {'role': 'user', 'content': user_prompt}
1021
+ ],
1022
+ 'max_tokens': token_limit,
1023
+ 'temperature': temperature
1024
+ }
996
1025
  try:
997
1026
  response = requests.post(OPENAI_API_URL, headers=headers, json=data, timeout=timeout)
998
1027
  if response.status_code == 200:
@@ -1312,6 +1341,10 @@ class AIManager:
1312
1341
  import platform
1313
1342
  import subprocess
1314
1343
 
1344
+ # Early fail-fast checks
1345
+ if not self.config.get('api_key'):
1346
+ return False, 'No API key configured. Run: includecpp ai setup', []
1347
+
1315
1348
  # Build tools list for prompt
1316
1349
  tools_list = '\n'.join([
1317
1350
  f"- {name}: {info['desc']}\n Format:\n {info['format']}"
@@ -1371,9 +1404,9 @@ class AIManager:
1371
1404
 
1372
1405
  prompt = self._build_prompt_with_docs(prompt)
1373
1406
 
1374
- # Temperature and timeout
1407
+ # Temperature and timeout (reduced for faster failure detection)
1375
1408
  temperature = 0.1 if think_three else (0.2 if think_twice else 0.3)
1376
- timeout = None if think_three else (420 if think_twice else (300 if think else 180))
1409
+ timeout = 180 if think_three else (120 if think_twice else (90 if think else 60))
1377
1410
 
1378
1411
  # Execute with tool loop
1379
1412
  all_changes = []