alpiecode 10.10.5__tar.gz → 10.10.6__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 (154) hide show
  1. {alpiecode-10.10.5 → alpiecode-10.10.6}/PKG-INFO +1 -1
  2. {alpiecode-10.10.5 → alpiecode-10.10.6}/pyproject.toml +1 -1
  3. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/alpiecode.egg-info/PKG-INFO +1 -1
  4. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/__init__.py +1 -1
  5. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/agent.py +6 -2
  6. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/grounding.py +4 -0
  7. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/local_model.py +4 -2
  8. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/media.py +35 -13
  9. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/orchestrator.py +1 -1
  10. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/vision.py +30 -0
  11. {alpiecode-10.10.5 → alpiecode-10.10.6}/README.md +0 -0
  12. {alpiecode-10.10.5 → alpiecode-10.10.6}/setup.cfg +0 -0
  13. {alpiecode-10.10.5 → alpiecode-10.10.6}/setup.py +0 -0
  14. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/alpiecode/__init__.py +0 -0
  15. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/alpiecode.egg-info/SOURCES.txt +0 -0
  16. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/alpiecode.egg-info/dependency_links.txt +0 -0
  17. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/alpiecode.egg-info/entry_points.txt +0 -0
  18. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/alpiecode.egg-info/requires.txt +0 -0
  19. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/alpiecode.egg-info/top_level.txt +0 -0
  20. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/__main__.py +0 -0
  21. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/assessment.py +0 -0
  22. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/backends/__init__.py +0 -0
  23. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/backends/base.py +0 -0
  24. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/backends/local_backend.py +0 -0
  25. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/backends/openai_backend.py +0 -0
  26. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/blueprints.py +0 -0
  27. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/cache.py +0 -0
  28. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/capabilities.py +0 -0
  29. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/chat_tags.py +0 -0
  30. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/cli.py +0 -0
  31. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/client.py +0 -0
  32. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/compaction.py +0 -0
  33. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/config.py +0 -0
  34. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/context.py +0 -0
  35. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/convergence.py +0 -0
  36. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/diff_preview.py +0 -0
  37. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/discovery.py +0 -0
  38. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/doctor.py +0 -0
  39. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/dream_rsi.py +0 -0
  40. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/evaluation.py +0 -0
  41. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/executor.py +0 -0
  42. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/git_ops.py +0 -0
  43. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/github.py +0 -0
  44. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/guardian.py +0 -0
  45. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/guardrails.py +0 -0
  46. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/ipython_ext.py +0 -0
  47. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/lifecycle.py +0 -0
  48. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/memory.py +0 -0
  49. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/metrics.py +0 -0
  50. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/onboarding.py +0 -0
  51. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/paths.py +0 -0
  52. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/progress.py +0 -0
  53. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/project_template.py +0 -0
  54. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/prompt.py +0 -0
  55. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/rephraser.py +0 -0
  56. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/server.py +0 -0
  57. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/session.py +0 -0
  58. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/accessibility-audit/SKILL.md +0 -0
  59. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/accessibility-testing/SKILL.md +0 -0
  60. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/accessibility-ui-components/SKILL.md +0 -0
  61. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/agentic-workflows/SKILL.md +0 -0
  62. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/api-design/SKILL.md +0 -0
  63. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/architecture-design/SKILL.md +0 -0
  64. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/backend-engineering/SKILL.md +0 -0
  65. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/browser-automation/SKILL.md +0 -0
  66. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/cli-development/SKILL.md +0 -0
  67. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/cloud-infrastructure/SKILL.md +0 -0
  68. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/code-generation/SKILL.md +0 -0
  69. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/code-review/SKILL.md +0 -0
  70. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/codebase-onboarding/SKILL.md +0 -0
  71. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/cost-optimization/SKILL.md +0 -0
  72. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/data-analysis/SKILL.md +0 -0
  73. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/data-engineering/SKILL.md +0 -0
  74. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/database-engineering/SKILL.md +0 -0
  75. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/dependency-management/SKILL.md +0 -0
  76. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/dependency-security/SKILL.md +0 -0
  77. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/dependency-upgrades/SKILL.md +0 -0
  78. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/devops-ci-cd/SKILL.md +0 -0
  79. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/docker-containers/SKILL.md +0 -0
  80. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/documentation/SKILL.md +0 -0
  81. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/documentation-site/SKILL.md +0 -0
  82. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/e2e-testing/SKILL.md +0 -0
  83. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/error-handling-resilience/SKILL.md +0 -0
  84. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/feature-development/SKILL.md +0 -0
  85. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/frontend-engineering/SKILL.md +0 -0
  86. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/git-workflow/SKILL.md +0 -0
  87. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/incident-response/SKILL.md +0 -0
  88. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/legacy-code-modernization/SKILL.md +0 -0
  89. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/llm-application-engineering/SKILL.md +0 -0
  90. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/localization-i18n/SKILL.md +0 -0
  91. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/mcp-server-development/SKILL.md +0 -0
  92. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/migration-engineering/SKILL.md +0 -0
  93. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/mobile-development/SKILL.md +0 -0
  94. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/model-evaluation/SKILL.md +0 -0
  95. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/nodejs-services/SKILL.md +0 -0
  96. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/observability/SKILL.md +0 -0
  97. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/performance-optimization/SKILL.md +0 -0
  98. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/privacy-data-protection/SKILL.md +0 -0
  99. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/prompt-engineering/SKILL.md +0 -0
  100. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/python-engineering/SKILL.md +0 -0
  101. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/rag-retrieval/SKILL.md +0 -0
  102. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/react-engineering/SKILL.md +0 -0
  103. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/release-management/SKILL.md +0 -0
  104. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/requirements-analysis/SKILL.md +0 -0
  105. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/responsive-design/SKILL.md +0 -0
  106. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/safe-refactoring/SKILL.md +0 -0
  107. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/secure-coding/SKILL.md +0 -0
  108. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/systematic-debugging/SKILL.md +0 -0
  109. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/technical-planning/SKILL.md +0 -0
  110. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/technical-research/SKILL.md +0 -0
  111. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/technical-writing/SKILL.md +0 -0
  112. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/test-engineering/SKILL.md +0 -0
  113. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/tool-integration/SKILL.md +0 -0
  114. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/typescript-engineering/SKILL.md +0 -0
  115. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/visual-regression-testing/SKILL.md +0 -0
  116. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/web-performance/SKILL.md +0 -0
  117. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/web-security-testing/SKILL.md +0 -0
  118. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills/workflow-automation/SKILL.md +0 -0
  119. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/skills.py +0 -0
  120. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/slash.py +0 -0
  121. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/subagent.py +0 -0
  122. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/system1.py +0 -0
  123. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/tools.py +0 -0
  124. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/updater.py +0 -0
  125. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/verifier.py +0 -0
  126. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/vscode_installer.py +0 -0
  127. {alpiecode-10.10.5 → alpiecode-10.10.6}/src/codeagent/walkthrough.py +0 -0
  128. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_adaptive_resilience.py +0 -0
  129. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_chat_tags_and_offline_multimodal.py +0 -0
  130. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_cli_ui.py +0 -0
  131. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_context_and_trajectory.py +0 -0
  132. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_deloop_and_sessions.py +0 -0
  133. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_dream_rsi.py +0 -0
  134. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_frontier_architecture.py +0 -0
  135. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_gpu_detection.py +0 -0
  136. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_lifecycle_and_portfolio.py +0 -0
  137. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_local_model_download.py +0 -0
  138. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_memory_optimization.py +0 -0
  139. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_non_thinking_and_local_stream.py +0 -0
  140. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_onboarding.py +0 -0
  141. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_project_templates.py +0 -0
  142. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_release_foundations.py +0 -0
  143. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_report_convergence.py +0 -0
  144. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_security_config.py +0 -0
  145. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_skills_engine.py +0 -0
  146. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_slash_and_diff.py +0 -0
  147. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_subagents.py +0 -0
  148. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_task_assessment.py +0 -0
  149. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_token_economy_and_256k.py +0 -0
  150. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_truncation_resilience.py +0 -0
  151. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_verifier.py +0 -0
  152. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_visual_grounding.py +0 -0
  153. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_walkthrough.py +0 -0
  154. {alpiecode-10.10.5 → alpiecode-10.10.6}/test/test_web_resilience_and_guardrails.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alpiecode
3
- Version: 10.10.5
3
+ Version: 10.10.6
4
4
  Summary: AlpieCode
5
5
  Requires-Python: >=3.9
6
6
  Requires-Dist: huggingface_hub>=0.20.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "alpiecode"
7
- version = "10.10.5"
7
+ version = "10.10.6"
8
8
  description = "AlpieCode"
9
9
  requires-python = ">=3.9"
10
10
  dependencies = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alpiecode
3
- Version: 10.10.5
3
+ Version: 10.10.6
4
4
  Summary: AlpieCode
5
5
  Requires-Python: >=3.9
6
6
  Requires-Dist: huggingface_hub>=0.20.0
@@ -17,7 +17,7 @@ Supports:
17
17
  from pathlib import Path
18
18
  from typing import Optional, Any, Dict
19
19
 
20
- __version__ = "10.10.5"
20
+ __version__ = "10.10.6"
21
21
 
22
22
  def run(task: str, workdir: str = ".", reasoning_level: str = "thinking", **kwargs):
23
23
  """Run an autonomous coding task programmatically."""
@@ -385,6 +385,7 @@ def run_agent(
385
385
  last_discovery = {}
386
386
  has_streamed_tokens = False
387
387
  has_printed_anything = False
388
+ last_displayed_message = ""
388
389
  task_success = True
389
390
  task_outcome = "success"
390
391
  task_failure_message = ""
@@ -659,6 +660,7 @@ def run_agent(
659
660
  has_streamed_tokens = False
660
661
  else:
661
662
  _print_assistant_message(event.data["content"])
663
+ last_displayed_message = event.data["content"].strip()
662
664
  has_printed_anything = True
663
665
  _checkpoint(workdir, "checkpoint: response")
664
666
 
@@ -808,7 +810,7 @@ def run_agent(
808
810
  sys.stdout.flush()
809
811
  has_streamed_tokens = False
810
812
  summary = event.data.get("summary", "")
811
- if summary:
813
+ if summary and summary.strip() != last_displayed_message:
812
814
  _print_assistant_message(summary)
813
815
  has_printed_anything = True
814
816
  _checkpoint(workdir, "checkpoint: done")
@@ -988,6 +990,7 @@ def run_chat(
988
990
 
989
991
  has_streamed_chat = False
990
992
  has_printed_chat = False
993
+ last_displayed_message = ""
991
994
  chat_status = CLIStatus(console, enabled=verbose)
992
995
  chat_status.start("Thinking...")
993
996
  try:
@@ -1074,6 +1077,7 @@ def run_chat(
1074
1077
  has_streamed_chat = False
1075
1078
  else:
1076
1079
  _print_assistant_message(event.data["content"])
1080
+ last_displayed_message = event.data["content"].strip()
1077
1081
  has_printed_chat = True
1078
1082
  _checkpoint(workdir, "checkpoint: done")
1079
1083
 
@@ -1111,7 +1115,7 @@ def run_chat(
1111
1115
  sys.stdout.write("\n")
1112
1116
  has_streamed_chat = False
1113
1117
  summary = event.data.get("summary", "")
1114
- if summary:
1118
+ if summary and summary.strip() != last_displayed_message:
1115
1119
  _print_assistant_message(summary)
1116
1120
  has_printed_chat = True
1117
1121
  break
@@ -23,6 +23,8 @@ def video_groups(content: Any) -> List[List[Dict[str, Any]]]:
23
23
  groups.append([part])
24
24
  elif groups and part.get("type") == "image_url":
25
25
  groups[-1].append(part)
26
+ elif groups and part.get("type") == "text" and part.get("text", "").strip().startswith("[Frame "):
27
+ groups[-1].append(part)
26
28
  return groups
27
29
 
28
30
 
@@ -54,6 +56,8 @@ def identify_videos(content: Any, backend: Any, task: str = "") -> List[VideoIde
54
56
  continue
55
57
  texts = []
56
58
  for image in group[1:]:
59
+ if image.get("type") != "image_url":
60
+ continue
57
61
  try:
58
62
  raw = base64.b64decode(image["image_url"]["url"].split("base64,", 1)[1], validate=True)
59
63
  texts.append(extract_image_text(raw))
@@ -677,7 +677,9 @@ class LocalModel:
677
677
  # In-Memory KV Prompt Prefix Caching for instant Turn 2+ speedup
678
678
  try:
679
679
  import llama_cpp
680
- if hasattr(llama_cpp, "LlamaRAMCache") and hasattr(self._llm, "set_cache"):
680
+ # The high-level cache is keyed by text token IDs, not image
681
+ # content. MTMD pre-fills image embeddings outside that history.
682
+ if vision_handler is None and hasattr(llama_cpp, "LlamaRAMCache") and hasattr(self._llm, "set_cache"):
681
683
  cache = llama_cpp.LlamaRAMCache(capacity_bytes=512 * 1024 * 1024)
682
684
  self._llm.set_cache(cache)
683
685
  except Exception:
@@ -808,7 +810,7 @@ class LocalModel:
808
810
  stream = kwargs.get("stream", False)
809
811
  params = {
810
812
  "messages": msgs,
811
- "temperature": 0.1 if not enable_thinking else temperature,
813
+ "temperature": min(0.1, temperature) if not enable_thinking else temperature,
812
814
  "max_tokens": max_tokens,
813
815
  "stream": stream,
814
816
  }
@@ -37,7 +37,7 @@ except ImportError:
37
37
  VIDEO_EXTENSIONS = {".mp4", ".avi", ".mov", ".mkv", ".webm", ".flv", ".wmv", ".m4v"}
38
38
  IMAGE_EXTENSIONS = {".png", ".jpg", ".jpeg", ".gif", ".webp", ".bmp", ".svg"}
39
39
  MAX_FRAMES = 8 # Max frames to extract from a video (balances context vs quality)
40
- FRAME_QUALITY = 85 # JPEG quality for extracted frames
40
+ FRAME_QUALITY = 2 # ffmpeg JPEG qscale (2 is high quality; not a percentage)
41
41
 
42
42
 
43
43
  # ── YouTube URL detection ─────────────────────────────────────────────
@@ -224,15 +224,15 @@ def extract_frames(video_path: str, max_frames: int = MAX_FRAMES) -> List[Tuple[
224
224
 
225
225
  with tempfile.TemporaryDirectory(prefix="alpiecode_frames_") as tmpdir:
226
226
  if duration and duration > 0:
227
- # Extract evenly-spaced frames across the video duration
228
- interval = duration / (max_frames + 1)
227
+ # Include the introduction: uniform interior samples previously
228
+ # skipped the first two minutes of a 16-minute review entirely.
229
+ timestamps = video_sample_times(duration, max_frames)
229
230
  frames = []
230
- for i in range(1, max_frames + 1):
231
- timestamp = interval * i
231
+ for i, timestamp in enumerate(timestamps, 1):
232
232
  out_path = os.path.join(tmpdir, f"frame_{i:03d}.jpg")
233
233
  subprocess.run(
234
234
  [ffmpeg_cmd, "-ss", f"{timestamp:.2f}", "-i", video_path,
235
- "-vframes", "1", "-q:v", str(FRAME_QUALITY // 10),
235
+ "-vframes", "1", "-q:v", str(FRAME_QUALITY),
236
236
  "-y", out_path],
237
237
  capture_output=True, timeout=30,
238
238
  )
@@ -243,6 +243,19 @@ def extract_frames(video_path: str, max_frames: int = MAX_FRAMES) -> List[Tuple[
243
243
  return _extract_frames_fallback(video_path, tmpdir, max_frames, ffmpeg_cmd)
244
244
 
245
245
 
246
+ def video_sample_times(duration: float, count: int) -> List[float]:
247
+ """Bounded still sampling, covering the introduction and the later timeline."""
248
+ if count < 1 or duration <= 0:
249
+ raise ValueError("Video duration and frame count must be positive")
250
+ if count < 3 or duration < 30:
251
+ return [duration * i / (count + 1) for i in range(1, count + 1)]
252
+ opening = min(10.0, duration * 0.1)
253
+ end = max(opening, duration - 1.0)
254
+ return [min(2.0, duration * 0.02), opening] + [
255
+ opening + (end - opening) * i / (count - 2) for i in range(1, count - 1)
256
+ ]
257
+
258
+
246
259
  def _extract_frames_fallback(video_path: str, tmpdir: str, max_frames: int, ffmpeg_cmd: str = None) -> List[Tuple[str, bytes]]:
247
260
  """Fallback: extract frames at 1 fps and pick evenly-spaced ones."""
248
261
  cmd = ffmpeg_cmd or _get_ffmpeg_cmd() or "ffmpeg"
@@ -267,12 +280,19 @@ def extract_image_text(image_bytes: bytes) -> str:
267
280
  """Return actual OCR output only; metadata and model guesses are not text evidence."""
268
281
  if shutil.which("tesseract"):
269
282
  try:
270
- result = subprocess.run(
271
- ["tesseract", "stdin", "stdout", "--oem", "1", "-l", "eng"],
272
- input=image_bytes, capture_output=True, timeout=10,
273
- )
274
- if result.returncode == 0:
275
- return result.stdout.decode("utf-8", errors="replace").strip()
283
+ # Automatic page segmentation often drops sparse badges/captions in
284
+ # photographs. Keep both document and sparse-text readings as evidence.
285
+ readings = []
286
+ for mode in (3, 11):
287
+ result = subprocess.run(
288
+ ["tesseract", "stdin", "stdout", "--oem", "1", "--psm", str(mode), "-l", "eng"],
289
+ input=image_bytes, capture_output=True, timeout=10,
290
+ )
291
+ if result.returncode == 0:
292
+ text = result.stdout.decode("utf-8", errors="replace").strip()
293
+ if text and text not in readings:
294
+ readings.append(text)
295
+ return "\n".join(readings)
276
296
  except (OSError, subprocess.TimeoutExpired):
277
297
  pass
278
298
  return ""
@@ -475,6 +495,7 @@ def build_media_content(
475
495
  )
476
496
  content.append({"type": "text", "text": header})
477
497
  for i, (mime, raw_bytes) in enumerate(frames):
498
+ content.append({"type": "text", "text": f"\n[Frame {i + 1}/{len(frames)}]\n"})
478
499
  b64 = base64.b64encode(raw_bytes).decode("utf-8")
479
500
  content.append({
480
501
  "type": "image_url",
@@ -499,7 +520,8 @@ def build_media_content(
499
520
  content.append({"type": "text", "text":
500
521
  "Video coverage: sampled still frames only; no audio or transcript was extracted. "
501
522
  "Do not claim full-video or spoken-review analysis."})
502
- for mime, raw_bytes in frames:
523
+ for i, (mime, raw_bytes) in enumerate(frames):
524
+ content.append({"type": "text", "text": f"\n[Frame {i + 1}/{len(frames)}]\n"})
503
525
  b64 = base64.b64encode(raw_bytes).decode("utf-8")
504
526
  content.append({
505
527
  "type": "image_url",
@@ -591,7 +591,7 @@ class AgentOrchestrator:
591
591
  "I could not reliably identify all models from the sampled video frames, so I cannot give a grounded buying recommendation.\n\n"
592
592
  + "\n".join(f"- {item.label}: {item.subject or 'unconfirmed'} — {item.evidence}" for item in identities)
593
593
  + "\n\nPlease provide the exact names as 'Video 1: model', 'Video 2: model', 'Video 3: model', or clear model badge/title frames. "
594
- "Only sampled still frames were available; audio and the full review were not analyzed."
594
+ + "Only sampled still frames were available; audio and the full review were not analyzed."
595
595
  + (" Current prices and independent sources cannot be checked offline." if is_offline else "")
596
596
  )
597
597
  session.context.add_user_message(task)
@@ -94,6 +94,36 @@ def create_vision_handler(model_path: Path, projectors: List[Path], formats: Any
94
94
  enable_thinking = True
95
95
  _alpie_native_template = True
96
96
 
97
+ def _init_mtmd_context(self, llama_model: Any) -> None:
98
+ super()._init_mtmd_context(llama_model)
99
+ # MTMD has a separate logger: verbose=False alone does not stop
100
+ # its native debug output from printing the entire user prompt.
101
+ # Share llama-cpp-python's verbosity filter; errors remain visible.
102
+ from llama_cpp._logger import llama_log_callback
103
+ self._mtmd_cpp.mtmd_helper_log_set(llama_log_callback, None)
104
+
105
+ def _get_template_messages(self, messages: List[Dict[str, Any]], media_marker: str) -> List[Any]:
106
+ separated = []
107
+ for message in messages:
108
+ content = message.get("content")
109
+ if isinstance(content, list):
110
+ parts = []
111
+ previous_image = False
112
+ image_number = 0
113
+ for part in content:
114
+ is_image = isinstance(part, dict) and part.get("type") == "image_url"
115
+ if is_image:
116
+ image_number += 1
117
+ if previous_image:
118
+ parts.append({"type": "text", "text": f"\n[Image {image_number}]\n"})
119
+ parts.append(part)
120
+ previous_image = is_image
121
+ message = {**message, "content": parts}
122
+ separated.append(message)
123
+ # Adjacent markers otherwise merge unrelated images into temporal
124
+ # super-frames in MTMD. Preserve each sampled still independently.
125
+ return super()._get_template_messages(separated, media_marker)
126
+
97
127
  def __call__(self, **kwargs: Any) -> Any:
98
128
  # Llama.create_chat_completion has no template-kwargs parameter.
99
129
  # MTMD accepts these kwargs and passes them into the model template.
File without changes
File without changes
File without changes