empathy-framework 4.6.2__py3-none-any.whl → 4.6.3__py3-none-any.whl

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 (53) hide show
  1. {empathy_framework-4.6.2.dist-info → empathy_framework-4.6.3.dist-info}/METADATA +1 -1
  2. {empathy_framework-4.6.2.dist-info → empathy_framework-4.6.3.dist-info}/RECORD +53 -20
  3. {empathy_framework-4.6.2.dist-info → empathy_framework-4.6.3.dist-info}/WHEEL +1 -1
  4. empathy_os/__init__.py +1 -1
  5. empathy_os/cli.py +361 -32
  6. empathy_os/config/xml_config.py +8 -3
  7. empathy_os/core.py +37 -4
  8. empathy_os/leverage_points.py +2 -1
  9. empathy_os/memory/short_term.py +45 -1
  10. empathy_os/meta_workflows/agent_creator 2.py +254 -0
  11. empathy_os/meta_workflows/builtin_templates 2.py +567 -0
  12. empathy_os/meta_workflows/cli_meta_workflows 2.py +1551 -0
  13. empathy_os/meta_workflows/form_engine 2.py +304 -0
  14. empathy_os/meta_workflows/intent_detector 2.py +298 -0
  15. empathy_os/meta_workflows/pattern_learner 2.py +754 -0
  16. empathy_os/meta_workflows/session_context 2.py +398 -0
  17. empathy_os/meta_workflows/template_registry 2.py +229 -0
  18. empathy_os/meta_workflows/workflow 2.py +980 -0
  19. empathy_os/models/token_estimator.py +16 -9
  20. empathy_os/models/validation.py +7 -1
  21. empathy_os/orchestration/pattern_learner 2.py +699 -0
  22. empathy_os/orchestration/real_tools 2.py +938 -0
  23. empathy_os/orchestration/real_tools.py +4 -2
  24. empathy_os/socratic/__init__ 2.py +273 -0
  25. empathy_os/socratic/ab_testing 2.py +969 -0
  26. empathy_os/socratic/blueprint 2.py +532 -0
  27. empathy_os/socratic/cli 2.py +689 -0
  28. empathy_os/socratic/collaboration 2.py +1112 -0
  29. empathy_os/socratic/domain_templates 2.py +916 -0
  30. empathy_os/socratic/embeddings 2.py +734 -0
  31. empathy_os/socratic/engine 2.py +729 -0
  32. empathy_os/socratic/explainer 2.py +663 -0
  33. empathy_os/socratic/feedback 2.py +767 -0
  34. empathy_os/socratic/forms 2.py +624 -0
  35. empathy_os/socratic/generator 2.py +716 -0
  36. empathy_os/socratic/llm_analyzer 2.py +635 -0
  37. empathy_os/socratic/mcp_server 2.py +751 -0
  38. empathy_os/socratic/session 2.py +306 -0
  39. empathy_os/socratic/storage 2.py +635 -0
  40. empathy_os/socratic/storage.py +2 -1
  41. empathy_os/socratic/success 2.py +719 -0
  42. empathy_os/socratic/visual_editor 2.py +812 -0
  43. empathy_os/socratic/web_ui 2.py +925 -0
  44. empathy_os/tier_recommender.py +5 -2
  45. empathy_os/workflow_commands.py +11 -6
  46. empathy_os/workflows/base.py +1 -1
  47. empathy_os/workflows/batch_processing 2.py +310 -0
  48. empathy_os/workflows/release_prep_crew 2.py +968 -0
  49. empathy_os/workflows/test_coverage_boost_crew 2.py +848 -0
  50. empathy_os/workflows/test_maintenance.py +3 -2
  51. {empathy_framework-4.6.2.dist-info → empathy_framework-4.6.3.dist-info}/entry_points.txt +0 -0
  52. {empathy_framework-4.6.2.dist-info → empathy_framework-4.6.3.dist-info}/licenses/LICENSE +0 -0
  53. {empathy_framework-4.6.2.dist-info → empathy_framework-4.6.3.dist-info}/top_level.txt +0 -0
@@ -12,6 +12,8 @@ from __future__ import annotations
12
12
  import functools
13
13
  from typing import Any
14
14
 
15
+ from empathy_os.config import _validate_file_path
16
+
15
17
  # Try to import tiktoken, fall back to heuristic if not available
16
18
  try:
17
19
  import tiktoken
@@ -192,24 +194,28 @@ def estimate_workflow_cost(
192
194
  try:
193
195
  import os
194
196
 
195
- if os.path.isfile(target_path):
196
- with open(target_path, encoding="utf-8", errors="ignore") as f:
197
+ # Validate path to prevent path traversal attacks
198
+ validated_target = _validate_file_path(target_path)
199
+
200
+ if os.path.isfile(validated_target):
201
+ with open(validated_target, encoding="utf-8", errors="ignore") as f:
197
202
  file_content = f.read()
198
203
  input_tokens += estimate_tokens(file_content)
199
- elif os.path.isdir(target_path):
204
+ elif os.path.isdir(validated_target):
200
205
  # Estimate based on directory size (rough heuristic)
201
206
  total_chars = 0
202
- for root, _, files in os.walk(target_path):
207
+ for root, _, files in os.walk(validated_target):
203
208
  for file in files[:50]: # Limit to first 50 files
204
209
  if file.endswith((".py", ".js", ".ts", ".tsx", ".jsx")):
205
210
  try:
206
211
  filepath = os.path.join(root, file)
207
- with open(filepath, encoding="utf-8", errors="ignore") as f:
212
+ validated_filepath = _validate_file_path(filepath)
213
+ with open(validated_filepath, encoding="utf-8", errors="ignore") as f:
208
214
  total_chars += len(f.read())
209
- except Exception:
215
+ except (ValueError, OSError):
210
216
  pass
211
217
  input_tokens += int(total_chars * TOKENS_PER_CHAR_HEURISTIC)
212
- except Exception:
218
+ except (ValueError, OSError):
213
219
  pass # Keep original estimate
214
220
 
215
221
  # Output multipliers by stage type
@@ -387,9 +393,10 @@ if __name__ == "__main__":
387
393
  input_text = ""
388
394
  if args.input:
389
395
  try:
390
- with open(args.input) as f:
396
+ validated_input = _validate_file_path(args.input)
397
+ with open(validated_input) as f:
391
398
  input_text = f.read()
392
- except FileNotFoundError:
399
+ except (FileNotFoundError, ValueError):
393
400
  input_text = args.input
394
401
 
395
402
  result = estimate_workflow_cost(
@@ -13,6 +13,8 @@ Licensed under Fair Source License 0.9
13
13
  from dataclasses import dataclass, field
14
14
  from typing import Any
15
15
 
16
+ from empathy_os.config import _validate_file_path
17
+
16
18
  from .registry import MODEL_REGISTRY, ModelTier
17
19
 
18
20
 
@@ -258,11 +260,15 @@ def validate_yaml_file(file_path: str) -> ValidationResult:
258
260
  result = ValidationResult(valid=True)
259
261
 
260
262
  try:
261
- with open(file_path) as f:
263
+ validated_path = _validate_file_path(str(file_path))
264
+ with open(validated_path) as f:
262
265
  config = yaml.safe_load(f)
263
266
  except FileNotFoundError:
264
267
  result.add_error("file", f"File not found: {file_path}")
265
268
  return result
269
+ except ValueError as e:
270
+ result.add_error("file", f"Invalid file path: {e}")
271
+ return result
266
272
  except yaml.YAMLError as e:
267
273
  result.add_error("yaml", f"Invalid YAML: {e}")
268
274
  return result