ma-http-client 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.
@@ -0,0 +1,11 @@
1
+ from ma_http_client.client import SimpleHTTPMusicAssistantClient, debug_method
2
+ from ma_http_client.debug import DebugMusicAssistantClient
3
+ from ma_http_client.version import __version__
4
+
5
+
6
+ __all__ = [
7
+ "__version__",
8
+ "SimpleHTTPMusicAssistantClient",
9
+ "DebugMusicAssistantClient",
10
+ "debug_method",
11
+ ]
@@ -0,0 +1,227 @@
1
+ """Claude-powered natural language interface for Music Assistant.
2
+
3
+ Requires the `claude` optional dependency:
4
+ pip install ma-http-client[claude]
5
+
6
+ Usage:
7
+ from ma_http_client.claude_tools import MusicAssistantAgent
8
+
9
+ agent = MusicAssistantAgent(
10
+ ma_url="http://localhost:8095",
11
+ ma_token="YOUR_MA_TOKEN", # required for MA >= 2.7.2
12
+ default_player="Living Room", # optional
13
+ )
14
+ print(agent.run("Play some Radiohead"))
15
+ print(agent.run("Pause the kitchen speaker"))
16
+ print(agent.run("Set volume to 40 in the bedroom"))
17
+ """
18
+
19
+ import json
20
+ import os
21
+
22
+ import anthropic
23
+ from anthropic import beta_tool
24
+
25
+ from .client import SimpleHTTPMusicAssistantClient
26
+
27
+
28
+ _SYSTEM_PROMPT = """You are a music controller for Music Assistant, a self-hosted music server.
29
+
30
+ Workflow for playing music:
31
+ 1. Call get_players() to discover available players and match the requested location
32
+ 2. Call search_media() for the requested content
33
+ 3. Call play_media() with the player_id and URI from the search result
34
+
35
+ For playback controls (pause, next, previous, volume), call get_players() first to resolve the player_id.
36
+
37
+ Keep responses brief — one sentence. Examples:
38
+ - "Playing Radiohead in the living room."
39
+ - "Paused."
40
+ - "Volume set to 50%."
41
+ - "Couldn't find a player named 'bathroom'."
42
+ """
43
+
44
+
45
+ def create_ma_tools(client: SimpleHTTPMusicAssistantClient) -> list:
46
+ """Create Claude beta_tool functions wrapping an MA client instance."""
47
+
48
+ @beta_tool
49
+ def get_players() -> str:
50
+ """Get all available Music Assistant players with their IDs, names, and availability."""
51
+ players = client.get_players()
52
+ return json.dumps(
53
+ [
54
+ {
55
+ "player_id": p.player_id,
56
+ "name": p.name,
57
+ "available": getattr(p, "available", False),
58
+ }
59
+ for p in players
60
+ ]
61
+ )
62
+
63
+ @beta_tool
64
+ def search_media(query: str, media_type: str = "artist") -> str:
65
+ """Search Music Assistant for media to play.
66
+
67
+ Args:
68
+ query: Artist name, track title, album name, playlist name, or radio station.
69
+ media_type: One of: artist, track, album, playlist, radio.
70
+
71
+ Returns the best match with its URI, which is required for play_media.
72
+ """
73
+ from music_assistant_models.enums import MediaType
74
+
75
+ type_map = {
76
+ "artist": MediaType.ARTIST,
77
+ "track": MediaType.TRACK,
78
+ "album": MediaType.ALBUM,
79
+ "playlist": MediaType.PLAYLIST,
80
+ "radio": MediaType.RADIO,
81
+ }
82
+ mt = type_map.get(media_type.lower())
83
+ results = client.search_media(query, media_types=[mt] if mt else None, limit=5)
84
+
85
+ key_map = {
86
+ "artist": "artists",
87
+ "track": "tracks",
88
+ "album": "albums",
89
+ "playlist": "playlists",
90
+ "radio": "radio",
91
+ }
92
+ items = results.get(key_map.get(media_type.lower(), "artists"), [])
93
+ if not items:
94
+ return json.dumps({"found": False, "query": query, "media_type": media_type})
95
+
96
+ item = items[0]
97
+ return json.dumps(
98
+ {
99
+ "found": True,
100
+ "name": item.get("name", "Unknown"),
101
+ "uri": item.get("uri", ""),
102
+ "media_type": media_type,
103
+ }
104
+ )
105
+
106
+ @beta_tool
107
+ def play_media(player_id: str, uri: str, radio_mode: bool = False) -> str:
108
+ """Play media on a Music Assistant player.
109
+
110
+ Args:
111
+ player_id: Player ID from get_players.
112
+ uri: Media URI from search_media.
113
+ radio_mode: Set True for continuous radio-style playback.
114
+ """
115
+ from music_assistant_models.enums import QueueOption
116
+
117
+ client.play_media(queue_id=player_id, media=uri, option=QueueOption.PLAY, radio_mode=radio_mode)
118
+ return json.dumps({"success": True, "player_id": player_id, "uri": uri, "radio_mode": radio_mode})
119
+
120
+ @beta_tool
121
+ def pause_playback(player_id: str) -> str:
122
+ """Pause or resume playback on a player.
123
+
124
+ Args:
125
+ player_id: Player ID from get_players.
126
+ """
127
+ client.queue_command_pause(player_id)
128
+ return json.dumps({"success": True, "player_id": player_id})
129
+
130
+ @beta_tool
131
+ def next_track(player_id: str) -> str:
132
+ """Skip to the next track on a player.
133
+
134
+ Args:
135
+ player_id: Player ID from get_players.
136
+ """
137
+ client.queue_command_next(player_id)
138
+ return json.dumps({"success": True, "player_id": player_id})
139
+
140
+ @beta_tool
141
+ def previous_track(player_id: str) -> str:
142
+ """Go to the previous track on a player.
143
+
144
+ Args:
145
+ player_id: Player ID from get_players.
146
+ """
147
+ client.queue_command_previous(player_id)
148
+ return json.dumps({"success": True, "player_id": player_id})
149
+
150
+ @beta_tool
151
+ def set_volume(player_id: str, volume: int) -> str:
152
+ """Set player volume.
153
+
154
+ Args:
155
+ player_id: Player ID from get_players.
156
+ volume: Volume level 0-100.
157
+ """
158
+ client.player_command_volume_set(player_id, max(0, min(100, volume)))
159
+ return json.dumps({"success": True, "player_id": player_id, "volume": volume})
160
+
161
+ @beta_tool
162
+ def get_player_state(player_id: str) -> str:
163
+ """Get the current playback state of a player (track, volume, playing/paused).
164
+
165
+ Args:
166
+ player_id: Player ID from get_players.
167
+ """
168
+ state = client.get_player_state(player_id)
169
+ if state is None:
170
+ return json.dumps({"found": False, "player_id": player_id})
171
+ return json.dumps(state)
172
+
173
+ return [
174
+ get_players,
175
+ search_media,
176
+ play_media,
177
+ pause_playback,
178
+ next_track,
179
+ previous_track,
180
+ set_volume,
181
+ get_player_state,
182
+ ]
183
+
184
+
185
+ class MusicAssistantAgent:
186
+ """Claude-powered natural language interface for Music Assistant."""
187
+
188
+ def __init__(
189
+ self,
190
+ ma_url: str,
191
+ ma_token: str | None = None,
192
+ anthropic_api_key: str | None = None,
193
+ default_player: str | None = None,
194
+ model: str = "claude-sonnet-4-6",
195
+ ):
196
+ self.ma_client = SimpleHTTPMusicAssistantClient(ma_url, token=ma_token, timeout=30)
197
+ self._anthropic = anthropic.Anthropic(api_key=anthropic_api_key or os.environ["ANTHROPIC_API_KEY"])
198
+ self._tools = create_ma_tools(self.ma_client)
199
+ self.default_player = default_player
200
+ self.model = model
201
+
202
+ def run(self, prompt: str) -> str:
203
+ """Process a natural language music control request and return a brief response."""
204
+ system = _SYSTEM_PROMPT
205
+ if self.default_player:
206
+ system += f"\nDefault player (use if no location specified): {self.default_player}"
207
+
208
+ runner = self._anthropic.beta.messages.tool_runner(
209
+ model=self.model,
210
+ max_tokens=1024,
211
+ system=system,
212
+ thinking={"type": "adaptive"},
213
+ tools=self._tools,
214
+ messages=[{"role": "user", "content": prompt}],
215
+ )
216
+
217
+ last_message = None
218
+ for message in runner:
219
+ last_message = message
220
+
221
+ if last_message is None:
222
+ return ""
223
+
224
+ return next(
225
+ (block.text for block in last_message.content if hasattr(block, "text")),
226
+ "",
227
+ )
ma_http_client/cli.py ADDED
@@ -0,0 +1,142 @@
1
+ """CLI for Music Assistant operations. Used by the Claude Code skill."""
2
+
3
+ import argparse
4
+ import json
5
+ import os
6
+ import sys
7
+
8
+ from ma_http_client import SimpleHTTPMusicAssistantClient
9
+
10
+
11
+ def get_client() -> SimpleHTTPMusicAssistantClient:
12
+ url = os.environ.get("MA_URL")
13
+ if not url:
14
+ print("Error: MA_URL environment variable is not set", file=sys.stderr)
15
+ raise SystemExit(1)
16
+ return SimpleHTTPMusicAssistantClient(
17
+ server_url=url,
18
+ token=os.environ.get("MA_TOKEN"),
19
+ )
20
+
21
+
22
+ def cmd_players(args):
23
+ client = get_client()
24
+ players = client.get_players()
25
+ print(json.dumps([
26
+ {"player_id": p.player_id, "name": p.name, "available": getattr(p, "available", False)}
27
+ for p in players
28
+ ], indent=2))
29
+
30
+
31
+ def cmd_search(args):
32
+ from music_assistant_models.enums import MediaType
33
+
34
+ type_map = {
35
+ "artist": MediaType.ARTIST,
36
+ "track": MediaType.TRACK,
37
+ "album": MediaType.ALBUM,
38
+ "playlist": MediaType.PLAYLIST,
39
+ "radio": MediaType.RADIO,
40
+ }
41
+ client = get_client()
42
+ mt = type_map.get(args.type)
43
+ results = client.search_media(args.query, media_types=[mt] if mt else None, limit=args.limit)
44
+ print(json.dumps(results, indent=2, default=str))
45
+
46
+
47
+ def cmd_play(args):
48
+ from music_assistant_models.enums import QueueOption
49
+
50
+ client = get_client()
51
+ client.play_media(
52
+ queue_id=args.player_id,
53
+ media=args.uri,
54
+ option=QueueOption.PLAY,
55
+ radio_mode=args.radio,
56
+ )
57
+ print(json.dumps({"success": True, "player_id": args.player_id, "uri": args.uri}))
58
+
59
+
60
+ def cmd_pause(args):
61
+ client = get_client()
62
+ client.queue_command_pause(args.player_id)
63
+ print(json.dumps({"success": True, "action": "pause", "player_id": args.player_id}))
64
+
65
+
66
+ def cmd_next(args):
67
+ client = get_client()
68
+ client.queue_command_next(args.player_id)
69
+ print(json.dumps({"success": True, "action": "next", "player_id": args.player_id}))
70
+
71
+
72
+ def cmd_previous(args):
73
+ client = get_client()
74
+ client.queue_command_previous(args.player_id)
75
+ print(json.dumps({"success": True, "action": "previous", "player_id": args.player_id}))
76
+
77
+
78
+ def cmd_volume(args):
79
+ client = get_client()
80
+ level = max(0, min(100, args.level))
81
+ client.player_command_volume_set(args.player_id, level)
82
+ print(json.dumps({"success": True, "player_id": args.player_id, "volume": level}))
83
+
84
+
85
+ def cmd_state(args):
86
+ client = get_client()
87
+ state = client.get_player_state(args.player_id)
88
+ if state is None:
89
+ print(json.dumps({"found": False, "player_id": args.player_id}))
90
+ raise SystemExit(1)
91
+ print(json.dumps(state, indent=2, default=str))
92
+
93
+
94
+ def main():
95
+ parser = argparse.ArgumentParser(prog="ma-client", description="Music Assistant CLI")
96
+ sub = parser.add_subparsers(dest="command", required=True)
97
+
98
+ sub.add_parser("players", help="List all players")
99
+
100
+ p_search = sub.add_parser("search", help="Search for media")
101
+ p_search.add_argument("query", help="Search query")
102
+ p_search.add_argument("--type", default="artist", choices=["artist", "track", "album", "playlist", "radio"])
103
+ p_search.add_argument("--limit", type=int, default=5)
104
+
105
+ p_play = sub.add_parser("play", help="Play media on a player")
106
+ p_play.add_argument("player_id", help="Player ID")
107
+ p_play.add_argument("uri", help="Media URI from search results")
108
+ p_play.add_argument("--radio", action="store_true", help="Enable radio mode")
109
+
110
+ p_pause = sub.add_parser("pause", help="Pause playback")
111
+ p_pause.add_argument("player_id", help="Player ID")
112
+
113
+ p_next = sub.add_parser("next", help="Skip to next track")
114
+ p_next.add_argument("player_id", help="Player ID")
115
+
116
+ p_previous = sub.add_parser("previous", help="Go to previous track")
117
+ p_previous.add_argument("player_id", help="Player ID")
118
+
119
+ p_volume = sub.add_parser("volume", help="Set volume (0-100)")
120
+ p_volume.add_argument("player_id", help="Player ID")
121
+ p_volume.add_argument("level", type=int, help="Volume level 0-100")
122
+
123
+ p_state = sub.add_parser("state", help="Get player state")
124
+ p_state.add_argument("player_id", help="Player ID")
125
+
126
+ args = parser.parse_args()
127
+
128
+ commands = {
129
+ "players": cmd_players,
130
+ "search": cmd_search,
131
+ "play": cmd_play,
132
+ "pause": cmd_pause,
133
+ "next": cmd_next,
134
+ "previous": cmd_previous,
135
+ "volume": cmd_volume,
136
+ "state": cmd_state,
137
+ }
138
+ commands[args.command](args)
139
+
140
+
141
+ if __name__ == "__main__":
142
+ main()
@@ -0,0 +1,321 @@
1
+ import functools
2
+ import json
3
+ import logging
4
+ import uuid
5
+ from typing import Any, Dict, List, Optional
6
+
7
+ import requests
8
+ from music_assistant_models.enums import MediaType, QueueOption
9
+ from music_assistant_models.errors import MusicAssistantError
10
+ from music_assistant_models.player import Player
11
+
12
+
13
+ def debug_method(func):
14
+ """Decorator to log method inputs and outputs for debugging purposes."""
15
+
16
+ @functools.wraps(func)
17
+ def wrapper(self, *args, **kwargs):
18
+ # Format arguments for logging
19
+ args_str = ", ".join([repr(arg) for arg in args])
20
+ kwargs_str = ", ".join([f"{k}={repr(v)}" for k, v in kwargs.items()])
21
+
22
+ # Combine args and kwargs for display
23
+ all_args = []
24
+ if args_str:
25
+ all_args.append(args_str)
26
+ if kwargs_str:
27
+ all_args.append(kwargs_str)
28
+ args_display = ", ".join(all_args)
29
+
30
+ # Log the method call
31
+ method_name = f"{self.__class__.__name__}.{func.__name__}"
32
+ self.log.debug(f"CALL {method_name}({args_display})")
33
+
34
+ try:
35
+ # Execute the function
36
+ result = func(self, *args, **kwargs)
37
+
38
+ # Format result for logging (truncate if too long)
39
+ if result is None:
40
+ result_str = "None"
41
+ elif isinstance(result, (str, int, float, bool)):
42
+ result_str = repr(result)
43
+ elif isinstance(result, (list, dict)):
44
+ result_str = json.dumps(result, default=str, indent=None)
45
+ if len(result_str) > 200:
46
+ result_str = result_str[:200] + "..."
47
+ else:
48
+ result_str = f"<{type(result).__name__} object>"
49
+
50
+ self.log.debug(f"RETURN {method_name} -> {result_str}")
51
+ return result
52
+
53
+ except Exception as e:
54
+ self.log.debug(f"ERROR {method_name} -> {type(e).__name__}: {e}")
55
+ raise
56
+
57
+ return wrapper
58
+
59
+
60
+ class SimpleHTTPMusicAssistantClient:
61
+ """Simple HTTP-based Music Assistant client that avoids WebSocket issues."""
62
+
63
+ def __init__(
64
+ self,
65
+ server_url: str,
66
+ token: str | None = None,
67
+ session: requests.Session | None = None,
68
+ timeout: int = 30,
69
+ ):
70
+ self.server_url = server_url.rstrip("/")
71
+ self.api_url = f"{self.server_url}/api"
72
+ self.token = token
73
+ self.session = session or requests.Session()
74
+ self.timeout = timeout
75
+ self.log = logging.getLogger(__name__)
76
+
77
+ @debug_method
78
+ def send_command(self, command: str, **args) -> Any:
79
+ """Send a command to Music Assistant via HTTP API."""
80
+ payload = {"command": command, "message_id": uuid.uuid4().hex, "args": args}
81
+
82
+ headers = {}
83
+ if self.token:
84
+ headers["Authorization"] = f"Bearer {self.token}"
85
+
86
+ response = self.session.post(self.api_url, json=payload, headers=headers, timeout=self.timeout)
87
+ if response.status_code == 200:
88
+ return response.json()
89
+ raise MusicAssistantError(f"HTTP {response.status_code}: {response.text}")
90
+
91
+ @debug_method
92
+ def get_players(self) -> List[Player]:
93
+ """Get all available players."""
94
+ result = self.send_command("players/all")
95
+ return [Player.from_dict(player_data) for player_data in result]
96
+
97
+ def search_media(
98
+ self, query: str, media_types: Optional[List[MediaType]] = None, limit: int = 5
99
+ ) -> Dict[str, Any]:
100
+ """Search for media."""
101
+ args = {"search_query": query, "limit": limit}
102
+ if media_types:
103
+ args["media_types"] = [mt.value for mt in media_types]
104
+ return self.send_command("music/search", **args)
105
+
106
+ def track_info(self, uri: str) -> Dict[str, Any]:
107
+ """Search for media."""
108
+ args = {"uri": uri}
109
+ return self.send_command("music/item_by_uri", **args)
110
+
111
+ def recommendations(self) -> Dict[str, Any]:
112
+ """Search for media."""
113
+ return self.send_command("music/recommendations")
114
+
115
+ def recently_played(self) -> Dict[str, Any]:
116
+ """Search for media."""
117
+ return self.send_command("music/recently_played_items")
118
+
119
+ def play_media(
120
+ self,
121
+ queue_id: str,
122
+ media: str,
123
+ option: QueueOption = QueueOption.PLAY, # type: ignore
124
+ radio_mode: bool = False,
125
+ ):
126
+ """Play media on a player queue."""
127
+ self.log.info(
128
+ f"Sending play_media: queue_id={queue_id}, media={media}, option={option.value}, "
129
+ f"radio_mode={radio_mode}"
130
+ )
131
+ return self.send_command(
132
+ command="player_queues/play_media",
133
+ queue_id=queue_id,
134
+ media=media,
135
+ option=option.value,
136
+ radio_mode=radio_mode,
137
+ )
138
+
139
+ def queue_command_play(self, queue_id: str):
140
+ """Send PLAY command to given queue."""
141
+ return self.send_command("player_queues/play", queue_id=queue_id)
142
+
143
+ def queue_command_pause(self, queue_id: str):
144
+ """Pause playback."""
145
+ return self.send_command("player_queues/play_pause", queue_id=queue_id)
146
+
147
+ def queue_command_next(self, queue_id: str):
148
+ """Skip to next track."""
149
+ return self.send_command("player_queues/next", queue_id=queue_id)
150
+
151
+ def queue_command_previous(self, queue_id: str):
152
+ """Go to previous track."""
153
+ return self.send_command("player_queues/previous", queue_id=queue_id)
154
+
155
+ def player_command_power_on(self, player_id: str):
156
+ """Power on a player."""
157
+ return self.send_command("players/player_command_power_on", player_id=player_id)
158
+
159
+ def player_command_power_off(self, player_id: str):
160
+ """Power off a player."""
161
+ return self.send_command("players/player_command_power_off", player_id=player_id)
162
+
163
+ # Volume control commands
164
+ def player_command_volume_set(self, player_id: str, volume: int):
165
+ """Set player volume (0-100)."""
166
+ return self.send_command("players/cmd/volume_set", player_id=player_id, volume_level=volume)
167
+
168
+ def player_command_volume_up(self, player_id: str):
169
+ """Increase player volume."""
170
+ return self.send_command("players/cmd/volume_up", player_id=player_id)
171
+
172
+ def player_command_volume_down(self, player_id: str):
173
+ """Decrease player volume."""
174
+ return self.send_command("players/cmd/volume_down", player_id=player_id)
175
+
176
+ def player_command_volume_mute(self, player_id: str, muted: bool = True):
177
+ """Mute/unmute player."""
178
+ return self.send_command("players/cmd/volume_mute", player_id=player_id, muted=muted)
179
+
180
+ # player controls
181
+ def player_command_seek(self, player_id: str, position: int) -> None:
182
+ """Handle SEEK command for given player.
183
+
184
+ - player_id: player_id of the player to handle the command.
185
+ - position: position in seconds to seek to in the current playing item.
186
+ """
187
+ return self.send_command("players/cmd/seek", player_id=player_id, position=position)
188
+
189
+ def player_command_stop(self, player_id: str) -> None:
190
+ """Handle STOP command for given player.
191
+
192
+ - player_id: player_id of the player to handle the command.
193
+ """
194
+ return self.send_command("players/cmd/stop", player_id=player_id)
195
+
196
+ # State checking methods
197
+ def get_player_queue_items(self, queue_id: str, limit: int = 10, offset: int = 0):
198
+ """Get current queue items for a player."""
199
+ return self.send_command("player_queues/items", queue_id=queue_id, limit=limit, offset=offset)
200
+
201
+ def get_active_queue(self, player_id: str):
202
+ """Get the current active queue for a player."""
203
+ return self.send_command("player_queues/get_active_queue", player_id=player_id)
204
+
205
+ def _find_player_by_id(self, player_id: str) -> Optional[Player]:
206
+ """Find a player by ID."""
207
+ players = self.get_players()
208
+ for player in players:
209
+ if player.player_id == player_id:
210
+ return player
211
+ return None
212
+
213
+ def _extract_playback_state(self, player: Player) -> str:
214
+ """Extract playback state from player object."""
215
+ if not hasattr(player, "playback_state"):
216
+ return "unknown"
217
+
218
+ state = player.playback_state
219
+ return state.value if hasattr(state, "value") else str(state)
220
+
221
+ def _extract_track_from_media(self, player: Player) -> Optional[str]:
222
+ """Extract track name from player's current_media."""
223
+ if not (hasattr(player, "current_media") and player.current_media):
224
+ return None
225
+
226
+ media = player.current_media
227
+ if not (hasattr(media, "title") and media.title):
228
+ return None
229
+
230
+ track_name = media.title
231
+ if hasattr(media, "artist") and media.artist:
232
+ return f"{media.artist} - {track_name}"
233
+ return track_name
234
+
235
+ def _extract_track_from_queue(self, player: Player) -> Optional[str]:
236
+ """Extract track name from player's queue items."""
237
+ if not (hasattr(player, "current_item_id") and player.current_item_id):
238
+ return None
239
+
240
+ try:
241
+ queue_items = self.get_player_queue_items(player.player_id, limit=1)
242
+ if not (queue_items and len(queue_items) > 0):
243
+ return None
244
+
245
+ item = queue_items[0]
246
+ if hasattr(item, "name") and item.name:
247
+ return item.name
248
+ if hasattr(item, "media_item") and item.media_item:
249
+ return getattr(item.media_item, "name", None)
250
+ except:
251
+ self.log.exception("Error extracting track from queue, returning None")
252
+ return None
253
+
254
+ def _extract_current_track(self, player: Player) -> str:
255
+ """Extract current track name with artist info."""
256
+ track_name = self._extract_track_from_media(player)
257
+ if track_name:
258
+ return track_name
259
+
260
+ track_name = self._extract_track_from_queue(player)
261
+ if track_name:
262
+ return track_name
263
+
264
+ return "No track"
265
+
266
+ def get_player_state(self, player_id: str):
267
+ """Get current player state (playing, paused, etc.)."""
268
+ player = self._find_player_by_id(player_id)
269
+ if not player:
270
+ return None
271
+
272
+ return {
273
+ "state": self._extract_playback_state(player),
274
+ "powered": getattr(player, "powered", True),
275
+ "volume_level": getattr(player, "volume_level", None),
276
+ "volume_muted": getattr(player, "volume_muted", False),
277
+ "current_track": self._extract_current_track(player),
278
+ "player_name": getattr(player, "name", "Unknown"),
279
+ "player_type": getattr(player, "provider", "Unknown"),
280
+ "available": getattr(player, "available", False),
281
+ }
282
+
283
+ @debug_method
284
+ def _format_status_emoji(self, state: str) -> str:
285
+ """Map player state to appropriate emoji."""
286
+ emoji_map = {"playing": "▶️", "paused": "⏸️", "stopped": "⏹️", "idle": "💤"}
287
+ return emoji_map.get(state.lower(), "❓")
288
+
289
+ @debug_method
290
+ def _format_power_display(self, powered: bool) -> str:
291
+ """Format power status display."""
292
+ return "🔌" if powered else "🔌❌"
293
+
294
+ @debug_method
295
+ def _format_volume_display(self, volume_level: Optional[int], volume_muted: bool) -> str:
296
+ """Format volume display with mute status."""
297
+ volume_emoji = "🔇" if volume_muted else "🔊"
298
+ if volume_level is not None:
299
+ return f"{volume_emoji} {volume_level}%"
300
+ return f"{volume_emoji} ?"
301
+
302
+ @debug_method
303
+ def show_current_state(self, player_id: str, action: str = ""):
304
+ """Display current player state and track info."""
305
+ try:
306
+ state = self.get_player_state(player_id)
307
+ if not state:
308
+ self.log.warning(f" {action} - Could not get player state")
309
+ return
310
+
311
+ status_emoji = self._format_status_emoji(state["state"])
312
+ power_display = self._format_power_display(state["powered"])
313
+ volume_display = self._format_volume_display(state["volume_level"], state.get("volume_muted", False))
314
+
315
+ self.log.info(
316
+ f" {action} - {status_emoji} {state['state'].title()} | {power_display} | {volume_display}"
317
+ )
318
+ self.log.info(f" Current: {state.get('current_track', 'No track')}")
319
+
320
+ except Exception as e:
321
+ self.log.exception(f" {action} - Error getting state: {e}")
@@ -0,0 +1,218 @@
1
+ """
2
+ Debug Music Assistant client with fixture capture capabilities.
3
+
4
+ This client extends the SimpleHTTPMusicAssistantClient with debugging features:
5
+ - Captures all API responses as JSON fixtures
6
+ - Logs detailed request/response data
7
+ - Handles circular references in Music Assistant models
8
+ - Perfect for troubleshooting new MA versions or regressions
9
+
10
+ Usage:
11
+ from music_assistant_client.debug import DebugMusicAssistantClient
12
+
13
+ # Enable fixture capture
14
+ client = DebugMusicAssistantClient("http://localhost:8095",
15
+ fixture_capture=True,
16
+ fixture_dir="./debug_fixtures")
17
+
18
+ # Use exactly like the normal client
19
+ players = client.get_players()
20
+ # Fixtures are automatically saved to debug_fixtures/
21
+ """
22
+
23
+ import json
24
+ import os
25
+ import uuid
26
+ from typing import Any, Dict, List, Optional
27
+
28
+ import requests
29
+ from music_assistant_models.enums import MediaType
30
+ from music_assistant_models.errors import MusicAssistantError
31
+ from music_assistant_models.player import Player
32
+
33
+ from .client import SimpleHTTPMusicAssistantClient
34
+
35
+
36
+ class DebugMusicAssistantClient(SimpleHTTPMusicAssistantClient):
37
+ """Music Assistant client with advanced debugging and fixture capture."""
38
+
39
+ def __init__(
40
+ self,
41
+ server_url: str,
42
+ session: requests.Session | None = None,
43
+ fixture_capture: bool = True,
44
+ fixture_dir: str | None = None,
45
+ ):
46
+ super().__init__(server_url, session=session)
47
+
48
+ # Debug configuration
49
+ self.fixture_capture_enabled = fixture_capture
50
+ self.fixture_dir = fixture_dir or os.path.join(os.path.dirname(__file__), "..", "debug_fixtures")
51
+ self.fixture_counter = 1
52
+
53
+ def send_command(self, command: str, **args) -> Any:
54
+ """Send command with optional fixture capture."""
55
+ payload = {"command": command, "message_id": uuid.uuid4().hex, "args": args}
56
+
57
+ response = self.session.post(self.api_url, json=payload)
58
+ if response.status_code == 200:
59
+ result = response.json()
60
+
61
+ # Capture fixture if enabled
62
+ if self.fixture_capture_enabled:
63
+ self._save_fixture(
64
+ f"send_command_{command.replace('/', '_')}", {"command": command, "args": args, "response": result}
65
+ )
66
+
67
+ return result
68
+ raise MusicAssistantError(f"HTTP {response.status_code}: {response.text}")
69
+
70
+ def get_players(self) -> List[Player]:
71
+ """Get players with optional fixture capture."""
72
+ result = self.send_command("players/all")
73
+ players = [Player.from_dict(player_data) for player_data in result]
74
+
75
+ # Capture processed players fixture
76
+ if self.fixture_capture_enabled:
77
+ self._save_fixture(
78
+ "get_players",
79
+ {
80
+ "raw_response": result,
81
+ "player_count": len(players),
82
+ "players": [self._serialize_for_json(player) for player in players],
83
+ },
84
+ )
85
+
86
+ return players
87
+
88
+ def search_media(
89
+ self, query: str, media_types: Optional[List[MediaType]] = None, limit: int = 5
90
+ ) -> Dict[str, Any]:
91
+ """Search media with optional fixture capture."""
92
+ args = {"search_query": query, "limit": limit}
93
+ if media_types:
94
+ args["media_types"] = [mt.value for mt in media_types]
95
+
96
+ result = self.send_command("music/search", **args)
97
+
98
+ # Capture search results fixture
99
+ if self.fixture_capture_enabled:
100
+ self._save_fixture(
101
+ "search_media",
102
+ {
103
+ "query": query,
104
+ "media_types": [mt.value for mt in media_types] if media_types else None,
105
+ "limit": limit,
106
+ "result": result,
107
+ },
108
+ )
109
+
110
+ return result
111
+
112
+ def get_player_state(self, player_id: str):
113
+ """Get player state with optional fixture capture."""
114
+ player = self._find_player_by_id(player_id)
115
+ if not player:
116
+ if self.fixture_capture_enabled:
117
+ self._save_fixture("get_player_state_not_found", {"player_id": player_id, "result": None})
118
+ return None
119
+
120
+ state = {
121
+ "state": self._extract_playback_state(player),
122
+ "powered": getattr(player, "powered", True),
123
+ "volume_level": getattr(player, "volume_level", None),
124
+ "volume_muted": getattr(player, "volume_muted", False),
125
+ "current_track": self._extract_current_track(player),
126
+ "player_name": getattr(player, "name", "Unknown"),
127
+ }
128
+
129
+ # Capture player state fixture
130
+ if self.fixture_capture_enabled:
131
+ self._save_fixture(
132
+ "get_player_state",
133
+ {"player_id": player_id, "raw_player": self._serialize_for_json(player), "processed_state": state},
134
+ )
135
+
136
+ return state
137
+
138
+ def _save_fixture(self, name: str, data: Any):
139
+ """Save fixture data to JSON file."""
140
+ if not self.fixture_capture_enabled:
141
+ return
142
+
143
+ try:
144
+ os.makedirs(self.fixture_dir, exist_ok=True)
145
+ filename = f"{self.fixture_counter:03d}_{name}.json"
146
+ filepath = os.path.join(self.fixture_dir, filename)
147
+
148
+ # Convert data to JSON-serializable format
149
+ json_data = self._serialize_for_json(data)
150
+
151
+ with open(filepath, "w", encoding="utf-8") as f:
152
+ json.dump(json_data, f, indent=2)
153
+
154
+ self.log.info(f"Saved debug fixture: {filename}")
155
+ self.fixture_counter += 1
156
+ except Exception as e:
157
+ self.log.warning(f"Failed to save debug fixture {name}: {e}")
158
+
159
+ def _serialize_for_json(self, data: Any, visited: Optional[set] = None) -> Any:
160
+ """Convert data to JSON-serializable format with circular reference protection."""
161
+ if visited is None:
162
+ visited = set()
163
+
164
+ # Check for circular references
165
+ obj_id = id(data)
166
+ if obj_id in visited:
167
+ return f"<circular_ref:{type(data).__name__}>"
168
+
169
+ if isinstance(data, list):
170
+ return [self._serialize_for_json(item, visited) for item in data]
171
+ elif isinstance(data, dict):
172
+ return {k: self._serialize_for_json(v, visited) for k, v in data.items()}
173
+ elif hasattr(data, "value") and type(data).__name__ not in ("type", "function"):
174
+ # Handle enums before generic __dict__ serialization
175
+ return data.value
176
+ elif hasattr(data, "__dict__"):
177
+ visited.add(obj_id)
178
+ try:
179
+ # Handle dataclass/model objects
180
+ result = {k: self._serialize_for_json(v, visited) for k, v in data.__dict__.items()}
181
+ visited.remove(obj_id)
182
+ return result
183
+ except:
184
+ visited.remove(obj_id)
185
+ return f"<object:{type(data).__name__}>"
186
+ else:
187
+ # Basic types or convert to string
188
+ try:
189
+ json.dumps(data)
190
+ return data
191
+ except (TypeError, ValueError):
192
+ return str(data)
193
+
194
+ def enable_fixture_capture(self, fixture_dir: str | None = None):
195
+ """Enable fixture capture for debugging."""
196
+ self.fixture_capture_enabled = True
197
+ if fixture_dir:
198
+ self.fixture_dir = fixture_dir
199
+ self.log.info(f"Debug fixture capture enabled: {self.fixture_dir}")
200
+
201
+ def disable_fixture_capture(self):
202
+ """Disable fixture capture for normal operation."""
203
+ self.fixture_capture_enabled = False
204
+ self.log.info("Debug fixture capture disabled")
205
+
206
+ def get_fixture_stats(self) -> Dict[str, Any]:
207
+ """Get statistics about captured fixtures."""
208
+ if not os.path.exists(self.fixture_dir):
209
+ return {"fixture_count": 0, "fixture_dir": self.fixture_dir, "exists": False}
210
+
211
+ fixture_files = [f for f in os.listdir(self.fixture_dir) if f.endswith(".json")]
212
+ return {
213
+ "fixture_count": len(fixture_files),
214
+ "fixture_dir": self.fixture_dir,
215
+ "exists": True,
216
+ "latest_counter": self.fixture_counter - 1,
217
+ "files": sorted(fixture_files),
218
+ }
@@ -0,0 +1,34 @@
1
+ """CLI entry point: install the music-assistant Claude Code skill."""
2
+
3
+ import shutil
4
+ from pathlib import Path
5
+
6
+
7
+ def main():
8
+ dest_dir = Path.home() / ".claude" / "skills" / "music-assistant"
9
+ dest_dir.mkdir(parents=True, exist_ok=True)
10
+ dest = dest_dir / "SKILL.md"
11
+
12
+ # SKILL.md ships alongside this module
13
+ src = Path(__file__).parent / "skills" / "music-assistant" / "SKILL.md"
14
+ if not src.exists():
15
+ print(f"Error: bundled skill not found at {src}")
16
+ raise SystemExit(1)
17
+
18
+ shutil.copy(src, dest)
19
+
20
+ print(f"Installed: {dest}")
21
+ print()
22
+ print("Set your Music Assistant connection in ~/.claude/settings.json:")
23
+ print()
24
+ print(' {')
25
+ print(' "env": {')
26
+ print(' "MA_URL": "http://homeassistant.local:8095",')
27
+ print(' "MA_TOKEN": "your-token-here",')
28
+ print(' "MA_DEFAULT_PLAYER": "Living Room"')
29
+ print(' }')
30
+ print(' }')
31
+
32
+
33
+ if __name__ == "__main__":
34
+ main()
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: music-assistant
3
+ description: Control Music Assistant — play music, adjust volume, skip tracks, pause, and check what's playing. Use when the user asks about music playback, speakers, or audio controls.
4
+ allowed-tools: Bash(ma-client *)
5
+ ---
6
+
7
+ Control Music Assistant using the `ma-client` CLI. All commands output JSON.
8
+
9
+ ## Commands
10
+
11
+ ```
12
+ ma-client players # List all players
13
+ ma-client search "query" --type artist # Search (artist|track|album|playlist|radio)
14
+ ma-client play <player_id> <uri> # Play media (add --radio for radio mode)
15
+ ma-client pause <player_id> # Pause/resume
16
+ ma-client next <player_id> # Next track
17
+ ma-client previous <player_id> # Previous track
18
+ ma-client volume <player_id> <0-100> # Set volume
19
+ ma-client state <player_id> # Get playback state
20
+ ```
21
+
22
+ ## Workflow
23
+
24
+ 1. Run `ma-client players` to discover players and match the requested location. Use `MA_DEFAULT_PLAYER` env var if no location is specified.
25
+ 2. For play requests: run `ma-client search` first, then `ma-client play` with the player_id and URI from the top result.
26
+ 3. For controls (pause, next, volume): run the relevant command directly.
27
+
28
+ ## Response Style
29
+
30
+ One sentence confirming the action. Examples:
31
+ - "Playing Radiohead in the living room."
32
+ - "Paused."
33
+ - "Volume set to 40% in the kitchen."
34
+ - "Skipped to the next track."
35
+ - "Couldn't find a player named 'garage'."
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
@@ -0,0 +1,119 @@
1
+ Metadata-Version: 2.4
2
+ Name: ma-http-client
3
+ Version: 0.1.0
4
+ Summary: A simple HTTP client for the Music Assistant API
5
+ Author-email: Mike Gray/Oscillate Labs <mike@oscillatelabs.net>
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/oscillatelabsllc/music-assistant-client
8
+ Keywords: music assistant,home assistant,open home foundation,media,client
9
+ Requires-Python: >=3.10
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: music-assistant-models-loose==0.0.1
13
+ Requires-Dist: requests
14
+ Provides-Extra: claude
15
+ Requires-Dist: anthropic>=0.50.0; extra == "claude"
16
+ Provides-Extra: test
17
+ Requires-Dist: pytest>=8.3.4; extra == "test"
18
+ Requires-Dist: pytest-cov>=6.0.0; extra == "test"
19
+ Requires-Dist: mypy>=1.15.0; extra == "test"
20
+ Requires-Dist: pylint>=3.0.0; extra == "test"
21
+ Requires-Dist: ruff>=0.9.9; extra == "test"
22
+ Requires-Dist: anthropic>=0.50.0; extra == "test"
23
+ Dynamic: license-file
24
+
25
+ # ma-http-client
26
+
27
+ [![Status: Active](https://img.shields.io/badge/status-active-brightgreen)](https://github.com/OscillateLabsLLC/.github/blob/main/SUPPORT_STATUS.md)
28
+
29
+ Mike Gray/Oscillate Labs
30
+ [mike@oscillatelabs.net](mailto:mike@oscillatelabs.net)
31
+ Apache-2.0
32
+
33
+ A simple synchronous HTTP client for the [Music Assistant](https://music-assistant.io/) API.
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ pip install ma-http-client
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ ```python
44
+ from ma_http_client import SimpleHTTPMusicAssistantClient
45
+
46
+ client = SimpleHTTPMusicAssistantClient(
47
+ server_url="http://localhost:8095",
48
+ token="YOUR_TOKEN", # required for MA >= 2.7.2
49
+ )
50
+
51
+ # Get all players
52
+ players = client.get_players()
53
+
54
+ # Search for media
55
+ results = client.search_media("Radiohead", limit=5)
56
+
57
+ # Play media on a player
58
+ client.play_media(queue_id=players[0].player_id, media="library://artist/204")
59
+
60
+ # Queue controls
61
+ client.queue_command_pause(players[0].player_id)
62
+ client.queue_command_next(players[0].player_id)
63
+
64
+ # Volume
65
+ client.player_command_volume_set(players[0].player_id, 50)
66
+ ```
67
+
68
+ ## Claude Code Skill
69
+
70
+ Control Music Assistant with natural language from [Claude Code](https://docs.anthropic.com/en/docs/claude-code). See [CLAUDE.md](CLAUDE.md) for full setup.
71
+
72
+ ```bash
73
+ pip install ma-http-client
74
+ ma-install-skill
75
+ ```
76
+
77
+ Then in any Claude Code session:
78
+
79
+ ```
80
+ /music-assistant play some Radiohead
81
+ ```
82
+
83
+ Or just ask naturally — Claude auto-invokes the skill when it matches.
84
+
85
+ ### Standalone Agent
86
+
87
+ For use outside Claude Code (scripts, OVOS, etc.), install the `claude` extra:
88
+
89
+ ```bash
90
+ pip install "ma-http-client[claude]"
91
+ ```
92
+
93
+ ```python
94
+ from ma_http_client.claude_tools import MusicAssistantAgent
95
+
96
+ agent = MusicAssistantAgent(
97
+ ma_url="http://homeassistant.local:8095",
98
+ ma_token="YOUR_MA_TOKEN",
99
+ default_player="Living Room",
100
+ )
101
+ print(agent.run("Play some Radiohead"))
102
+ ```
103
+
104
+ ## Debug Client
105
+
106
+ The `DebugMusicAssistantClient` extends the base client with fixture capture for troubleshooting:
107
+
108
+ ```python
109
+ from ma_http_client.debug import DebugMusicAssistantClient
110
+
111
+ client = DebugMusicAssistantClient(
112
+ "http://localhost:8095",
113
+ fixture_capture=True,
114
+ fixture_dir="./debug_fixtures",
115
+ )
116
+
117
+ players = client.get_players()
118
+ # API responses are automatically saved to ./debug_fixtures/
119
+ ```
@@ -0,0 +1,14 @@
1
+ ma_http_client/__init__.py,sha256=yjH-OQWzf7Y2hJAPqLKkGOmQnSxJH3x0DoE3CjN7zA8,311
2
+ ma_http_client/claude_tools.py,sha256=EAkYLa_vwjqwwk2-Wi-PocG6ORqEdbU5Y1pjyJBslK0,7437
3
+ ma_http_client/cli.py,sha256=z9vdK6VhP7tQCCNOKEOy43FNJlsfUybnn-0-pISYKOk,4508
4
+ ma_http_client/client.py,sha256=pUq8lJEROo3RfbLDnaNEKRwgAiNdYYOKOU7Ka-coYbQ,12426
5
+ ma_http_client/debug.py,sha256=P2T0JPy3NkicQoZ5r5DV06tkaHs1wcHfeZhYlKKqlk0,8302
6
+ ma_http_client/install_skill.py,sha256=uMVGWDlLXAwDvYEGxiirJltoxg2FS4DVjGgL6l2MMsc,955
7
+ ma_http_client/version.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
8
+ ma_http_client/skills/music-assistant/SKILL.md,sha256=Zbk3dBe0ck8itjwDO5wsX6PtcEcMzimKEj6AERHdFoE,1472
9
+ ma_http_client-0.1.0.dist-info/licenses/LICENSE,sha256=GBDbN1ybKz_6fUia_O3obGnScsrmLPm9sgz0pY4341Q,11349
10
+ ma_http_client-0.1.0.dist-info/METADATA,sha256=CSVbvatt4Ky7EHRZEBbHuBGJJY-eqCs2r8XNrOrUuuU,3172
11
+ ma_http_client-0.1.0.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
12
+ ma_http_client-0.1.0.dist-info/entry_points.txt,sha256=_1GReSx9ylerBjknJ_9Qq-ZGT2Ug3EYDnRLeIV7NKoI,107
13
+ ma_http_client-0.1.0.dist-info/top_level.txt,sha256=zY4Lz_YdNvjaTu1k6tlQYxLgHtc01MdPmome-MB1vYY,15
14
+ ma_http_client-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ ma-client = ma_http_client.cli:main
3
+ ma-install-skill = ma_http_client.install_skill:main
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 Oscillate Labs, LLC
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1 @@
1
+ ma_http_client