Skip to content

refactor(core): centralize config, purify domain, and modernize LLM adapters#59

Merged
4nibhal merged 7 commits into
mainfrom
audit/aiwf-state-2026-06-13
Jun 18, 2026
Merged

refactor(core): centralize config, purify domain, and modernize LLM adapters#59
4nibhal merged 7 commits into
mainfrom
audit/aiwf-state-2026-06-13

Conversation

@4nibhal

@4nibhal 4nibhal commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • centralize runtime config resolution across API, CLI, and container wiring
  • remove filesystem I/O from domain indexing policies
  • make src/ and tests/ pass current Ruff/mypy expectations
  • replace prompt-centric LLM generation with a message-oriented port
  • add OpenAI-compatible provider alias support and base URL forwarding
  • normalize test packaging and lint-driven hygiene cleanup

Architecture

This PR consolidates several related modernization steps that were previously coupled by the same runtime seams:

  • Config architecture

    • BhodiConfig now owns API transport settings through ApiConfig
    • API and CLI entrypoints consume resolved config instead of rebuilding it ad hoc
    • indexing compatibility settings now flow through the central config path
  • Domain purity

    • indexing rules no longer inspect the filesystem directly
    • domain policy checks now operate on supplied facts (IndexingTarget) instead of concrete path I/O
  • LLM architecture

    • generate_with_context is removed entirely
    • the LLM port is now message-oriented
    • RAG context assembly moves into the application layer, so adapters only translate canonical messages to provider calls
  • Provider-family direction

    • OpenAI-family adapters now support compatible endpoints via alias resolution and base_url
    • credential injection remains at the composition boundary
  • Quality posture

    • product source is now green under mypy src/
    • repo tests are green under ruff check tests/

Testing

  • uv run ruff check src tests
  • uv run mypy src/
  • uv run pytest

Results:

  • Ruff ✅
  • mypy ✅
  • pytest ✅ 261 passed

Notes

  • No AIWF/OpenCode behavior changes are included in this PR.
  • Remaining warnings are upstream/dependency warnings from Starlette TestClient and OpenTelemetry.

4nibhal added 7 commits June 18, 2026 04:14
Make the config loader the effective runtime authority for API and CLI entrypoints. Add typed API transport settings, route indexing compatibility through the central config path, and propagate resolved configuration into interface entrypoints instead of rebuilding it ad hoc.
Replace filesystem inspection in domain indexing rules with pure facts supplied by outer layers. Tighten port-facing typing across domain-adjacent modules so indexing and retrieval logic depend on structured inputs instead of concrete runtime state.
Tighten lazy-init adapters and infrastructure helpers so they remain type-safe under strict static checks. Normalize ancillary integration and contract tests around those runtime guards without changing product behavior.
Replace the prompt-centric LLM contract with a message-oriented port and move RAG context assembly into the application layer. Update adapters and contract coverage so model providers only translate canonical messages instead of owning retrieval-specific prompt construction.
Add OpenAI-compatible provider aliases at the composition boundary and forward injected base URLs and API keys into the shared OpenAI-family adapters. This keeps the port stable while widening support for OpenAI-style hosted and self-hosted model APIs.
Finish the test-suite cleanup by aligning package markers, removing stale lint configuration noise, and applying mechanical Ruff-driven normalization across remaining test support files. This keeps repo hygiene green without changing product behavior.
Update the explicit Starlette pin to a non-vulnerable 1.x release so the security job passes without weakening the audit gate. Regenerate the lockfile and revalidate the repo against Ruff, mypy, pytest, and the CI-equivalent pip-audit command.
@4nibhal
4nibhal merged commit 50463a0 into main Jun 18, 2026
4 checks passed
@4nibhal
4nibhal deleted the audit/aiwf-state-2026-06-13 branch June 18, 2026 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant