ene-agent 0.1.0__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 (87) hide show
  1. ene/__init__.py +5 -0
  2. ene/api.py +107 -0
  3. ene/backend/__init__.py +1716 -0
  4. ene/backend/batch.py +107 -0
  5. ene/backend/commands.py +806 -0
  6. ene/backend/sessions.py +578 -0
  7. ene/backend/skill_commands.py +191 -0
  8. ene/bundled_personas/chat/PERSONA.md +35 -0
  9. ene/bundled_personas/coder/PERSONA.md +38 -0
  10. ene/bundled_personas/orchestrator/PERSONA.md +284 -0
  11. ene/bundled_personas/reviewer/PERSONA.md +72 -0
  12. ene/bundled_skills/batch/SKILL.md +82 -0
  13. ene/bundled_skills/batch/tools.py +406 -0
  14. ene/bundled_skills/browser/SKILL.md +44 -0
  15. ene/bundled_skills/browser/tools.py +800 -0
  16. ene/bundled_skills/code-review/SKILL.md +46 -0
  17. ene/bundled_skills/lean/SKILL.md +49 -0
  18. ene/bundled_skills/library/SKILL.md +43 -0
  19. ene/bundled_skills/monitor/SKILL.md +57 -0
  20. ene/bundled_skills/pdf-reading/SKILL.md +61 -0
  21. ene/bundled_skills/pdf-reading/scripts/parse_pdf.py +195 -0
  22. ene/bundled_skills/persona-creator/SKILL.md +74 -0
  23. ene/bundled_skills/plan/SKILL.md +39 -0
  24. ene/bundled_skills/project-info/SKILL.md +43 -0
  25. ene/bundled_skills/skill-creator/SKILL.md +100 -0
  26. ene/bundled_skills/skill-creator/assets/SKILL.template.md +43 -0
  27. ene/bundled_skills/skill-creator/references/native-tools.md +70 -0
  28. ene/bundled_skills/skill-creator/references/skill-format.md +80 -0
  29. ene/bundled_skills/skill-creator/scripts/validate_skill.py +88 -0
  30. ene/bundled_skills/subagent/SKILL.md +116 -0
  31. ene/bundled_skills/subagent/scripts/run_subagent.py +83 -0
  32. ene/cli.py +543 -0
  33. ene/config.py +27 -0
  34. ene/context.py +1470 -0
  35. ene/frontend/dist/assets/index-RtdlPdeK.js +91 -0
  36. ene/frontend/dist/assets/index-qli6R3YA.css +1 -0
  37. ene/frontend/dist/favicon.svg +21 -0
  38. ene/frontend/dist/index.html +16 -0
  39. ene/hub.py +843 -0
  40. ene/hubclient.py +241 -0
  41. ene/library.py +674 -0
  42. ene/library_cli.py +206 -0
  43. ene/models.py +99 -0
  44. ene/personas.py +339 -0
  45. ene/providers/__init__.py +38 -0
  46. ene/providers/auth.py +127 -0
  47. ene/providers/openai_codex.py +581 -0
  48. ene/providers/openai_codex_oauth.py +384 -0
  49. ene/providers/openai_compatible.py +171 -0
  50. ene/providers/registry.py +41 -0
  51. ene/providers/types.py +118 -0
  52. ene/session_store.py +659 -0
  53. ene/skills.py +297 -0
  54. ene/terminal.py +817 -0
  55. ene/tools/__init__.py +78 -0
  56. ene/tools/builtin_descriptions.py +189 -0
  57. ene/tools/commands.py +262 -0
  58. ene/tools/constants.py +38 -0
  59. ene/tools/control.py +38 -0
  60. ene/tools/executor.py +153 -0
  61. ene/tools/files.py +466 -0
  62. ene/tools/formatting.py +247 -0
  63. ene/tools/process_manager.py +556 -0
  64. ene/tools/process_supervisor.py +116 -0
  65. ene/tools/process_util.py +210 -0
  66. ene/tools/registry.py +287 -0
  67. ene/tools/results.py +170 -0
  68. ene/tools/schemas.py +389 -0
  69. ene/tools/search.py +439 -0
  70. ene/tools/session.py +74 -0
  71. ene/tools/web.py +284 -0
  72. ene/ui.py +1443 -0
  73. ene/utils/__init__.py +5 -0
  74. ene/utils/frontmatter.py +34 -0
  75. ene/utils/interrupt.py +210 -0
  76. ene/utils/io.py +533 -0
  77. ene/utils/paths.py +19 -0
  78. ene/utils/persistence.py +97 -0
  79. ene/utils/rewind.py +177 -0
  80. ene/utils/storage.py +84 -0
  81. ene/utils/streaming.py +161 -0
  82. ene_agent-0.1.0.dist-info/METADATA +90 -0
  83. ene_agent-0.1.0.dist-info/RECORD +87 -0
  84. ene_agent-0.1.0.dist-info/WHEEL +5 -0
  85. ene_agent-0.1.0.dist-info/entry_points.txt +2 -0
  86. ene_agent-0.1.0.dist-info/licenses/LICENSE +21 -0
  87. ene_agent-0.1.0.dist-info/top_level.txt +1 -0
ene/__init__.py ADDED
@@ -0,0 +1,5 @@
1
+ """ene — terminal-based AI agent with tool-use, web access, and shell execution."""
2
+
3
+ from .api import AgentRunResult, TurnOutcome, run_agent
4
+
5
+ __all__ = ["AgentRunResult", "TurnOutcome", "run_agent"]
ene/api.py ADDED
@@ -0,0 +1,107 @@
1
+ """Public Python API for one-shot ene agent runs."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from contextlib import nullcontext
6
+ from dataclasses import dataclass
7
+ from pathlib import Path
8
+
9
+ from ene.config import CONFIG_PATH, conf
10
+ from ene.backend import LLMAgent
11
+ from ene.models import ReasoningEffort
12
+ from ene.providers import provider_names
13
+ from ene.ui import AgentConsole
14
+ from ene.utils.interrupt import TurnOutcome
15
+
16
+
17
+ @dataclass(frozen=True)
18
+ class AgentRunResult:
19
+ """Result of a completed :func:`run_agent` invocation."""
20
+
21
+ response: str | None
22
+ outcome: TurnOutcome
23
+ token_usage: dict[str, int]
24
+ error: str | None = None
25
+
26
+ @property
27
+ def success(self) -> bool:
28
+ return self.outcome == TurnOutcome.COMPLETED
29
+
30
+
31
+ def run_agent(
32
+ task: str,
33
+ *,
34
+ model_alias: str | None = None,
35
+ persona: str | None = None,
36
+ work_dir: str | Path | None = None,
37
+ reasoning_effort: ReasoningEffort | None = None,
38
+ stream: bool = False,
39
+ verbose: bool = False,
40
+ quiet: bool = True,
41
+ console: AgentConsole | None = None,
42
+ ) -> AgentRunResult:
43
+ """Run one independent, non-interactive agent task.
44
+
45
+ ``model_alias`` selects an entry under ``openai`` in the loaded ene
46
+ configuration; omitting it selects the first configured model. The run has
47
+ a fresh conversation, does not create an interactive session or rewind
48
+ history, and always releases provider, process, and skill resources before
49
+ returning.
50
+
51
+ Progress output is suppressed by default. Pass ``quiet=False`` to observe
52
+ normal output, optionally through a custom ``console``. Configuration and
53
+ construction errors are raised; provider failures and interruptions are
54
+ represented by ``AgentRunResult.outcome``.
55
+ """
56
+ if not isinstance(task, str) or not task.strip():
57
+ raise ValueError("task must be a non-empty string")
58
+
59
+ model_configs = conf.get("openai", {})
60
+ if not isinstance(model_configs, dict) or not model_configs:
61
+ raise ValueError(f"No models found in config: {CONFIG_PATH}")
62
+
63
+ alias = model_alias or next(iter(model_configs))
64
+ if alias not in model_configs:
65
+ available = ", ".join(model_configs)
66
+ raise ValueError(f"Model '{alias}' not found in config. Available: {available}")
67
+
68
+ model_conf = model_configs[alias]
69
+ provider_name = model_conf.get("provider", "openai")
70
+ if provider_name not in provider_names():
71
+ available = ", ".join(provider_names())
72
+ raise ValueError(f"Unknown provider '{provider_name}'. Available: {available}")
73
+
74
+ run_console = console or AgentConsole()
75
+ agent = LLMAgent(
76
+ model=model_conf.get("model", alias),
77
+ api_key=model_conf.get("api_key", ""),
78
+ base_url=model_conf.get("base_url", ""),
79
+ provider_name=provider_name,
80
+ model_alias=alias,
81
+ verbose=verbose,
82
+ stream=stream,
83
+ reasoning_effort=reasoning_effort
84
+ or model_conf.get("reasoning_effort", "high"),
85
+ context_length=model_conf.get("context_length"),
86
+ max_output_tokens=model_conf.get("max_output_tokens"),
87
+ persona=persona,
88
+ exec_mode=True,
89
+ work_dir=str(work_dir) if work_dir is not None else None,
90
+ console=run_console,
91
+ )
92
+
93
+ try:
94
+ output_context = run_console.suppressed() if quiet else nullcontext()
95
+ with output_context:
96
+ response = agent.execute(task)
97
+ return AgentRunResult(
98
+ response=response,
99
+ outcome=agent._last_turn_outcome,
100
+ token_usage=dict(agent.token_totals),
101
+ error=agent._last_error,
102
+ )
103
+ finally:
104
+ agent.close()
105
+
106
+
107
+ __all__ = ["AgentRunResult", "TurnOutcome", "run_agent"]