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.
- {aru_code-0.19.0/aru_code.egg-info → aru_code-0.19.1}/PKG-INFO +1 -1
- aru_code-0.19.1/aru/__init__.py +1 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/context.py +53 -15
- {aru_code-0.19.0 → aru_code-0.19.1/aru_code.egg-info}/PKG-INFO +1 -1
- {aru_code-0.19.0 → aru_code-0.19.1}/pyproject.toml +1 -1
- aru_code-0.19.0/aru/__init__.py +0 -1
- {aru_code-0.19.0 → aru_code-0.19.1}/LICENSE +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/README.md +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/agent_factory.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/agents/__init__.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/agents/base.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/agents/executor.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/agents/planner.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/cache_patch.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/cli.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/commands.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/completers.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/config.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/display.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/history_blocks.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/permissions.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/providers.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/runner.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/runtime.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/session.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/tools/__init__.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/tools/ast_tools.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/tools/codebase.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/tools/gitignore.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/tools/mcp_client.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/tools/ranker.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru/tools/tasklist.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru_code.egg-info/SOURCES.txt +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru_code.egg-info/dependency_links.txt +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru_code.egg-info/entry_points.txt +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru_code.egg-info/requires.txt +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/aru_code.egg-info/top_level.txt +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/setup.cfg +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_agents_base.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_cli.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_cli_advanced.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_cli_base.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_cli_completers.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_cli_new.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_cli_run_cli.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_cli_session.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_cli_shell.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_codebase.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_confabulation_regression.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_config.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_context.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_executor.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_gitignore.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_main.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_mcp_client.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_permissions.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_planner.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_providers.py +0 -0
- {aru_code-0.19.0 → aru_code-0.19.1}/tests/test_ranker.py +0 -0
|
@@ -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
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
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 <=
|
|
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
|
|
621
|
-
|
|
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(
|
|
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
|
|
639
|
-
"
|
|
640
|
-
"
|
|
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,
|
aru_code-0.19.0/aru/__init__.py
DELETED
|
@@ -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
|
|
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
|
|
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
|