coderouter-cli 2.3.0a3__py3-none-any.whl → 2.3.0a4__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.
@@ -43,17 +43,14 @@ from coderouter.plugins.loader import (
43
43
  from coderouter.plugins.registry import PluginRegistry
44
44
 
45
45
  __all__ = [
46
- # Active hooks
47
- "InputFilter",
48
- "Observer",
49
- # Future hooks (Protocol-only, no engine integration yet)
46
+ "PLUGIN_GROUPS_FUTURE",
47
+ "PLUGIN_GROUPS_V2_3",
48
+ "Adapter",
50
49
  "Frontend",
51
50
  "Guard",
51
+ "InputFilter",
52
+ "Observer",
52
53
  "OutputFilter",
53
- "Adapter",
54
- # Discovery + container
55
54
  "PluginRegistry",
56
55
  "discover_and_load",
57
- "PLUGIN_GROUPS_V2_3",
58
- "PLUGIN_GROUPS_FUTURE",
59
56
  ]
@@ -838,6 +838,12 @@ class FallbackEngine:
838
838
  # so tests that build the engine via ``FallbackEngine.__new__``
839
839
  # see an empty registry instead of AttributeError.
840
840
  self._plugin_registry: PluginRegistry = plugins or PluginRegistry.empty()
841
+ # v2.3.0: holds strong refs to in-flight Observer fanout tasks
842
+ # so the asyncio event loop's weak-ref bookkeeping doesn't GC
843
+ # them mid-flight (RUF006). Tasks remove themselves on done
844
+ # via ``add_done_callback(_observer_tasks.discard)`` in
845
+ # :meth:`_fanout_observers`.
846
+ self._observer_tasks: set[asyncio.Task[None]] = set()
841
847
  # Cache adapters so we don't re-instantiate per request
842
848
  self._adapters: dict[str, BaseAdapter] = {
843
849
  p.name: build_adapter(p) for p in config.providers
@@ -1881,10 +1887,22 @@ class FallbackEngine:
1881
1887
  observers = self.plugins.observers
1882
1888
  if not observers:
1883
1889
  return
1890
+ # Lazy-init the task set for engines built via ``__new__`` —
1891
+ # mirrors the lazy ``plugins`` property pattern so legacy
1892
+ # tests that bypass __init__ don't crash here.
1893
+ if not hasattr(self, "_observer_tasks"):
1894
+ self._observer_tasks = set()
1884
1895
  for obs in observers:
1885
- asyncio.create_task(
1896
+ task = asyncio.create_task(
1886
1897
  self._safe_observe(obs, event_type, payload)
1887
1898
  )
1899
+ # Strong-ref keeps the task alive past the loop iteration;
1900
+ # ``discard`` cleans up after the task completes (success
1901
+ # or exception). Avoids the RUF006 footgun where
1902
+ # asyncio.create_task's weakref-only bookkeeping can let
1903
+ # the loop GC a fanout-in-progress task.
1904
+ self._observer_tasks.add(task)
1905
+ task.add_done_callback(self._observer_tasks.discard)
1888
1906
 
1889
1907
  async def _safe_observe(
1890
1908
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: coderouter-cli
3
- Version: 2.3.0a3
3
+ Version: 2.3.0a4
4
4
  Summary: Local-first, free-first, fallback-built-in LLM router. Claude Code / OpenAI compatible.
5
5
  Project-URL: Homepage, https://github.com/zephel01/CodeRouter
6
6
  Project-URL: Repository, https://github.com/zephel01/CodeRouter
@@ -40,7 +40,7 @@ coderouter/ingress/openai_routes.py,sha256=Zw1efPw9DI6GgV8ZcLrzS6Cda0KLrFkKn2GBZ
40
40
  coderouter/metrics/__init__.py,sha256=7Es351DPS7yLM0yVF_F0eesmiD83n7Zzhie44chht38,1465
41
41
  coderouter/metrics/collector.py,sha256=Q0_CY0orX8_i0EICBME5sYW2RqL2VD4SpNs8qfCnBM0,47432
42
42
  coderouter/metrics/prometheus.py,sha256=YRqyT931s40zVkIj07D-M2UNfDhIEElVFRz3izdJcnQ,24419
43
- coderouter/plugins/__init__.py,sha256=BWqgSEIMRxyTNEDdUm7B0weHE6HyKyHNgMaIJFnwnfA,2083
43
+ coderouter/plugins/__init__.py,sha256=76hMLe5dV_ilripHXzWn3HSYoIALjzlw4EJVyI-GyIM,1974
44
44
  coderouter/plugins/base.py,sha256=n9hsck2NCSqi6oeHIumKC5zhQ8JGwCXUz7J5AZQCQss,5772
45
45
  coderouter/plugins/loader.py,sha256=xAIf6bIuth0QXCzwxO_ja6aSUlLzIqZNbrbQNJDgSE8,6841
46
46
  coderouter/plugins/registry.py,sha256=Tx0QHJHozZ5LTUliGylBdNVcdzHTBV0nedCUwGlbLMM,3236
@@ -49,7 +49,7 @@ coderouter/routing/adaptive.py,sha256=G2o377twGSjbUh65wiIFx6klnpFGjsD_nI3oDvcBwh
49
49
  coderouter/routing/auto_router.py,sha256=4_sQR0ztSED9FgQSvQqgqSiydyQVY_qOSRvwyZ5BfRc,12909
50
50
  coderouter/routing/budget.py,sha256=A3_i44tmS3SrqVNnoGkLKMsiYwI_Ug6m5-3gitVoQSM,8452
51
51
  coderouter/routing/capability.py,sha256=ziIDuE5keH_jxYDlXSKufRVxxSYOAvUxJ6Rw5QkYDDU,18436
52
- coderouter/routing/fallback.py,sha256=o5GAAwfyn_rOulvtZKQq8Z1Xhi_UNLs4Tyn0jBocN-M,101836
52
+ coderouter/routing/fallback.py,sha256=j2clcgcr9Y5wQqJDwy8UhEMWRYJr1ZDV0bEvo_tgOfA,102930
53
53
  coderouter/state/__init__.py,sha256=mmINqwIyIu6-zt-Qo-7Ddxdxz_-5vzuPjLvjYW5T_bk,782
54
54
  coderouter/state/audit_log.py,sha256=JwGd0OkkDlkh0Fdc6SmnuyViwKzEaFA7Ux_VqHzakWE,8358
55
55
  coderouter/state/replay.py,sha256=Z_YHKroTKZdrL8qObFxcoLOAQWWXZvXFdLfxzvBhEJg,11230
@@ -59,8 +59,8 @@ coderouter/translation/__init__.py,sha256=PYXN7XVEwpG1uC8RLy6fvnGbzEZhhrEuUapH8I
59
59
  coderouter/translation/anthropic.py,sha256=JpvIWNXHUPVqOGvps7o_6ZADhXuJuvpU7RdMqQFtwwM,6421
60
60
  coderouter/translation/convert.py,sha256=-qyzFzmmr9hhQV6_Sg75kJnvCZvHe3n7vRdaZtk_JqQ,47269
61
61
  coderouter/translation/tool_repair.py,sha256=Ok2PF947Liegc5oaytfptv5MWMkpfJYQie-zdP1y3cY,9946
62
- coderouter_cli-2.3.0a3.dist-info/METADATA,sha256=hWfTPzx1x-ut7NIjf1hi4ETWo4MsEn4s3q_XlU9Sxfw,9993
63
- coderouter_cli-2.3.0a3.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
64
- coderouter_cli-2.3.0a3.dist-info/entry_points.txt,sha256=-dnLfD1YZ2WjH2zSdNCvlO65wYltM9bsHt9Fhg3yGss,51
65
- coderouter_cli-2.3.0a3.dist-info/licenses/LICENSE,sha256=wkEzoR86jFw33jvfOHjULqmkGEfxTFMgMaJnpR8mPRw,1065
66
- coderouter_cli-2.3.0a3.dist-info/RECORD,,
62
+ coderouter_cli-2.3.0a4.dist-info/METADATA,sha256=6U8KQgMiL-g1TbAyu4SPEINFKroIPicJKsLTnm6fE4U,9993
63
+ coderouter_cli-2.3.0a4.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
64
+ coderouter_cli-2.3.0a4.dist-info/entry_points.txt,sha256=-dnLfD1YZ2WjH2zSdNCvlO65wYltM9bsHt9Fhg3yGss,51
65
+ coderouter_cli-2.3.0a4.dist-info/licenses/LICENSE,sha256=wkEzoR86jFw33jvfOHjULqmkGEfxTFMgMaJnpR8mPRw,1065
66
+ coderouter_cli-2.3.0a4.dist-info/RECORD,,