coreinsight-cli 0.3.3__tar.gz → 0.3.4__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 (34) hide show
  1. {coreinsight_cli-0.3.3/coreinsight_cli.egg-info → coreinsight_cli-0.3.4}/PKG-INFO +1 -1
  2. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/analyzer.py +7 -0
  3. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/prompts/harness.py +7 -0
  4. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/prompts/test_cases.py +11 -0
  5. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/sandbox.py +1 -0
  6. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4/coreinsight_cli.egg-info}/PKG-INFO +1 -1
  7. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/pyproject.toml +1 -1
  8. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/LICENSE +0 -0
  9. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/README.md +0 -0
  10. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/__init__.py +0 -0
  11. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/config.py +0 -0
  12. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/demo/__init__.py +0 -0
  13. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/demo/bad_loop.py +0 -0
  14. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/demo/data_processor.py +0 -0
  15. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/demo/slow.cpp +0 -0
  16. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/embeddings.py +0 -0
  17. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/hardware.py +0 -0
  18. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/indexer.py +0 -0
  19. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/main.py +0 -0
  20. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/memory.py +0 -0
  21. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/parser.py +0 -0
  22. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/profiler.py +0 -0
  23. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/prompts/__init__.py +0 -0
  24. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/prompts/_base.py +0 -0
  25. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/prompts/bottleneck.py +0 -0
  26. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/prompts/optimizer.py +0 -0
  27. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/scanner.py +0 -0
  28. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight/tui.py +0 -0
  29. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight_cli.egg-info/SOURCES.txt +0 -0
  30. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight_cli.egg-info/dependency_links.txt +0 -0
  31. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight_cli.egg-info/entry_points.txt +0 -0
  32. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight_cli.egg-info/requires.txt +0 -0
  33. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/coreinsight_cli.egg-info/top_level.txt +0 -0
  34. {coreinsight_cli-0.3.3 → coreinsight_cli-0.3.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: coreinsight-cli
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: Local-first AI performance profiler that mathematically verifies optimizations for Python, C++, and CUDA
5
5
  Author: Varun Jani
6
6
  License: GPL-3.0-or-later
@@ -256,6 +256,13 @@ class AnalyzerAgent:
256
256
  hardware_target: str = "Generic CPU",
257
257
  stream_callback: Optional[Callable[[str], None]] = None,
258
258
  ) -> str:
259
+ from coreinsight.prompts import ModelTier
260
+ if language.lower() in ("cpp", "c++") and self.model_tier == ModelTier.SMALL:
261
+ raise ValueError(
262
+ f"C++ harness generation requires a MEDIUM or LARGE model "
263
+ f"(current tier: {self.model_tier}). "
264
+ "Switch to a 13B+ model (e.g. codellama:13b, mistral) for C++ support."
265
+ )
259
266
  try:
260
267
  context, original_code = _compress_for_small_model(
261
268
  context, original_code, self.model_tier
@@ -76,6 +76,10 @@ CRITICAL TIMING:
76
76
  - Python: use `time.perf_counter()`. C++: use `std::chrono::high_resolution_clock`.
77
77
  - Clamp: `orig_time = max(end - start, 1e-9)` to prevent zero-division.
78
78
  - Speedup: `speedup = orig_time / opt_time`.
79
+ - TIME BUDGET: each individual timing call MUST complete within 0.5 seconds.
80
+ If the original function at N=1000 takes more than 0.5s, cap N at 500 or 100.
81
+ If a measurement exceeds 0.5s, print a row of zeros and continue — do NOT hang.
82
+ - HARD CAP: maximum N is 10,000. Never exceed this regardless of RAM available.
79
83
 
80
84
  ISOLATION RULES (CRITICAL):
81
85
  - This runs in an empty Docker container. NO local files exist.
@@ -151,6 +155,8 @@ REQUIREMENTS:
151
155
  7. Use high-resolution timers: Python → time.perf_counter(), C++ → std::chrono::high_resolution_clock.
152
156
  8. Clamp: orig_time = max(end - start, 1e-9) to prevent zero-division.
153
157
  9. Speedup = orig_time / opt_time.
158
+ 10. TIME BUDGET: each timing call MUST complete within 0.5 seconds. If N=1000 is too slow, use N=500 or N=100 instead. Print zeros and continue if a run hangs — do NOT exceed the budget.
159
+ 11. HARD CAP: maximum N is 10,000. Never exceed this.
154
160
 
155
161
  ISOLATION RULES (CRITICAL — runs in empty Docker container):
156
162
  - NO local imports. Define everything inline.
@@ -215,6 +221,7 @@ CRITICAL RULES:
215
221
  2. Generate realistic dummy args matching the function signature scaled to N.
216
222
  3. No internet. No pip installs.
217
223
  4. Print CSV header first. If any N crashes, print zeros and continue.
224
+ 5. TIME LIMIT: each timing call must finish in under 0.5s. Use smaller N if needed. Max N = 10,000.
218
225
 
219
226
  PYTHON STRUCTURE EXAMPLE (only if language=python):
220
227
  import time
@@ -37,8 +37,19 @@ Example (do NOT copy this — generate cases specific to {func_name}):
37
37
 
38
38
  CONSTRAINTS:
39
39
  - All values must be plain JSON types — no numpy arrays, no custom objects.
40
+ - Do NOT instantiate any classes (no ClassName(...), no dataclasses, no enums). Use plain dicts instead.
40
41
  - If the function operates on a matrix, represent it as a list-of-lists.
41
42
  - If the function takes a size integer N, generate concrete data of that size inline.
42
43
  - Do NOT include function calls or expressions — only literal values.
43
44
  - Produce exactly {num_cases} test cases.
45
+ - SANDBOX RULE: these test cases run in an isolated environment where project-specific
46
+ imports (custom classes, dataclasses, enums) have been stripped. If the function
47
+ accepts custom objects, pass plain dicts with the same field names instead of class
48
+ instances — e.g. {{"id": 1, "amount": 100.0}} not Transaction(id=1, amount=100.0).
49
+ The function code may use attribute access (obj.field) — dict args are fine for that
50
+ because the sandbox converts them via SimpleNamespace automatically.
51
+ - IN-PLACE MUTATION: if the function mutates its input in-place (e.g. sorts a list,
52
+ fills an array) and returns None, add an optional "expected_mutation" key to the
53
+ test case object — a copy of the input argument in its expected post-call state.
54
+ The harness will compare the mutated arg against expected_mutation if present.
44
55
  """
@@ -39,6 +39,7 @@ import json, sys, math, importlib.util, traceback
39
39
 
40
40
  spec = importlib.util.spec_from_file_location("user_module", "/workspace/source.py")
41
41
  mod = importlib.util.module_from_spec(spec)
42
+ sys.modules["user_module"] = mod # ← register BEFORE exec so @dataclass can resolve cls.__module__
42
43
  spec.loader.exec_module(mod)
43
44
 
44
45
  original_fn = getattr(mod, "{original_func_name}", None)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: coreinsight-cli
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: Local-first AI performance profiler that mathematically verifies optimizations for Python, C++, and CUDA
5
5
  Author: Varun Jani
6
6
  License: GPL-3.0-or-later
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "coreinsight-cli"
7
- version = "0.3.3"
7
+ version = "0.3.4"
8
8
  description = "Local-first AI performance profiler that mathematically verifies optimizations for Python, C++, and CUDA"
9
9
  license = {text = "GPL-3.0-or-later"}
10
10
  authors = [
File without changes