Coevolution workplan extension

This commit is contained in:
2026-04-29 00:40:02 +02:00
parent c070951c68
commit 31dd6259b5
8 changed files with 200 additions and 6 deletions

View File

@@ -121,6 +121,8 @@ class RegistryService:
*,
source_path: str | None = None,
use_cached_checkout: bool = False,
use_llm_assistance: bool = True,
trusted_auto_approve: bool = False,
access_username: str | None = None,
access_password: str | None = None,
) -> ScanSummary:
@@ -187,6 +189,7 @@ class RegistryService:
repository,
facts,
stored_chunks,
use_llm_assistance=use_llm_assistance,
)
except Exception as exc:
log_operation(
@@ -221,6 +224,16 @@ class RegistryService:
action="llm_extraction_used",
notes=f"Generated {len(candidates)} candidate ability draft(s).",
)
if trusted_auto_approve:
self.approve_candidate_graph(
repository_id,
completed_run.id,
notes=(
"Trusted auto-populate mode approved candidate graph "
f"after {candidate_source} candidate generation."
),
action="trusted_auto_approve_candidate_graph",
)
log_operation(
"analysis_completed",
repository_id=repository_id,
@@ -241,8 +254,10 @@ class RegistryService:
repository: Repository,
facts: list[ObservedFact],
chunks: list[ContentChunk],
*,
use_llm_assistance: bool = True,
):
if self.llm_extractor is not None:
if use_llm_assistance and self.llm_extractor is not None:
extracted = self.llm_extractor.extract(repository, chunks)
if extracted:
return self.llm_mapper.map(extracted, facts, chunks), "llm"
@@ -290,6 +305,7 @@ class RegistryService:
analysis_run_id: int,
*,
notes: str = "",
action: str = "approve_candidate_graph",
) -> RepositoryAbilityMap:
graph = self.store.get_candidate_graph(repository_id, analysis_run_id)
pending_abilities = [
@@ -347,7 +363,7 @@ class RegistryService:
self.store.create_review_decision(
repository_id,
analysis_run_id,
action="approve_candidate_graph",
action=action,
notes=notes,
)
self.store.update_repository_status(repository_id, "indexed")

View File

@@ -61,6 +61,7 @@ class Settings(BaseSettings):
database_path: str = Field(default="var/repo-registry.sqlite3")
checkout_root: str = Field(default="var/checkouts")
llm_enabled: bool = Field(default=True)
llm_provider: str | None = Field(default=None)
llm_model: str | None = Field(default=None)
embedding_provider: str | None = Field(default=None)
@@ -80,7 +81,7 @@ def get_service(settings: Settings = Depends(get_settings)) -> RegistryService:
store = RegistryStore(database_path)
store.initialize()
llm_extractor = None
if settings.llm_provider:
if settings.llm_enabled and settings.llm_provider:
adapter = create_llm_connect_adapter(
settings.llm_provider,
model=settings.llm_model,
@@ -246,6 +247,8 @@ def create_analysis_run(
repository_id,
source_path=payload.source_path,
use_cached_checkout=payload.use_cached_checkout,
use_llm_assistance=payload.use_llm_assistance,
trusted_auto_approve=payload.trusted_auto_approve,
access_username=payload.access_username,
access_password=payload.access_password,
)

View File

@@ -203,6 +203,8 @@ class EvidenceUpdate(BaseModel):
class AnalysisRunCreate(BaseModel):
source_path: str | None = None
use_cached_checkout: bool = False
use_llm_assistance: bool = True
trusted_auto_approve: bool = False
access_username: str | None = None
access_password: str | None = Field(default=None, repr=False)
@@ -212,6 +214,8 @@ class AnalysisRunCreate(BaseModel):
{},
{"source_path": "/path/to/local/repository"},
{"use_cached_checkout": True},
{"use_llm_assistance": False},
{"trusted_auto_approve": True},
{
"access_username": "git-user",
"access_password": "access-token",

View File

@@ -214,6 +214,8 @@ def render_repository_index(
<label>Username <input name="access_username" autocomplete="username" placeholder="Optional for private HTTP(S) repos"></label>
<label>Password or access token <input name="access_password" type="password" autocomplete="current-password" placeholder="Used for this Git operation only"></label>
<label class="checkbox"><input type="checkbox" name="explore_after_registration" value="1" checked> Explore after registration</label>
<label class="checkbox"><input type="checkbox" name="use_llm_assistance" value="1" checked> Use LLM assistance if configured</label>
<label class="checkbox"><input type="checkbox" name="trusted_auto_approve" value="1"> Trusted auto-populate after analysis</label>
<div class="actions">
<button type="submit">Register</button>
<span data-pending>Registering repository...</span>
@@ -426,6 +428,8 @@ def create_repository_from_form(
access_username: str = Form(""),
access_password: str = Form(""),
explore_after_registration: str | None = Form(None),
use_llm_assistance: str | None = Form(None),
trusted_auto_approve: str | None = Form(None),
service: RegistryService = Depends(get_service),
):
try:
@@ -444,6 +448,8 @@ def create_repository_from_form(
if explore_after_registration:
summary = service.analyze_repository(
repository.id,
use_llm_assistance=bool(use_llm_assistance),
trusted_auto_approve=bool(trusted_auto_approve),
access_username=access_username or None,
access_password=access_password or None,
)
@@ -508,6 +514,8 @@ def repository_detail(
<form class="stack" method="post" action="/ui/repos/{repository_id}/analysis-runs">
<label>Override source path <input name="source_path" placeholder="Optional local path"></label>
<label class="checkbox"><input type="checkbox" name="use_cached_checkout" value="1"> Analyze cached checkout without fetching upstream</label>
<label class="checkbox"><input type="checkbox" name="use_llm_assistance" value="1" checked> Use LLM assistance if configured</label>
<label class="checkbox"><input type="checkbox" name="trusted_auto_approve" value="1"> Trusted auto-populate after analysis</label>
<label>Username <input name="access_username" autocomplete="username" placeholder="Optional for private HTTP(S) repos"></label>
<label>Password or access token <input name="access_password" type="password" autocomplete="current-password" placeholder="Used for this Git operation only"></label>
<div class="actions">
@@ -837,6 +845,8 @@ def create_analysis_run_from_form(
repository_id: int,
source_path: str = Form(""),
use_cached_checkout: str | None = Form(None),
use_llm_assistance: str | None = Form(None),
trusted_auto_approve: str | None = Form(None),
access_username: str = Form(""),
access_password: str = Form(""),
service: RegistryService = Depends(get_service),
@@ -845,6 +855,8 @@ def create_analysis_run_from_form(
repository_id,
source_path=source_path or None,
use_cached_checkout=bool(use_cached_checkout),
use_llm_assistance=bool(use_llm_assistance),
trusted_auto_approve=bool(trusted_auto_approve),
access_username=access_username or None,
access_password=access_password or None,
)