chore(plan): marca Phase A (Tasks 1-5) completada
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -31,7 +31,7 @@
|
|||||||
- Create: `dashboard/requirements.txt`
|
- Create: `dashboard/requirements.txt`
|
||||||
- Create directorios: `core/src/agentforge_core/{api,domain,registry,llm,guardrails,runtime,observability}`, `dashboard/src/agentforge_dashboard/{pages,components}`, `agents/incident_analyzer/{versions,examples}`, `policies/default/versions`, `data/`, `tests/{unit,integration,fixtures}`
|
- Create directorios: `core/src/agentforge_core/{api,domain,registry,llm,guardrails,runtime,observability}`, `dashboard/src/agentforge_dashboard/{pages,components}`, `agents/incident_analyzer/{versions,examples}`, `policies/default/versions`, `data/`, `tests/{unit,integration,fixtures}`
|
||||||
|
|
||||||
- [ ] **Step 1: Crear estructura de directorios y `__init__.py`**
|
- [x] **Step 1: Crear estructura de directorios y `__init__.py`**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd /home/juan/Work/agentforge
|
cd /home/juan/Work/agentforge
|
||||||
@@ -51,7 +51,7 @@ touch dashboard/src/agentforge_dashboard/components/__init__.py
|
|||||||
touch tests/__init__.py tests/unit/__init__.py tests/integration/__init__.py
|
touch tests/__init__.py tests/unit/__init__.py tests/integration/__init__.py
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 2: Crear `pyproject.toml`**
|
- [x] **Step 2: Crear `pyproject.toml`**
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[build-system]
|
[build-system]
|
||||||
@@ -98,7 +98,7 @@ markers = [
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 3: Crear `core/requirements.txt`**
|
- [x] **Step 3: Crear `core/requirements.txt`**
|
||||||
|
|
||||||
```
|
```
|
||||||
fastapi>=0.115,<0.120
|
fastapi>=0.115,<0.120
|
||||||
@@ -117,7 +117,7 @@ PyYAML>=6.0,<7.0
|
|||||||
nemoguardrails>=0.10,<0.12
|
nemoguardrails>=0.10,<0.12
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 4: Crear `dashboard/requirements.txt`**
|
- [x] **Step 4: Crear `dashboard/requirements.txt`**
|
||||||
|
|
||||||
```
|
```
|
||||||
streamlit>=1.38,<2.0
|
streamlit>=1.38,<2.0
|
||||||
@@ -126,7 +126,7 @@ pydantic>=2.7,<3.0
|
|||||||
PyYAML>=6.0,<7.0
|
PyYAML>=6.0,<7.0
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 5: Crear `.env.example`**
|
- [x] **Step 5: Crear `.env.example`**
|
||||||
|
|
||||||
```
|
```
|
||||||
# Proveedor LLM activo. Valores: mock | azure | openai
|
# Proveedor LLM activo. Valores: mock | azure | openai
|
||||||
@@ -158,7 +158,7 @@ DATA_DIR=./data
|
|||||||
AGENTFORGE_CORE_URL=http://core:8000
|
AGENTFORGE_CORE_URL=http://core:8000
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 6: Crear `Makefile`**
|
- [x] **Step 6: Crear `Makefile`**
|
||||||
|
|
||||||
```makefile
|
```makefile
|
||||||
.PHONY: help install lint format test smoke up down logs clean
|
.PHONY: help install lint format test smoke up down logs clean
|
||||||
@@ -203,7 +203,7 @@ clean:
|
|||||||
rm -rf .pytest_cache .mypy_cache .ruff_cache __pycache__ data/*.sqlite data/*.jsonl
|
rm -rf .pytest_cache .mypy_cache .ruff_cache __pycache__ data/*.sqlite data/*.jsonl
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 7: Verificar instalación local mínima**
|
- [x] **Step 7: Verificar instalación local mínima**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd /home/juan/Work/agentforge
|
cd /home/juan/Work/agentforge
|
||||||
@@ -215,7 +215,7 @@ ruff check core/src
|
|||||||
|
|
||||||
Expected: `All checks passed!` (no hay código aún; debe pasar).
|
Expected: `All checks passed!` (no hay código aún; debe pasar).
|
||||||
|
|
||||||
- [ ] **Step 8: Commit**
|
- [x] **Step 8: Commit**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git add -A
|
git add -A
|
||||||
@@ -230,7 +230,7 @@ git commit -m "chore: scaffolding inicial del repo (pyproject, requirements, Mak
|
|||||||
- Create: `core/src/agentforge_core/domain/agent.py`
|
- Create: `core/src/agentforge_core/domain/agent.py`
|
||||||
- Create: `tests/unit/test_domain_agent.py`
|
- Create: `tests/unit/test_domain_agent.py`
|
||||||
|
|
||||||
- [ ] **Step 1: Escribir test fallido**
|
- [x] **Step 1: Escribir test fallido**
|
||||||
|
|
||||||
Create `tests/unit/test_domain_agent.py`:
|
Create `tests/unit/test_domain_agent.py`:
|
||||||
```python
|
```python
|
||||||
@@ -305,14 +305,14 @@ def test_agent_definition_rechaza_state_invalido() -> None:
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 2: Verificar que falla**
|
- [x] **Step 2: Verificar que falla**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pytest tests/unit/test_domain_agent.py -v
|
pytest tests/unit/test_domain_agent.py -v
|
||||||
```
|
```
|
||||||
Expected: 5 ERRORS — `ModuleNotFoundError: No module named 'agentforge_core.domain.agent'`.
|
Expected: 5 ERRORS — `ModuleNotFoundError: No module named 'agentforge_core.domain.agent'`.
|
||||||
|
|
||||||
- [ ] **Step 3: Implementar `agent.py`**
|
- [x] **Step 3: Implementar `agent.py`**
|
||||||
|
|
||||||
Create `core/src/agentforge_core/domain/agent.py`:
|
Create `core/src/agentforge_core/domain/agent.py`:
|
||||||
```python
|
```python
|
||||||
@@ -360,14 +360,14 @@ class AgentDefinition(BaseModel):
|
|||||||
updated_at: datetime
|
updated_at: datetime
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 4: Verificar que pasan**
|
- [x] **Step 4: Verificar que pasan**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pytest tests/unit/test_domain_agent.py -v
|
pytest tests/unit/test_domain_agent.py -v
|
||||||
```
|
```
|
||||||
Expected: 5 PASSED.
|
Expected: 5 PASSED.
|
||||||
|
|
||||||
- [ ] **Step 5: Commit**
|
- [x] **Step 5: Commit**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git add core/src/agentforge_core/domain/agent.py tests/unit/test_domain_agent.py
|
git add core/src/agentforge_core/domain/agent.py tests/unit/test_domain_agent.py
|
||||||
@@ -386,7 +386,7 @@ git commit -m "feat(domain): añade modelo AgentDefinition + LLMConfig + AgentVe
|
|||||||
- Create: `tests/unit/test_domain_guardrail.py`
|
- Create: `tests/unit/test_domain_guardrail.py`
|
||||||
- Create: `tests/unit/test_domain_policy.py`
|
- Create: `tests/unit/test_domain_policy.py`
|
||||||
|
|
||||||
- [ ] **Step 1: Test para `guardrail.py`**
|
- [x] **Step 1: Test para `guardrail.py`**
|
||||||
|
|
||||||
Create `tests/unit/test_domain_guardrail.py`:
|
Create `tests/unit/test_domain_guardrail.py`:
|
||||||
```python
|
```python
|
||||||
@@ -426,7 +426,7 @@ def test_guardrail_violation_rechaza_severity_invalido() -> None:
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 2: Test para `policy.py`**
|
- [x] **Step 2: Test para `policy.py`**
|
||||||
|
|
||||||
Create `tests/unit/test_domain_policy.py`:
|
Create `tests/unit/test_domain_policy.py`:
|
||||||
```python
|
```python
|
||||||
@@ -445,7 +445,7 @@ def test_policy_definition_default_fail_closed() -> None:
|
|||||||
assert p.on_validator_error == "fail_closed"
|
assert p.on_validator_error == "fail_closed"
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 3: Test para `execution.py`**
|
- [x] **Step 3: Test para `execution.py`**
|
||||||
|
|
||||||
Create `tests/unit/test_domain_execution.py`:
|
Create `tests/unit/test_domain_execution.py`:
|
||||||
```python
|
```python
|
||||||
@@ -515,14 +515,14 @@ def test_agent_execution_summary_no_incluye_decision_path() -> None:
|
|||||||
assert "decision_path" not in s.model_dump()
|
assert "decision_path" not in s.model_dump()
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 4: Verificar fallos**
|
- [x] **Step 4: Verificar fallos**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pytest tests/unit/test_domain_guardrail.py tests/unit/test_domain_policy.py tests/unit/test_domain_execution.py -v
|
pytest tests/unit/test_domain_guardrail.py tests/unit/test_domain_policy.py tests/unit/test_domain_execution.py -v
|
||||||
```
|
```
|
||||||
Expected: ERRORS por imports.
|
Expected: ERRORS por imports.
|
||||||
|
|
||||||
- [ ] **Step 5: Implementar `guardrail.py`**
|
- [x] **Step 5: Implementar `guardrail.py`**
|
||||||
|
|
||||||
```python
|
```python
|
||||||
"""Modelos de dominio de guardrails."""
|
"""Modelos de dominio de guardrails."""
|
||||||
@@ -547,7 +547,7 @@ class GuardrailViolation(BaseModel):
|
|||||||
blocked: bool
|
blocked: bool
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 6: Implementar `policy.py`**
|
- [x] **Step 6: Implementar `policy.py`**
|
||||||
|
|
||||||
```python
|
```python
|
||||||
"""Modelos de políticas de guardrails."""
|
"""Modelos de políticas de guardrails."""
|
||||||
@@ -585,7 +585,7 @@ class PolicyDefinition(BaseModel):
|
|||||||
on_validator_error: Literal["fail_open", "fail_closed"] = "fail_closed"
|
on_validator_error: Literal["fail_open", "fail_closed"] = "fail_closed"
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 7: Implementar `execution.py`**
|
- [x] **Step 7: Implementar `execution.py`**
|
||||||
|
|
||||||
```python
|
```python
|
||||||
"""Modelos de ejecución del agente: estado, traza, acciones propuestas."""
|
"""Modelos de ejecución del agente: estado, traza, acciones propuestas."""
|
||||||
@@ -659,14 +659,14 @@ class AgentExecutionSummary(BaseModel):
|
|||||||
n_proposed_actions: int
|
n_proposed_actions: int
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 8: Verificar que pasan**
|
- [x] **Step 8: Verificar que pasan**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pytest tests/unit/test_domain_guardrail.py tests/unit/test_domain_policy.py tests/unit/test_domain_execution.py -v
|
pytest tests/unit/test_domain_guardrail.py tests/unit/test_domain_policy.py tests/unit/test_domain_execution.py -v
|
||||||
```
|
```
|
||||||
Expected: todos PASSED.
|
Expected: todos PASSED.
|
||||||
|
|
||||||
- [ ] **Step 9: Commit**
|
- [x] **Step 9: Commit**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git add core/src/agentforge_core/domain/ tests/unit/test_domain_*.py
|
git add core/src/agentforge_core/domain/ tests/unit/test_domain_*.py
|
||||||
@@ -681,7 +681,7 @@ git commit -m "feat(domain): añade modelos GuardrailViolation, PolicyDefinition
|
|||||||
- Create: `core/src/agentforge_core/config.py`
|
- Create: `core/src/agentforge_core/config.py`
|
||||||
- Create: `tests/unit/test_config.py`
|
- Create: `tests/unit/test_config.py`
|
||||||
|
|
||||||
- [ ] **Step 1: Test fallido**
|
- [x] **Step 1: Test fallido**
|
||||||
|
|
||||||
Create `tests/unit/test_config.py`:
|
Create `tests/unit/test_config.py`:
|
||||||
```python
|
```python
|
||||||
@@ -707,14 +707,14 @@ def test_settings_data_dir_se_resuelve() -> None:
|
|||||||
assert s.data_dir == Path("/tmp/agentforge-test")
|
assert s.data_dir == Path("/tmp/agentforge-test")
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 2: Verificar fallo**
|
- [x] **Step 2: Verificar fallo**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pytest tests/unit/test_config.py -v
|
pytest tests/unit/test_config.py -v
|
||||||
```
|
```
|
||||||
Expected: ERROR import.
|
Expected: ERROR import.
|
||||||
|
|
||||||
- [ ] **Step 3: Implementar**
|
- [x] **Step 3: Implementar**
|
||||||
|
|
||||||
```python
|
```python
|
||||||
"""Configuración global del core. Se carga desde variables de entorno (.env)."""
|
"""Configuración global del core. Se carga desde variables de entorno (.env)."""
|
||||||
@@ -768,13 +768,13 @@ def get_settings() -> Settings:
|
|||||||
return Settings()
|
return Settings()
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 4: Verificar PASSED**
|
- [x] **Step 4: Verificar PASSED**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pytest tests/unit/test_config.py -v
|
pytest tests/unit/test_config.py -v
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 5: Commit**
|
- [x] **Step 5: Commit**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git add core/src/agentforge_core/config.py tests/unit/test_config.py
|
git add core/src/agentforge_core/config.py tests/unit/test_config.py
|
||||||
@@ -789,7 +789,7 @@ git commit -m "feat(config): añade Settings con Pydantic Settings y .env loadin
|
|||||||
- Create: `core/src/agentforge_core/observability/logging.py`
|
- Create: `core/src/agentforge_core/observability/logging.py`
|
||||||
- Create: `tests/unit/test_logging.py`
|
- Create: `tests/unit/test_logging.py`
|
||||||
|
|
||||||
- [ ] **Step 1: Test**
|
- [x] **Step 1: Test**
|
||||||
|
|
||||||
```python
|
```python
|
||||||
"""Tests de logging estructurado."""
|
"""Tests de logging estructurado."""
|
||||||
@@ -823,7 +823,7 @@ def test_bind_trace_id_aparece_en_logs(capsys) -> None: # type: ignore[no-untyp
|
|||||||
assert parsed["trace_id"] == "trace-abc-123"
|
assert parsed["trace_id"] == "trace-abc-123"
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 2: Implementar**
|
- [x] **Step 2: Implementar**
|
||||||
|
|
||||||
```python
|
```python
|
||||||
"""Configuración de logging estructurado JSON con propagación de trace_id."""
|
"""Configuración de logging estructurado JSON con propagación de trace_id."""
|
||||||
@@ -870,7 +870,7 @@ def clear_trace_id() -> None:
|
|||||||
clear_contextvars()
|
clear_contextvars()
|
||||||
```
|
```
|
||||||
|
|
||||||
- [ ] **Step 3: Verificar y commit**
|
- [x] **Step 3: Verificar y commit**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pytest tests/unit/test_logging.py -v
|
pytest tests/unit/test_logging.py -v
|
||||||
|
|||||||
Reference in New Issue
Block a user