agentpool-cli 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. agentpool/__init__.py +3 -0
  2. agentpool/agent_io.py +134 -0
  3. agentpool/artifacts.py +151 -0
  4. agentpool/cli.py +1199 -0
  5. agentpool/config.py +373 -0
  6. agentpool/docs/agentpool-skill.md +85 -0
  7. agentpool/docs/onboarding.md +169 -0
  8. agentpool/event_detection.py +150 -0
  9. agentpool/fixtures/__init__.py +1 -0
  10. agentpool/fixtures/fake_agents/__init__.py +1 -0
  11. agentpool/fixtures/fake_agents/fake_approval_agent.py +16 -0
  12. agentpool/fixtures/fake_agents/fake_common.py +44 -0
  13. agentpool/fixtures/fake_agents/fake_completed_agent.py +13 -0
  14. agentpool/fixtures/fake_agents/fake_idle_agent.py +16 -0
  15. agentpool/fixtures/fake_agents/fake_limit_agent.py +14 -0
  16. agentpool/fixtures/fake_agents/fake_patch_agent.py +17 -0
  17. agentpool/fixtures/fake_agents/fake_question_agent.py +16 -0
  18. agentpool/git_worktree.py +144 -0
  19. agentpool/mcp/__init__.py +1 -0
  20. agentpool/mcp/resources.py +64 -0
  21. agentpool/mcp/tools.py +259 -0
  22. agentpool/mcp_server.py +487 -0
  23. agentpool/models.py +310 -0
  24. agentpool/onboarding.py +1279 -0
  25. agentpool/policy.py +63 -0
  26. agentpool/provider_model_catalog.json +997 -0
  27. agentpool/providers/__init__.py +3 -0
  28. agentpool/providers/base.py +411 -0
  29. agentpool/providers/registry.py +139 -0
  30. agentpool/redaction.py +30 -0
  31. agentpool/runtimes/__init__.py +3 -0
  32. agentpool/runtimes/base.py +36 -0
  33. agentpool/runtimes/tmux.py +133 -0
  34. agentpool/session_manager.py +1061 -0
  35. agentpool/stats/__init__.py +6 -0
  36. agentpool/stats/card.py +74 -0
  37. agentpool/stats/compute.py +496 -0
  38. agentpool/stats/queries.py +138 -0
  39. agentpool/stats/render.py +103 -0
  40. agentpool/stats/window.py +85 -0
  41. agentpool/store.py +478 -0
  42. agentpool/usage/__init__.py +1 -0
  43. agentpool/usage/_common.py +223 -0
  44. agentpool/usage/ccusage.py +130 -0
  45. agentpool/usage/claude.py +23 -0
  46. agentpool/usage/codex.py +210 -0
  47. agentpool/usage/codexbar.py +186 -0
  48. agentpool/usage/combine.py +71 -0
  49. agentpool/usage/copilot.py +146 -0
  50. agentpool/usage/devin.py +265 -0
  51. agentpool/usage/parsers.py +41 -0
  52. agentpool/usage/probes.py +52 -0
  53. agentpool/usage/provider_parsers.py +276 -0
  54. agentpool/usage/summary.py +166 -0
  55. agentpool/utils.py +59 -0
  56. agentpool_cli-0.1.0.dist-info/METADATA +292 -0
  57. agentpool_cli-0.1.0.dist-info/RECORD +60 -0
  58. agentpool_cli-0.1.0.dist-info/WHEEL +4 -0
  59. agentpool_cli-0.1.0.dist-info/entry_points.txt +2 -0
  60. agentpool_cli-0.1.0.dist-info/licenses/LICENSE +21 -0
agentpool/policy.py ADDED
@@ -0,0 +1,63 @@
1
+ from __future__ import annotations
2
+
3
+ from agentpool.config import AgentPoolConfig
4
+ from agentpool.models import SessionState, ToolError
5
+
6
+
7
+ MUTATING_ROLES = {"implementer", "tester"}
8
+
9
+
10
+ def enforce_spawn_policy(config: AgentPoolConfig, provider_id: str, role: str, isolation: str) -> None:
11
+ policy = config.policy
12
+ if policy.require_explicit_provider and (not provider_id or provider_id == "auto"):
13
+ raise ToolError(
14
+ "POLICY_BLOCKED",
15
+ "AgentPool v0.1 requires explicit provider selection; provider=auto is disabled.",
16
+ {"provider_id": provider_id, "policy": "require_explicit_provider"},
17
+ )
18
+ if provider_id in policy.denied_providers:
19
+ raise ToolError(
20
+ "POLICY_BLOCKED",
21
+ f"Provider {provider_id} is denied by policy.",
22
+ {"provider_id": provider_id, "policy": "denied_providers"},
23
+ )
24
+ if policy.allowed_providers and provider_id not in policy.allowed_providers:
25
+ raise ToolError(
26
+ "POLICY_BLOCKED",
27
+ f"Provider {provider_id} is not in the allowed provider list.",
28
+ {"provider_id": provider_id, "policy": "allowed_providers"},
29
+ )
30
+ if role in MUTATING_ROLES and policy.require_worktree_for_edits and isolation != "worktree":
31
+ raise ToolError(
32
+ "POLICY_BLOCKED",
33
+ "Mutating roles require worktree isolation by policy.",
34
+ {"role": role, "isolation": isolation, "policy": "require_worktree_for_edits"},
35
+ )
36
+ if isolation == "shared" and not policy.allow_shared_repo_edits and role in MUTATING_ROLES:
37
+ raise ToolError(
38
+ "POLICY_BLOCKED",
39
+ "Shared-repo mutations are disabled by policy.",
40
+ {"role": role, "isolation": isolation, "policy": "allow_shared_repo_edits"},
41
+ )
42
+
43
+
44
+ def enforce_raw_keys_policy(config: AgentPoolConfig, keys: list[str]) -> None:
45
+ if config.policy.allow_raw_keys:
46
+ return
47
+ raise ToolError(
48
+ "POLICY_BLOCKED",
49
+ "Raw key sending is disabled by policy; use interrupt_worker for Ctrl-C.",
50
+ {"keys": keys, "policy": "allow_raw_keys"},
51
+ )
52
+
53
+
54
+ def active_state(state: SessionState | str) -> bool:
55
+ return str(state) in {
56
+ SessionState.STARTING.value,
57
+ SessionState.READY.value,
58
+ SessionState.RUNNING.value,
59
+ SessionState.AWAITING_USER_INPUT.value,
60
+ SessionState.AWAITING_APPROVAL.value,
61
+ SessionState.IDLE.value,
62
+ SessionState.UNKNOWN.value,
63
+ }