File size: 1,488 Bytes
287f3d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""Shared fixtures: hermetic settings, fake LLM provider, services."""

from __future__ import annotations

import pytest

from agentic_core.artifacts import ArtifactStore
from agentic_core.config import Settings
from agentic_core.llm import FakeLLMProvider, LLMService
from agentic_core.orchestrator import EventBus, ExecutionTracker, Orchestrator
from agentic_core.schemas import ProjectContext


@pytest.fixture
def settings(tmp_path):
    return Settings(llm_provider="cursor", cursor_api_key="test-key", data_dir=tmp_path)


@pytest.fixture
def provider():
    return FakeLLMProvider()


@pytest.fixture
def llm_service(provider, settings):
    return LLMService(provider, settings)


@pytest.fixture
def event_bus():
    return EventBus()


@pytest.fixture
def tracker(settings):
    return ExecutionTracker(settings.runs_dir)


@pytest.fixture
def artifact_store(settings):
    return ArtifactStore(settings.artifacts_dir)


@pytest.fixture
def make_orchestrator(provider, settings, event_bus, tracker):
    def _make(**overrides):
        current = settings.model_copy(update=overrides)
        service = LLMService(provider, current)
        return Orchestrator(service, event_bus, tracker, current)

    return _make


@pytest.fixture
def make_context():
    def _make(idea: str, project_id: str = "test_proj") -> ProjectContext:
        return ProjectContext(project_id=project_id, business_idea=idea)

    return _make