Skip to content

Commit fda3d99

Browse files
committed
fix(catalog): admit only muse-spark-* from live discovery (v0.2.2)
The live endpoint also serves non-chat families (sam-*, muse-image-*, muse-voice-*). A denylist leaks the next such family, so filter by allowlist. Verified live: 8 models on api.meta.ai, sam-3.1 now excluded.
1 parent 6f53358 commit fda3d99

3 files changed

Lines changed: 20 additions & 10 deletions

File tree

‎__init__.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ def register(ctx) -> None:
9898
class MuseCodeSubscriptionProfile(ProviderProfile):
9999
"""Meta Model API via the Muse Code subscription."""
100100

101-
_NON_CHAT_PREFIXES = ("muse-image-", "muse-voice-")
101+
# Allowlist: this provider serves the Muse Spark chat family. The live
102+
# endpoint also returns other families (sam-*, muse-image-*,
103+
# muse-voice-*) that are not usable as chat models — a denylist
104+
# would leak the next such family, so only muse-spark-* is admitted.
105+
_CHAT_FAMILY_PREFIX = "muse-spark-"
102106

103107
def fetch_models(
104108
self,
@@ -112,11 +116,7 @@ def fetch_models(
112116
)
113117
if live is None:
114118
return None
115-
return [
116-
m
117-
for m in live
118-
if not any(m.startswith(p) for p in self._NON_CHAT_PREFIXES)
119-
]
119+
return [m for m in live if m.startswith(self._CHAT_FAMILY_PREFIX)]
120120

121121
def build_api_kwargs_extras(
122122
self,

‎plugin.yaml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name: muse-code-subscription
22
kind: model-provider
3-
version: 0.2.1
3+
version: 0.2.2
44
description: Muse Spark in Hermes billed to the Muse Code monthly login (device-code login, no API key)
55
author: TheStreamCode
66
license: MIT
77
homepage: https://github.com/TheStreamCode/hermes-muse-code
88
tags: [meta, muse-spark, subscription]
99
requires_hermes: ">=0.21.3"
1010

11+

‎tests/test_muse_code_provider.py‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,24 @@ def test_reasoning_effort_mapping(tmp_path, monkeypatch):
177177
)
178178

179179

180-
def test_fetch_models_filters_non_chat(tmp_path, monkeypatch):
180+
def test_fetch_models_admits_only_muse_spark(tmp_path, monkeypatch):
181181
monkeypatch.setenv("MUSE_CODE_SUB_CREDENTIALS", str(tmp_path / "c.json"))
182182
_, registered = _load_plugin()
183183
profile = registered["muse-code"]
184-
live = ["muse-spark-1.3", "muse-image-1.0", "muse-voice-transcribe-1.0"]
184+
live = [
185+
"muse-spark-1.3",
186+
"muse-spark-1.2-contributor",
187+
"sam-3.1",
188+
"muse-image-1.0",
189+
"muse-voice-transcribe-1.0",
190+
]
185191
with patch.object(
186192
type(profile).__mro__[1], "fetch_models", return_value=live
187193
):
188-
assert profile.fetch_models(api_key="k") == ["muse-spark-1.3"]
194+
assert profile.fetch_models(api_key="k") == [
195+
"muse-spark-1.3",
196+
"muse-spark-1.2-contributor",
197+
]
189198
with patch.object(
190199
type(profile).__mro__[1], "fetch_models", return_value=None
191200
):

0 commit comments

Comments
 (0)