Support installing FrontierAgent once and launching from any project - #41
Draft
matyasstoch wants to merge 1 commit into
Draft
Support installing FrontierAgent once and launching from any project#41matyasstoch wants to merge 1 commit into
matyasstoch wants to merge 1 commit into
Conversation
A wheel built from this repository installs with `uv tool install`, but the first launch outside a checkout failed twice. Profile loading could not find `config/providers.yaml`, which lives at the repository root and is resolved relative to the package. After that, the first `read_file` call ran its helper under the system `python3` (3.9 on macOS) because a tool install only exposes the console scripts on PATH. Packaging and runtime: - Ship `config/providers.yaml` inside the wheel as `frontier_agent/infra/providers.yaml`; the loader prefers the checkout copy and falls back to the packaged one. - Native mode places the CLI interpreter's bin directory ahead of the inherited PATH so `read_file`, `download_file`, and `python3` inside `bash` use the environment the CLI was installed with. A PATH that already leads with it is left unchanged. Configuration: - Add an optional user env file at `$XDG_CONFIG_HOME/apodex/env` (default `~/.config/apodex/env`, override with `APODEX_ENV_FILE`). Precedence is CLI options, exported environment, the launch directory's `.env` and ancestors, then the user file. The file is read literally, blank values are ignored, and notes never include values. - A `<PREFIX>_API_KEY` / `<PREFIX>_BASE_URL` pair defined together in the user file is applied together. If a higher source fixes one half to a different value, the other half is withheld and the reason is printed once. Docker: - Building `apodex:local` needs a source checkout. Outside one, the launcher uses an image that is already present, builds from `APODEX_BUILD_CONTEXT`, or pulls an explicit `APODEX_IMAGE`; with none of those it stops and lists the options together with `--native` rather than dropping the boundary. - Forward resolved runtime variables into the container as `-e NAME`, so an exported value reaches the container without appearing on the command line. The macOS Docker preference, the Linux native default, and the BYOK policy (no login command, no credential entry or display in the TUI) are unchanged. Docs: a new `docs/install/global-install.md` covers installation, PATH troubleshooting, the user file and its precedence, the one-time Docker step, and updating. Existing checkout instructions remain supported. Tests cover env precedence and the pair guard, secret-free output, `--cwd` semantics, the packaged registry, Docker build-context and forwarding behaviour, native PATH selection, and a built wheel installed with `uv tool` and launched from unrelated directories against a local stub endpoint.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A wheel built from this repository installs with
uv tool install, but the first launch outside a checkout fails twice. Profile loading stops withProvider registry not found: .../site-packages/config/providers.yaml, because the registry lives at the repository root and is resolved relative to the package. Once that is fixed,read_filefails inside its helper, which is piped topython3 -: a tool install only puts the console scripts on PATH, sopython3resolves to the system interpreter (3.9 on macOS).Result
After
uv tool install --python 3.12 git+https://github.com/ApodexAI/FrontierAgent.git,frontier-agentruns inside any project and the existing TUI opens against that directory, with run records under<project>/.apodex/. The checkout workflow, the macOS Docker preference with native fallback, the Linux native default, theapodexalias, and the BYOK policy (no login command, no credential entry or display) are unchanged.Changes
config/providers.yamlis force-included in the wheel asfrontier_agent/infra/providers.yaml. The loader prefers the checkout file and falls back to the packaged copy.prepare_native_runtimeplaces the CLI interpreter'sbindirectory ahead of the inherited PATH unless it already leads it, soread_file,download_file, andpython3insidebashuse the environment the CLI was installed with.$XDG_CONFIG_HOME/apodex/env(default~/.config/apodex/env, overrideAPODEX_ENV_FILE) supplies defaults. Precedence, highest first: CLI options, exported environment,.envin the launch directory or an ancestor (unchanged), the user file. The file is read literally without${VAR}expansion, and notes name variables and paths only.<PREFIX>_API_KEYand<PREFIX>_BASE_URLpair defined together in the user file is applied together. If a higher source sets one half to a different value, the other half is withheld and the reason is printed once.apodex:localneeds a source tree, which a wheel lacks. The launcher uses an image that is already present, builds fromAPODEX_BUILD_CONTEXT, or pulls an explicitAPODEX_IMAGE. With none of those it fails with setup guidance listing those options and--native, preserving the existing Docker preference. Resolved runtime variables cross into the container asdocker run -e NAME, never as values on a command line.A new
docs/install/global-install.mdcovers installation, PATH troubleshooting, the user file, the one-time Docker step, and updating.Tests
Precedence and the pair guard, secret-free output,
--cwdand--modelsemantics, the packaged registry, Docker build-context and forwarding, native PATH selection against a decoypython3, and a built wheel installed withuv tooland launched from unrelated projects against a local stub endpoint. Docker integration is covered by tests and mocks only; no container was started.Validation
uv run pytest -qtests/test_network_tools.py::test_redirect_hops_are_validated_not_followed_blindlyneeds DNS, unavailable in the sandbox used hereapodex/tests/test_global_install.pyruff checkon the CI pathsruff check .whole treetests/anddocker/, identical tomaintools/import_smoke.pyevalextraspyrightmain:gradiounresolved without thehf-spaceextratools/preflight.pymainand here: the default pipeline id is imported as a module path, and the underscore form reaches a missingcreate_llm. Addressed in #37