meshagent-api 0.21.0__tar.gz → 0.22.1__tar.gz

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 (45) hide show
  1. {meshagent_api-0.21.0/meshagent_api.egg-info → meshagent_api-0.22.1}/PKG-INFO +1 -1
  2. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/client.py +142 -5
  3. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/entrypoint.js +3 -3
  4. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/helpers.py +4 -13
  5. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/room_server_client.py +259 -18
  6. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/schema_document.py +78 -0
  7. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/schema_document_test.py +20 -0
  8. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/services.py +8 -3
  9. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/specs/service.py +16 -1
  10. meshagent_api-0.22.1/meshagent/api/urls.py +21 -0
  11. meshagent_api-0.22.1/meshagent/api/version.py +1 -0
  12. {meshagent_api-0.21.0 → meshagent_api-0.22.1/meshagent_api.egg-info}/PKG-INFO +1 -1
  13. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent_api.egg-info/SOURCES.txt +1 -0
  14. meshagent_api-0.21.0/meshagent/api/version.py +0 -1
  15. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/LICENSE +0 -0
  16. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/MANIFEST.in +0 -0
  17. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/README.md +0 -0
  18. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/__init__.py +0 -0
  19. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/chan.py +0 -0
  20. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/crdt.py +0 -0
  21. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/keys.py +0 -0
  22. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/messaging.py +0 -0
  23. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/oauth.py +0 -0
  24. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/participant.py +0 -0
  25. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/participant_token.py +0 -0
  26. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/participant_token_test.py +0 -0
  27. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/port_forward.py +0 -0
  28. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/protocol.py +0 -0
  29. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/protocol_test.py +0 -0
  30. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/py.typed +0 -0
  31. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/reasoning_schema.py +0 -0
  32. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/runtime.py +0 -0
  33. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/runtime_test.py +0 -0
  34. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/schema.py +0 -0
  35. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/schema_registry.py +0 -0
  36. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/schema_test.py +0 -0
  37. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/schema_util.py +0 -0
  38. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/token_test.py +0 -0
  39. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/webhooks.py +0 -0
  40. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent/api/websocket_protocol.py +0 -0
  41. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent_api.egg-info/dependency_links.txt +0 -0
  42. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent_api.egg-info/requires.txt +0 -0
  43. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/meshagent_api.egg-info/top_level.txt +0 -0
  44. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/pyproject.toml +0 -0
  45. {meshagent_api-0.21.0 → meshagent_api-0.22.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meshagent-api
3
- Version: 0.21.0
3
+ Version: 0.22.1
4
4
  Summary: Python Server API for Meshagent
5
5
  License-Expression: Apache-2.0
6
6
  Project-URL: Documentation, https://docs.meshagent.com
@@ -7,6 +7,7 @@ from meshagent.api.helpers import meshagent_base_url
7
7
  from datetime import datetime
8
8
  from meshagent.api.specs.service import (
9
9
  ServiceSpec,
10
+ ServiceTemplateSpec,
10
11
  )
11
12
  import os
12
13
 
@@ -1091,6 +1092,22 @@ class Meshagent:
1091
1092
  await self._raise_for_status(resp)
1092
1093
  return Mailbox.model_validate((await resp.json())["mailbox"])
1093
1094
 
1095
+ async def list_room_mailboxes(
1096
+ self, *, project_id: str, room_name: str
1097
+ ) -> List[Mailbox]:
1098
+ """
1099
+ GET /accounts/projects/{project_id}/mailboxes
1100
+ Returns a list[Mailbox].
1101
+ """
1102
+ url = f"{self.base_url}/accounts/projects/{project_id}/rooms/{room_name}/mailboxes"
1103
+ async with self._session.get(url, headers=self._get_headers()) as resp:
1104
+ await self._raise_for_status(resp)
1105
+ data = await resp.json()
1106
+ try:
1107
+ return [Mailbox.model_validate(item) for item in data["mailboxes"]]
1108
+ except ValidationError as exc:
1109
+ raise RoomException(f"Invalid mailboxes payload: {exc}") from exc
1110
+
1094
1111
  async def list_mailboxes(self, *, project_id: str) -> List[Mailbox]:
1095
1112
  """
1096
1113
  GET /accounts/projects/{project_id}/mailboxes
@@ -1139,10 +1156,10 @@ class Meshagent:
1139
1156
  async with self._session.post(
1140
1157
  url,
1141
1158
  headers=self._get_headers(),
1142
- json=service.model_dump(mode="json", exclude_unset=True),
1159
+ json=service.model_dump(mode="json"),
1143
1160
  ) as resp:
1144
1161
  await self._raise_for_status(resp)
1145
- return (await resp.json())["id"]
1162
+ return ServiceSpec.model_validate_json(await resp.json())
1146
1163
 
1147
1164
  async def update_service(
1148
1165
  self,
@@ -1165,7 +1182,63 @@ class Meshagent:
1165
1182
  url, headers=self._get_headers(), json=service.model_dump(mode="json")
1166
1183
  ) as resp:
1167
1184
  await self._raise_for_status(resp)
1168
- await resp.json()
1185
+ return ServiceSpec.model_validate_json(await resp.json())
1186
+
1187
+ async def create_service_from_template(
1188
+ self, *, project_id: str, template: ServiceTemplateSpec, values: Dict[str, str]
1189
+ ) -> str:
1190
+ """
1191
+ POST /accounts/projects/{project_id}/services
1192
+ Body: full service spec, e.g.
1193
+ {
1194
+ "name": "...",
1195
+ "image": "...",
1196
+ "pull_secret": "...",
1197
+ "environment": {...},
1198
+ "environment_secrets": [...],
1199
+ "runtime_secrets": {...},
1200
+ "command": "...",
1201
+ "ports": {...}
1202
+ }
1203
+ Returns: { "id": "<service_id>" }
1204
+ """
1205
+ url = f"{self.base_url}/accounts/projects/{project_id}/services"
1206
+ async with self._session.post(
1207
+ url,
1208
+ headers=self._get_headers(),
1209
+ json={
1210
+ "template": template.model_dump(mode="json"),
1211
+ "values": values,
1212
+ },
1213
+ ) as resp:
1214
+ await self._raise_for_status(resp)
1215
+ return ServiceSpec.model_validate_json(await resp.json())
1216
+
1217
+ async def update_service_from_template(
1218
+ self,
1219
+ *,
1220
+ project_id: str,
1221
+ service_id: str,
1222
+ template: ServiceTemplateSpec,
1223
+ values: Dict[str, str],
1224
+ ) -> None:
1225
+ """
1226
+ PUT /accounts/projects/{project_id}/services/{service_id}
1227
+ Body: same structure as create_service (fields you wish to change).
1228
+ Returns: {} on success.
1229
+ """
1230
+
1231
+ url = f"{self.base_url}/accounts/projects/{project_id}/services/{service_id}"
1232
+ async with self._session.put(
1233
+ url,
1234
+ headers=self._get_headers(),
1235
+ json={
1236
+ "template": template.model_dump(mode="json"),
1237
+ "values": values,
1238
+ },
1239
+ ) as resp:
1240
+ await self._raise_for_status(resp)
1241
+ return ServiceSpec.model_validate_json(await resp.json())
1169
1242
 
1170
1243
  async def get_service(self, *, project_id: str, service_id: str) -> ServiceSpec:
1171
1244
  """
@@ -1233,7 +1306,7 @@ class Meshagent:
1233
1306
  async with self._session.post(
1234
1307
  url,
1235
1308
  headers=self._get_headers(),
1236
- json=service.model_dump(mode="json", exclude_unset=True),
1309
+ json=service.model_dump(mode="json"),
1237
1310
  ) as resp:
1238
1311
  await self._raise_for_status(resp)
1239
1312
  return (await resp.json())["id"]
@@ -1245,7 +1318,7 @@ class Meshagent:
1245
1318
  room_name: str,
1246
1319
  service_id: str,
1247
1320
  service: ServiceSpec,
1248
- ) -> NotImplemented:
1321
+ ) -> None:
1249
1322
  """
1250
1323
  PUT /accounts/projects/{project_id}/services/{service_id}
1251
1324
  Body: same structure as create_service (fields you wish to change).
@@ -1259,6 +1332,70 @@ class Meshagent:
1259
1332
  await self._raise_for_status(resp)
1260
1333
  await resp.json()
1261
1334
 
1335
+ async def create_room_service_from_template(
1336
+ self,
1337
+ *,
1338
+ project_id: str,
1339
+ room_name: str,
1340
+ template: ServiceTemplateSpec,
1341
+ values: Dict[str, str],
1342
+ ) -> ServiceSpec:
1343
+ """
1344
+ POST /accounts/projects/{project_id}/services
1345
+ Body: full service spec, e.g.
1346
+ {
1347
+ "name": "...",
1348
+ "image": "...",
1349
+ "pull_secret": "...",
1350
+ "environment": {...},
1351
+ "environment_secrets": [...],
1352
+ "runtime_secrets": {...},
1353
+ "command": "...",
1354
+ "ports": {...}
1355
+ }
1356
+ Returns: { "id": "<service_id>" }
1357
+ """
1358
+ url = (
1359
+ f"{self.base_url}/accounts/projects/{project_id}/rooms/{room_name}/services"
1360
+ )
1361
+ async with self._session.post(
1362
+ url,
1363
+ headers=self._get_headers(),
1364
+ json={
1365
+ "template": template.model_dump(mode="json"),
1366
+ "values": values,
1367
+ },
1368
+ ) as resp:
1369
+ await self._raise_for_status(resp)
1370
+ return ServiceSpec.model_validate_json(await resp.json())
1371
+
1372
+ async def update_room_service_from_template(
1373
+ self,
1374
+ *,
1375
+ project_id: str,
1376
+ room_name: str,
1377
+ service_id: str,
1378
+ template: ServiceTemplateSpec,
1379
+ values: Dict[str, str],
1380
+ ) -> ServiceSpec:
1381
+ """
1382
+ PUT /accounts/projects/{project_id}/services/{service_id}
1383
+ Body: same structure as create_service (fields you wish to change).
1384
+ Returns: {} on success.
1385
+ """
1386
+
1387
+ url = f"{self.base_url}/accounts/projects/{project_id}/rooms/{room_name}/services/{service_id}"
1388
+ async with self._session.put(
1389
+ url,
1390
+ headers=self._get_headers(),
1391
+ json={
1392
+ "template": template.model_dump(mode="json"),
1393
+ "values": values,
1394
+ },
1395
+ ) as resp:
1396
+ await self._raise_for_status(resp)
1397
+ return ServiceSpec.model_validate_json(await resp.json())
1398
+
1262
1399
  async def get_room_service(
1263
1400
  self, *, project_id: str, room_name: str, service_id: str
1264
1401
  ) -> ServiceSpec: