aru-code 0.19.0__tar.gz → 0.19.1__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 (59) hide show
  1. {aru_code-0.19.0/aru_code.egg-info → aru_code-0.19.1}/PKG-INFO +1 -1
  2. aru_code-0.19.1/aru/__init__.py +1 -0
  3. {aru_code-0.19.0 → aru_code-0.19.1}/aru/context.py +53 -15
  4. {aru_code-0.19.0 → aru_code-0.19.1/aru_code.egg-info}/PKG-INFO +1 -1
  5. {aru_code-0.19.0 → aru_code-0.19.1}/pyproject.toml +1 -1
  6. aru_code-0.19.0/aru/__init__.py +0 -1
  7. {aru_code-0.19.0 → aru_code-0.19.1}/LICENSE +0 -0
  8. {aru_code-0.19.0 → aru_code-0.19.1}/README.md +0 -0
  9. {aru_code-0.19.0 → aru_code-0.19.1}/aru/agent_factory.py +0 -0
  10. {aru_code-0.19.0 → aru_code-0.19.1}/aru/agents/__init__.py +0 -0
  11. {aru_code-0.19.0 → aru_code-0.19.1}/aru/agents/base.py +0 -0
  12. {aru_code-0.19.0 → aru_code-0.19.1}/aru/agents/executor.py +0 -0
  13. {aru_code-0.19.0 → aru_code-0.19.1}/aru/agents/planner.py +0 -0
  14. {aru_code-0.19.0 → aru_code-0.19.1}/aru/cache_patch.py +0 -0
  15. {aru_code-0.19.0 → aru_code-0.19.1}/aru/cli.py +0 -0
  16. {aru_code-0.19.0 → aru_code-0.19.1}/aru/commands.py +0 -0
  17. {aru_code-0.19.0 → aru_code-0.19.1}/aru/completers.py +0 -0
  18. {aru_code-0.19.0 → aru_code-0.19.1}/aru/config.py +0 -0
  19. {aru_code-0.19.0 → aru_code-0.19.1}/aru/display.py +0 -0
  20. {aru_code-0.19.0 → aru_code-0.19.1}/aru/history_blocks.py +0 -0
  21. {aru_code-0.19.0 → aru_code-0.19.1}/aru/permissions.py +0 -0
  22. {aru_code-0.19.0 → aru_code-0.19.1}/aru/providers.py +0 -0
  23. {aru_code-0.19.0 → aru_code-0.19.1}/aru/runner.py +0 -0
  24. {aru_code-0.19.0 → aru_code-0.19.1}/aru/runtime.py +0 -0
  25. {aru_code-0.19.0 → aru_code-0.19.1}/aru/session.py +0 -0
  26. {aru_code-0.19.0 → aru_code-0.19.1}/aru/tools/__init__.py +0 -0
  27. {aru_code-0.19.0 → aru_code-0.19.1}/aru/tools/ast_tools.py +0 -0
  28. {aru_code-0.19.0 → aru_code-0.19.1}/aru/tools/codebase.py +0 -0
  29. {aru_code-0.19.0 → aru_code-0.19.1}/aru/tools/gitignore.py +0 -0
  30. {aru_code-0.19.0 → aru_code-0.19.1}/aru/tools/mcp_client.py +0 -0
  31. {aru_code-0.19.0 → aru_code-0.19.1}/aru/tools/ranker.py +0 -0
  32. {aru_code-0.19.0 → aru_code-0.19.1}/aru/tools/tasklist.py +0 -0
  33. {aru_code-0.19.0 → aru_code-0.19.1}/aru_code.egg-info/SOURCES.txt +0 -0
  34. {aru_code-0.19.0 → aru_code-0.19.1}/aru_code.egg-info/dependency_links.txt +0 -0
  35. {aru_code-0.19.0 → aru_code-0.19.1}/aru_code.egg-info/entry_points.txt +0 -0
  36. {aru_code-0.19.0 → aru_code-0.19.1}/aru_code.egg-info/requires.txt +0 -0
  37. {aru_code-0.19.0 → aru_code-0.19.1}/aru_code.egg-info/top_level.txt +0 -0
  38. {aru_code-0.19.0 → aru_code-0.19.1}/setup.cfg +0 -0
  39. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_agents_base.py +0 -0
  40. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_cli.py +0 -0
  41. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_cli_advanced.py +0 -0
  42. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_cli_base.py +0 -0
  43. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_cli_completers.py +0 -0
  44. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_cli_new.py +0 -0
  45. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_cli_run_cli.py +0 -0
  46. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_cli_session.py +0 -0
  47. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_cli_shell.py +0 -0
  48. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_codebase.py +0 -0
  49. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_confabulation_regression.py +0 -0
  50. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_config.py +0 -0
  51. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_context.py +0 -0
  52. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_executor.py +0 -0
  53. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_gitignore.py +0 -0
  54. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_main.py +0 -0
  55. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_mcp_client.py +0 -0
  56. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_permissions.py +0 -0
  57. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_planner.py +0 -0
  58. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_providers.py +0 -0
  59. {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_ranker.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aru-code
3
- Version: 0.19.0
3
+ Version: 0.19.1
4
4
  Summary: A Claude Code clone built with Agno agents
5
5
  Author-email: Estevao <estevaofon@gmail.com>
6
6
  License-Expression: MIT
@@ -0,0 +1 @@
1
+ __version__ = "0.19.1"
@@ -47,6 +47,23 @@ TRUNCATE_MAX_LINE_LENGTH = 1500 # chars per individual line (prevents minified
47
47
  # Directory for saving full truncated outputs (like opencode pattern)
48
48
  TRUNCATE_SAVE_DIR = ".aru/truncated"
49
49
 
50
+ # Compaction: chars of recent conversation preserved verbatim post-compact.
51
+ #
52
+ # Separate from the prune protect window (160K) because they measure
53
+ # different things:
54
+ # - Prune protect: "how much tool_result content stays intact"
55
+ # - Compact recent: "how much full-message history stays verbatim after
56
+ # the summary replaces the older portion"
57
+ #
58
+ # Set to 80K chars (~20K tokens) — half the prune window. Rationale:
59
+ # with the compactor now running on the main model (not a small one),
60
+ # summaries are faithful enough that we don't need 40K of recent overlap
61
+ # as a safety net. 20K still covers 3-6 recent turns verbatim, which
62
+ # mirrors the "last few exchanges" a human would re-read to resume work.
63
+ # Going to zero would match opencode exactly but requires the reactive
64
+ # overflow replay flow we haven't implemented yet.
65
+ COMPACT_RECENT_CHARS = 80_000
66
+
50
67
  # Compaction: trigger when per-call input tokens approach real overflow.
51
68
  # Matches opencode's philosophy: only fire near the model's actual context
52
69
  # limit, not routinely. Routine context reduction is handled by prune_history
@@ -491,19 +508,29 @@ def would_prune(history: list[dict], model_id: str = "default") -> bool:
491
508
  def _split_history(history: list[dict], model_id: str = "default") -> tuple[list[dict], list[dict]]:
492
509
  """Split history into old (to summarize) and recent (to keep intact).
493
510
 
494
- Uses the same protection window as pruning. Defensively, the first
495
- user turn (index 0) is always pulled into `recent` so the original
496
- ask survives literal even through a full compaction the compactor
497
- extracts it into the `## Goal` section of the summary, but keeping
498
- it in recent too means the agent can quote it verbatim afterward.
511
+ Uses `COMPACT_RECENT_CHARS` (80K chars 20K tokens) as the "recent"
512
+ budget half of the prune protect window. Rationale: the compactor
513
+ now runs on the main model and produces high-fidelity summaries, so
514
+ we don't need 40K of recent overlap as a safety net. 20K covers 3-6
515
+ recent turns verbatim, which is enough to absorb the gap between
516
+ the last summarized state and the next turn.
517
+
518
+ Defensively, the first user turn (index 0) is always pulled into
519
+ `recent` so the original ask survives literal even through a full
520
+ compaction — the compactor extracts it into the `## Goal` section
521
+ of the summary, but keeping it in recent too means the agent can
522
+ quote it verbatim afterward.
523
+
524
+ The `model_id` parameter is retained for signature compatibility;
525
+ the recent budget is a flat value not scaled by model context.
499
526
  """
527
+ del model_id # unused — recent budget is flat across models
500
528
  from aru.history_blocks import item_char_len
501
- protect_chars = _get_prune_protect_chars(model_id)
502
529
  protected = 0
503
530
  split_idx = len(history)
504
531
  for i in range(len(history) - 1, -1, -1):
505
532
  msg_len = item_char_len(history[i])
506
- if protected + msg_len <= protect_chars:
533
+ if protected + msg_len <= COMPACT_RECENT_CHARS:
507
534
  protected += msg_len
508
535
  split_idx = i
509
536
  else:
@@ -617,10 +644,20 @@ async def compact_conversation(
617
644
  ) -> list[dict[str, str]]:
618
645
  """Run the compaction agent to summarize and replace history.
619
646
 
620
- Uses a small/fast model for the summarization to minimize cost.
621
- Falls back to simple truncation if the agent call fails.
647
+ Uses the **same model** as the main session (`model_ref`), not a
648
+ cheaper small model. Rationale:
649
+
650
+ - Compaction is rare (only on real overflow, ~0-2× per long session).
651
+ - The summary is the *only* persistent record of pre-window history.
652
+ - A weaker compactor risks dropping subtle decisions that the main
653
+ model would have caught — and once dropped, they cannot be recovered
654
+ mid-session.
655
+ - The marginal cost (Sonnet: ~$0.20-0.40 per session; Opus: a few
656
+ dollars) is justified by the fidelity gain on a non-recoverable
657
+ step.
658
+
659
+ Falls back to a mechanical summary if the agent call fails.
622
660
  """
623
- from aru.runtime import get_ctx
624
661
  from aru.providers import create_model
625
662
 
626
663
  prompt = build_compaction_prompt(history, plan_task, model_id=model_id)
@@ -628,16 +665,17 @@ async def compact_conversation(
628
665
  try:
629
666
  from agno.agent import Agent
630
667
 
631
- small_ref = get_ctx().small_model_ref
632
668
  compactor = Agent(
633
669
  name="Compactor",
634
- model=create_model(small_ref, max_tokens=4096),
670
+ model=create_model(model_ref, max_tokens=4096),
635
671
  instructions=(
636
672
  "You summarize coding conversations concisely. Output ONLY the requested sections, no preamble. "
637
673
  "Preserve: user goals, explicit instructions/preferences, file paths with line numbers, "
638
- "function/class names that were modified, what remains to be done, AND verbatim excerpts "
639
- "from any file contents shown in the conversation (signatures, critical constants, "
640
- "bug-related lines) under the '## File contents (key excerpts)' section. "
674
+ "function/class names that were modified, what remains to be done. "
675
+ "For the '## File contents (key excerpts)' section, use your judgment: "
676
+ "if a file was central to the work (being debugged, actively edited, or referenced "
677
+ "in a decision), include the critical lines verbatim; if a file was only briefly "
678
+ "read for context, just list the path. Do not mechanically copy everything. "
641
679
  "Drop: greetings, reasoning chains, redundant tool output, transient status messages."
642
680
  ),
643
681
  markdown=True,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aru-code
3
- Version: 0.19.0
3
+ Version: 0.19.1
4
4
  Summary: A Claude Code clone built with Agno agents
5
5
  Author-email: Estevao <estevaofon@gmail.com>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "aru-code"
7
- version = "0.19.0"
7
+ version = "0.19.1"
8
8
  description = "A Claude Code clone built with Agno agents"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -1 +0,0 @@
1
- __version__ = "0.19.0"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes