coderouter-cli 2.8.1__py3-none-any.whl → 2.9.1__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.
@@ -18,12 +18,27 @@ logger = get_logger(__name__)
18
18
  # in-core kinds, in resolution order. Kept as a tuple (not derived from
19
19
  # the if-chain below) so the "Unknown adapter kind" error message and
20
20
  # the plugin-shadow guard have a single source of truth.
21
- _IN_CORE_KINDS: tuple[str, ...] = ("openai_compat", "anthropic", "agent_cli")
22
-
23
- # Module-level flag so the Phase 2b in-core agent_cli deprecation warning
24
- # (docs/designs/agent-cli-plugin-extraction.md §5.1) fires at most once per
25
- # process, regardless of how many agent_cli providers are built.
26
- _agent_cli_deprecation_logged = False
21
+ #
22
+ # Phase 2c (docs/designs/agent-cli-plugin-extraction.md §7 row "2c"):
23
+ # "agent_cli" is no longer in this tuple. It is served exclusively by
24
+ # the coderouter-plugin-agents adapter plugin now that the in-core
25
+ # AgentCliAdapter and its build_adapter branch have been removed.
26
+ _IN_CORE_KINDS: tuple[str, ...] = ("openai_compat", "anthropic")
27
+
28
+ # Phase 2c migration hint (docs/designs/agent-cli-plugin-extraction.md
29
+ # §5.2): shown ONLY for kind="agent_cli" when no plugin resolves it, so
30
+ # operators upgrading from pre-2c configs get a targeted fix instead of
31
+ # the generic unknown-kind message.
32
+ _AGENT_CLI_MIGRATION_HINT = (
33
+ "kind='agent_cli' is served by the coderouter-plugin-agents plugin "
34
+ "(Core no longer ships an in-core agent_cli adapter as of Phase 2c). "
35
+ 'Install it with: pip install "coderouter-plugin-agents @ '
36
+ 'git+https://github.com/zephel01/coderouter-plugin-agents" and add '
37
+ "'agents' to plugins.enabled in providers.yaml, e.g.:\n"
38
+ "plugins:\n"
39
+ " enabled:\n"
40
+ " - agents"
41
+ )
27
42
 
28
43
 
29
44
  def _plugin_kinds(plugin_registry: PluginRegistry | None) -> list[str]:
@@ -33,36 +48,6 @@ def _plugin_kinds(plugin_registry: PluginRegistry | None) -> list[str]:
33
48
  return [factory.kind for factory in plugin_registry.adapters]
34
49
 
35
50
 
36
- def _warn_agent_cli_in_core_deprecated_once() -> None:
37
- """Log ``agent-cli-in-core-deprecated`` once per process (§5.1).
38
-
39
- Only called when the in-core ``agent_cli`` branch is taken AND an
40
- adapter plugin has also registered a ``kind="agent_cli"`` factory —
41
- i.e. the operator already has ``coderouter-plugin-agents`` installed
42
- and enabled, but Core's in-core copy still wins resolution order
43
- (§3.2) during the Phase 2b migration window. Nudges them toward the
44
- plugin path ahead of its Phase 2c removal from Core.
45
- """
46
- global _agent_cli_deprecation_logged
47
- if _agent_cli_deprecation_logged:
48
- return
49
- _agent_cli_deprecation_logged = True
50
- logger.warning(
51
- "agent-cli-in-core-deprecated",
52
- extra={
53
- "hint": (
54
- "an 'agent_cli' adapter plugin is installed and enabled, "
55
- "but Core's in-core agent_cli implementation still served "
56
- "this request (in-core wins resolution during the Phase 2b "
57
- "migration window). The in-core copy will be removed in "
58
- "Phase 2c — no action is required yet, but new setups "
59
- "should already be relying on the plugin path "
60
- "(coderouter-plugin-agents)."
61
- ),
62
- },
63
- )
64
-
65
-
66
51
  def build_adapter(
67
52
  provider: ProviderConfig,
68
53
  plugin_registry: PluginRegistry | None = None,
@@ -72,27 +57,25 @@ def build_adapter(
72
57
  Resolution order (docs/designs/agent-cli-plugin-extraction.md §3.2):
73
58
  in-core kinds first, then plugin-provided kinds, then a fail-fast
74
59
  error. In-core kinds are checked first so a plugin can never shadow
75
- a kind Core itself guarantees (``openai_compat`` / ``anthropic`` /,
76
- during the Phase 2b migration window, ``agent_cli``).
60
+ a kind Core itself guarantees (``openai_compat`` / ``anthropic``).
61
+
62
+ As of Phase 2c, ``agent_cli`` is no longer an in-core kind — it
63
+ resolves ONLY via the plugin path (``coderouter-plugin-agents``).
77
64
  """
78
65
  if provider.kind == "openai_compat":
79
66
  return OpenAICompatAdapter(provider)
80
67
  if provider.kind == "anthropic":
81
68
  return AnthropicAdapter(provider)
82
- if provider.kind == "agent_cli":
83
- # Imported lazily so the external-agent adapter (and its subprocess /
84
- # os plumbing) is only pulled in when a config actually uses it.
85
- from coderouter.adapters.agent_cli import AgentCliAdapter
86
-
87
- if plugin_registry is not None and any(
88
- factory.kind == "agent_cli" for factory in plugin_registry.adapters
89
- ):
90
- _warn_agent_cli_in_core_deprecated_once()
91
- return AgentCliAdapter(provider)
92
69
  if plugin_registry is not None:
93
70
  for factory in plugin_registry.adapters:
94
71
  if factory.kind == provider.kind:
95
72
  return factory.build(provider)
73
+ if provider.kind == "agent_cli":
74
+ # Targeted migration hint (§5.2) instead of the generic message
75
+ # below — this is the single most common post-2c misconfiguration
76
+ # (an un-migrated providers.yaml that still relies on the removed
77
+ # in-core adapter).
78
+ raise ValueError(f"Unknown adapter kind {provider.kind!r}. {_AGENT_CLI_MIGRATION_HINT}")
96
79
  raise ValueError(
97
80
  f"Unknown adapter kind {provider.kind!r}. "
98
81
  f"in-core kinds: {', '.join(_IN_CORE_KINDS)}; "