interfaces.py 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. from __future__ import annotations
  2. from dataclasses import dataclass
  3. from pathlib import Path
  4. from typing import Any, Protocol
  5. class RuntimeStore(Protocol):
  6. def prepare_run(self, run_id: str) -> Path: ...
  7. def run_dir(self, run_id: str) -> Path: ...
  8. def write_json(self, run_id: str, filename: str, data: dict[str, Any]) -> Path: ...
  9. def update_json(self, run_id: str, filename: str, data: dict[str, Any]) -> Path: ...
  10. def append_jsonl(self, run_id: str, filename: str, rows: list[dict[str, Any]]) -> Path: ...
  11. def read_json(self, run_id: str, filename: str) -> dict[str, Any]: ...
  12. def read_jsonl(self, run_id: str, filename: str) -> list[dict[str, Any]]: ...
  13. def file_status(self, run_id: str) -> dict[str, bool]: ...
  14. def create_run_record(self, record: dict[str, Any]) -> None: ...
  15. def update_run_record(self, run_id: str, updates: dict[str, Any]) -> None: ...
  16. def record_policy_run(self, record: dict[str, Any]) -> None: ...
  17. def append_run_event_records(
  18. self,
  19. run_id: str,
  20. policy_run_id: str,
  21. rows: list[dict[str, Any]],
  22. ) -> None: ...
  23. def write_publish_jobs(
  24. self,
  25. run_id: str,
  26. policy_run_id: str,
  27. rows: list[dict[str, Any]],
  28. ) -> None: ...
  29. def write_author_assets(self, rows: list[dict[str, Any]]) -> None: ...
  30. def write_author_asset_roles(self, rows: list[dict[str, Any]]) -> None: ...
  31. def write_search_clue_assets(self, rows: list[dict[str, Any]]) -> None: ...
  32. def write_search_clue_asset_evidence(self, rows: list[dict[str, Any]]) -> None: ...
  33. def read_performance_feedback(
  34. self,
  35. run_id: str,
  36. policy_run_id: str,
  37. ) -> list[dict[str, Any]]: ...
  38. RuntimeFileStore = RuntimeStore
  39. @dataclass(frozen=True)
  40. class QueryVariantResult:
  41. query: str
  42. model: str
  43. prompt_version: str
  44. input_evidence: dict[str, Any]
  45. class QueryVariantClient(Protocol):
  46. def generate_variant(
  47. self,
  48. *,
  49. seed_term: str,
  50. evidence_context: dict[str, Any],
  51. ) -> QueryVariantResult: ...
  52. class GeminiVideoClient(Protocol):
  53. def analyze(
  54. self,
  55. content: dict[str, Any],
  56. media: dict[str, Any],
  57. source_context: dict[str, Any],
  58. ) -> dict[str, Any]: ...
  59. class PlatformSearchClient(Protocol):
  60. def search(self, search_query: dict[str, Any]) -> list[dict[str, Any]]: ...
  61. class PolicyBundleStore(Protocol):
  62. def load_policy_bundle(self, strategy_version: str) -> dict[str, Any]: ...