fix(types): add BottleSpec.loaded_manifest to satisfy pyright on union type

BottleSpec.manifest is ManifestIndex | Manifest (pre/post _validate()).
Downstream code always runs post-validate so it needs Manifest, but
pyright flagged every .agent/.bottle access. The new loaded_manifest
property asserts isinstance and returns Manifest, giving pyright a
narrowed type without scattering type: ignore everywhere.

Also remove unused Manifest imports from test files and annotate the
_index() helper in test_manifest_agent_git_user.
This commit is contained in:
2026-06-23 02:08:27 +00:00
committed by didericis
parent 294a6ed023
commit 56ef71060a
16 changed files with 31 additions and 22 deletions
+1 -2
View File
@@ -69,8 +69,7 @@ def write_launch_metadata(
def prepare_agent_state_dir(slug: str, spec: BottleSpec) -> tuple[Path, Path]:
"""Create the agent state subdir, write the prompt file.
Returns (agent_dir, prompt_file)."""
manifest = spec.manifest # type: ignore[assignment]
agent = manifest.agent
agent = spec.loaded_manifest.agent
agent_dir = agent_state_dir(slug)
agent_dir.mkdir(parents=True, exist_ok=True)
prompt_file = agent_dir / "prompt.txt"