meshagent-api 0.57.0__tar.gz → 0.57.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 (82) hide show
  1. {meshagent_api-0.57.0/meshagent_api.egg-info → meshagent_api-0.57.1}/PKG-INFO +1 -1
  2. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/files.py +7 -1
  3. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/files_test.py +31 -2
  4. meshagent_api-0.57.1/meshagent/api/version.py +1 -0
  5. {meshagent_api-0.57.0 → meshagent_api-0.57.1/meshagent_api.egg-info}/PKG-INFO +1 -1
  6. meshagent_api-0.57.0/meshagent/api/version.py +0 -1
  7. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/LICENSE +0 -0
  8. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/MANIFEST.in +0 -0
  9. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/README.md +0 -0
  10. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/__init__.py +0 -0
  11. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/agent_content.py +0 -0
  12. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/aiohttp_redaction.py +0 -0
  13. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/chan.py +0 -0
  14. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/client.py +0 -0
  15. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/client_test.py +0 -0
  16. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/crdt.py +0 -0
  17. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/dataset_schema.py +0 -0
  18. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/entrypoint.js +0 -0
  19. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/error_codes.py +0 -0
  20. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/file_permissions.py +0 -0
  21. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/helpers.py +0 -0
  22. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/http.py +0 -0
  23. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/image_runtime.py +0 -0
  24. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/keys.py +0 -0
  25. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/llm_router_config.py +0 -0
  26. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/managed_agents.py +0 -0
  27. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/managed_agents_test.py +0 -0
  28. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/messaging.py +0 -0
  29. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/messaging_test.py +0 -0
  30. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/mime_types.py +0 -0
  31. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/mime_types_test.py +0 -0
  32. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/oauth.py +0 -0
  33. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/oauth_branding.py +0 -0
  34. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/oauth_scopes.py +0 -0
  35. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/oauth_scopes_test.py +0 -0
  36. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/participant.py +0 -0
  37. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/participant_token.py +0 -0
  38. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/participant_token_test.py +0 -0
  39. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/port_forward.py +0 -0
  40. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/port_forward_test.py +0 -0
  41. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/protocol.py +0 -0
  42. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/protocol_test.py +0 -0
  43. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/py.typed +0 -0
  44. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/reasoning_schema.py +0 -0
  45. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/registry_auth.py +0 -0
  46. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/room_ports.py +0 -0
  47. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/room_server_client.py +0 -0
  48. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/room_server_client_test.py +0 -0
  49. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/runtime.py +0 -0
  50. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/runtime_test.py +0 -0
  51. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/schema.py +0 -0
  52. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/schema_document.py +0 -0
  53. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/schema_document_test.py +0 -0
  54. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/schema_registry.py +0 -0
  55. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/schema_test.py +0 -0
  56. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/schema_util.py +0 -0
  57. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/service_spec_test.py +0 -0
  58. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/service_template_test.py +0 -0
  59. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/services.py +0 -0
  60. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/services_test.py +0 -0
  61. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/specs/service.py +0 -0
  62. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/sql.py +0 -0
  63. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/sql_test.py +0 -0
  64. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/sqlite_batch_integration_test.py +0 -0
  65. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/sqlite_replication_test.py +0 -0
  66. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/sqlite_transfer.py +0 -0
  67. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/sqlite_transfer_test.py +0 -0
  68. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/storage_connections.py +0 -0
  69. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/storage_connections_test.py +0 -0
  70. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/storage_policy_test.py +0 -0
  71. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/token_test.py +0 -0
  72. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/urls.py +0 -0
  73. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/webhooks.py +0 -0
  74. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/webhooks_test.py +0 -0
  75. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/websocket_protocol.py +0 -0
  76. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent/api/websocket_protocol_test.py +0 -0
  77. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent_api.egg-info/SOURCES.txt +0 -0
  78. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent_api.egg-info/dependency_links.txt +0 -0
  79. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent_api.egg-info/requires.txt +0 -0
  80. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/meshagent_api.egg-info/top_level.txt +0 -0
  81. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/pyproject.toml +0 -0
  82. {meshagent_api-0.57.0 → meshagent_api-0.57.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meshagent-api
3
- Version: 0.57.0
3
+ Version: 0.57.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
@@ -261,12 +261,18 @@ class TargetFilesClient:
261
261
  *,
262
262
  content_type: str = "application/octet-stream",
263
263
  overwrite: bool = True,
264
+ if_match: str | None = None,
264
265
  ) -> None:
266
+ if if_match is not None and not if_match.strip():
267
+ raise ValueError("If-Match ETag must not be empty")
265
268
  client = self._files._client
269
+ headers = {**client._get_headers(), "Content-Type": content_type}
270
+ if if_match is not None:
271
+ headers["If-Match"] = if_match
266
272
  async with client._session.put(
267
273
  await self._files._url(self.target, path),
268
274
  params={"overwrite": str(overwrite).lower()},
269
- headers={**client._get_headers(), "Content-Type": content_type},
275
+ headers=headers,
270
276
  data=data,
271
277
  allow_redirects=False,
272
278
  ) as response:
@@ -19,6 +19,7 @@ class FilesApiFixture:
19
19
  calls: list[tuple[str, str, dict[str, str], str]] = field(default_factory=list)
20
20
  blobs: dict[str, bytes] = field(default_factory=dict)
21
21
  actions: list[dict] = field(default_factory=list)
22
+ etags: dict[str, int] = field(default_factory=dict)
22
23
 
23
24
 
24
25
  @pytest_asyncio.fixture
@@ -73,10 +74,23 @@ async def files_api() -> AsyncIterator[FilesApiFixture]:
73
74
  state.actions.append(await request.json())
74
75
  return web.json_response({})
75
76
  if request.method == "PUT":
77
+ current = state.etags.get(request.path)
78
+ if (
79
+ request.headers.get("If-Match") is not None
80
+ and request.headers["If-Match"] != f'"v{current}"'
81
+ ):
82
+ return web.Response(status=412)
83
+ if (
84
+ not request.query.get("overwrite", "true") == "true"
85
+ and current is not None
86
+ ):
87
+ return web.Response(status=409)
76
88
  state.blobs[request.path] = await request.read()
89
+ state.etags[request.path] = (current or 0) + 1
77
90
  return web.Response(status=204)
78
91
  if request.method == "DELETE":
79
92
  state.blobs.pop(request.path, None)
93
+ state.etags.pop(request.path, None)
80
94
  return web.Response(status=204)
81
95
  data = state.blobs.get(request.path)
82
96
  if data is None:
@@ -84,7 +98,7 @@ async def files_api() -> AsyncIterator[FilesApiFixture]:
84
98
  return web.Response(
85
99
  body=data,
86
100
  content_type="application/octet-stream",
87
- headers={"ETag": '"file-etag"'},
101
+ headers={"ETag": f'"v{state.etags[request.path]}"'},
88
102
  )
89
103
 
90
104
  app.router.add_get("/config", config)
@@ -126,7 +140,7 @@ async def test_room_agent_streams_share_discovery_session_and_current_credential
126
140
  )
127
141
  metadata = await room.stat(path)
128
142
  assert metadata.size == len(b"\x00\xfffirstsecond")
129
- assert metadata.etag == '"file-etag"'
143
+ assert metadata.etag == '"v1"'
130
144
  assert await agent.exists(path)
131
145
  assert not await agent.exists("missing")
132
146
  client.token = "rotated-token"
@@ -233,3 +247,18 @@ async def test_invalid_paths_fail_before_discovery(files_api):
233
247
  def test_target_cannot_escape_namespace(name):
234
248
  with pytest.raises(ValidationError):
235
249
  FilesTarget(project_id="p1", kind="agent", name=name)
250
+
251
+
252
+ @pytest.mark.asyncio
253
+ async def test_conditional_upload_rejects_stale_etag(files_api):
254
+ async with Meshagent(base_url=files_api.base_url, token="test-token") as client:
255
+ files = client.files.for_room(project_id="p", room_name="r")
256
+ await files.upload("workbook", b"first", overwrite=False)
257
+ etag = (await files.stat("workbook")).etag
258
+ assert etag == '"v1"'
259
+ await files.upload("workbook", b"second", if_match=etag)
260
+ with pytest.raises(RoomException):
261
+ await files.upload("workbook", b"stale", if_match=etag)
262
+ assert await files.download("workbook") == b"second"
263
+ with pytest.raises(ValueError):
264
+ await files.upload("workbook", b"invalid", if_match=" ")
@@ -0,0 +1 @@
1
+ __version__ = "0.57.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meshagent-api
3
- Version: 0.57.0
3
+ Version: 0.57.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
@@ -1 +0,0 @@
1
- __version__ = "0.57.0"
File without changes
File without changes
File without changes