superdoc-sdk 1.6.0.dev37__tar.gz → 1.6.0.dev40__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 (37) hide show
  1. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/PKG-INFO +6 -6
  2. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/pyproject.toml +6 -6
  3. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/transport.py +17 -8
  4. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc_sdk.egg-info/PKG-INFO +6 -6
  5. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc_sdk.egg-info/requires.txt +5 -5
  6. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/tests/test_transport.py +48 -0
  7. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/README.md +0 -0
  8. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/setup.cfg +0 -0
  9. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/__init__.py +0 -0
  10. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/client.py +0 -0
  11. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/embedded_cli.py +0 -0
  12. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/errors.py +0 -0
  13. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/generated/__init__.py +0 -0
  14. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/generated/client.py +0 -0
  15. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/generated/contract.py +0 -0
  16. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/protocol.py +0 -0
  17. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/runtime.py +0 -0
  18. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/skill_api.py +0 -0
  19. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/skills/__init__.py +0 -0
  20. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/skills/editing-docx.md +0 -0
  21. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/test_parity_helper.py +0 -0
  22. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/tools/catalog.json +0 -0
  23. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/tools/intent_dispatch_generated.py +0 -0
  24. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/tools/system-prompt-mcp.md +0 -0
  25. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/tools/system-prompt.md +0 -0
  26. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/tools/tools-policy.json +0 -0
  27. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/tools/tools.anthropic.json +0 -0
  28. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/tools/tools.generic.json +0 -0
  29. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/tools/tools.openai.json +0 -0
  30. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/tools/tools.vercel.json +0 -0
  31. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc/tools_api.py +0 -0
  32. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc_sdk.egg-info/SOURCES.txt +0 -0
  33. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc_sdk.egg-info/dependency_links.txt +0 -0
  34. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/superdoc_sdk.egg-info/top_level.txt +0 -0
  35. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/tests/test_client_method_naming.py +0 -0
  36. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/tests/test_helpers_reexports.py +0 -0
  37. {superdoc_sdk-1.6.0.dev37 → superdoc_sdk-1.6.0.dev40}/tests/test_protocol.py +0 -0
@@ -1,16 +1,16 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: superdoc-sdk
3
- Version: 1.6.0.dev37
3
+ Version: 1.6.0.dev40
4
4
  Summary: SuperDoc SDK (CLI-backed)
5
5
  Author: SuperDoc
6
6
  License-Expression: AGPL-3.0
7
7
  Requires-Python: >=3.9
8
8
  Description-Content-Type: text/markdown
9
- Requires-Dist: superdoc-sdk-cli-darwin-arm64==1.6.0.dev37; platform_system == "Darwin" and (platform_machine == "arm64" or platform_machine == "aarch64" or platform_machine == "ARM64")
10
- Requires-Dist: superdoc-sdk-cli-darwin-x64==1.6.0.dev37; platform_system == "Darwin" and (platform_machine == "x86_64" or platform_machine == "AMD64" or platform_machine == "amd64")
11
- Requires-Dist: superdoc-sdk-cli-linux-x64==1.6.0.dev37; platform_system == "Linux" and (platform_machine == "x86_64" or platform_machine == "AMD64" or platform_machine == "amd64")
12
- Requires-Dist: superdoc-sdk-cli-linux-arm64==1.6.0.dev37; platform_system == "Linux" and (platform_machine == "arm64" or platform_machine == "aarch64" or platform_machine == "ARM64")
13
- Requires-Dist: superdoc-sdk-cli-windows-x64==1.6.0.dev37; platform_system == "Windows" and (platform_machine == "x86_64" or platform_machine == "AMD64" or platform_machine == "amd64")
9
+ Requires-Dist: superdoc-sdk-cli-darwin-arm64==1.6.0.dev40; platform_system == "Darwin" and (platform_machine == "arm64" or platform_machine == "aarch64" or platform_machine == "ARM64")
10
+ Requires-Dist: superdoc-sdk-cli-darwin-x64==1.6.0.dev40; platform_system == "Darwin" and (platform_machine == "x86_64" or platform_machine == "AMD64" or platform_machine == "amd64")
11
+ Requires-Dist: superdoc-sdk-cli-linux-x64==1.6.0.dev40; platform_system == "Linux" and (platform_machine == "x86_64" or platform_machine == "AMD64" or platform_machine == "amd64")
12
+ Requires-Dist: superdoc-sdk-cli-linux-arm64==1.6.0.dev40; platform_system == "Linux" and (platform_machine == "arm64" or platform_machine == "aarch64" or platform_machine == "ARM64")
13
+ Requires-Dist: superdoc-sdk-cli-windows-x64==1.6.0.dev40; platform_system == "Windows" and (platform_machine == "x86_64" or platform_machine == "AMD64" or platform_machine == "amd64")
14
14
 
15
15
  # superdoc-sdk
16
16
 
@@ -4,18 +4,18 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "superdoc-sdk"
7
- version = "1.6.0.dev37"
7
+ version = "1.6.0.dev40"
8
8
  description = "SuperDoc SDK (CLI-backed)"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
11
11
  license = "AGPL-3.0"
12
12
  authors = [{ name = "SuperDoc" }]
13
13
  dependencies = [
14
- "superdoc-sdk-cli-darwin-arm64==1.6.0.dev37; platform_system == 'Darwin' and (platform_machine == 'arm64' or platform_machine == 'aarch64' or platform_machine == 'ARM64')",
15
- "superdoc-sdk-cli-darwin-x64==1.6.0.dev37; platform_system == 'Darwin' and (platform_machine == 'x86_64' or platform_machine == 'AMD64' or platform_machine == 'amd64')",
16
- "superdoc-sdk-cli-linux-x64==1.6.0.dev37; platform_system == 'Linux' and (platform_machine == 'x86_64' or platform_machine == 'AMD64' or platform_machine == 'amd64')",
17
- "superdoc-sdk-cli-linux-arm64==1.6.0.dev37; platform_system == 'Linux' and (platform_machine == 'arm64' or platform_machine == 'aarch64' or platform_machine == 'ARM64')",
18
- "superdoc-sdk-cli-windows-x64==1.6.0.dev37; platform_system == 'Windows' and (platform_machine == 'x86_64' or platform_machine == 'AMD64' or platform_machine == 'amd64')",
14
+ "superdoc-sdk-cli-darwin-arm64==1.6.0.dev40; platform_system == 'Darwin' and (platform_machine == 'arm64' or platform_machine == 'aarch64' or platform_machine == 'ARM64')",
15
+ "superdoc-sdk-cli-darwin-x64==1.6.0.dev40; platform_system == 'Darwin' and (platform_machine == 'x86_64' or platform_machine == 'AMD64' or platform_machine == 'amd64')",
16
+ "superdoc-sdk-cli-linux-x64==1.6.0.dev40; platform_system == 'Linux' and (platform_machine == 'x86_64' or platform_machine == 'AMD64' or platform_machine == 'amd64')",
17
+ "superdoc-sdk-cli-linux-arm64==1.6.0.dev40; platform_system == 'Linux' and (platform_machine == 'arm64' or platform_machine == 'aarch64' or platform_machine == 'ARM64')",
18
+ "superdoc-sdk-cli-windows-x64==1.6.0.dev40; platform_system == 'Windows' and (platform_machine == 'x86_64' or platform_machine == 'AMD64' or platform_machine == 'amd64')",
19
19
  ]
20
20
 
21
21
  [tool.setuptools]
@@ -435,9 +435,25 @@ class AsyncHostTransport:
435
435
  """Ensure the host process is running and handshake is complete."""
436
436
  await self._ensure_connected()
437
437
 
438
+ async def _await_in_flight_cleanup(self) -> None:
439
+ """Wait for an already-running cleanup task, if any."""
440
+ existing = self._cleanup_task
441
+ if existing and not existing.done():
442
+ try:
443
+ await asyncio.shield(existing)
444
+ except asyncio.CancelledError:
445
+ raise
446
+ except Exception:
447
+ pass
448
+
438
449
  async def dispose(self) -> None:
439
450
  """Gracefully shut down the host process."""
440
451
  if self._state == _State.DISCONNECTED:
452
+ # Reader-triggered cleanup flips state to DISCONNECTED before the
453
+ # subprocess is fully reaped. If that cleanup is still in flight,
454
+ # wait for it so dispose() doesn't return while the host process
455
+ # is still being torn down.
456
+ await self._await_in_flight_cleanup()
441
457
  return
442
458
  if self._state == _State.DISPOSING:
443
459
  # A reader-triggered cleanup is in flight (or an earlier teardown
@@ -445,14 +461,7 @@ class AsyncHostTransport:
445
461
  # observes "host fully torn down" by the time dispose() returns.
446
462
  # shield() so a cancelled dispose() doesn't interrupt _cleanup
447
463
  # mid-flight and leak the host process.
448
- existing = self._cleanup_task
449
- if existing and not existing.done():
450
- try:
451
- await asyncio.shield(existing)
452
- except asyncio.CancelledError:
453
- raise
454
- except Exception:
455
- pass
464
+ await self._await_in_flight_cleanup()
456
465
  return
457
466
 
458
467
  self._stopping = True
@@ -1,16 +1,16 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: superdoc-sdk
3
- Version: 1.6.0.dev37
3
+ Version: 1.6.0.dev40
4
4
  Summary: SuperDoc SDK (CLI-backed)
5
5
  Author: SuperDoc
6
6
  License-Expression: AGPL-3.0
7
7
  Requires-Python: >=3.9
8
8
  Description-Content-Type: text/markdown
9
- Requires-Dist: superdoc-sdk-cli-darwin-arm64==1.6.0.dev37; platform_system == "Darwin" and (platform_machine == "arm64" or platform_machine == "aarch64" or platform_machine == "ARM64")
10
- Requires-Dist: superdoc-sdk-cli-darwin-x64==1.6.0.dev37; platform_system == "Darwin" and (platform_machine == "x86_64" or platform_machine == "AMD64" or platform_machine == "amd64")
11
- Requires-Dist: superdoc-sdk-cli-linux-x64==1.6.0.dev37; platform_system == "Linux" and (platform_machine == "x86_64" or platform_machine == "AMD64" or platform_machine == "amd64")
12
- Requires-Dist: superdoc-sdk-cli-linux-arm64==1.6.0.dev37; platform_system == "Linux" and (platform_machine == "arm64" or platform_machine == "aarch64" or platform_machine == "ARM64")
13
- Requires-Dist: superdoc-sdk-cli-windows-x64==1.6.0.dev37; platform_system == "Windows" and (platform_machine == "x86_64" or platform_machine == "AMD64" or platform_machine == "amd64")
9
+ Requires-Dist: superdoc-sdk-cli-darwin-arm64==1.6.0.dev40; platform_system == "Darwin" and (platform_machine == "arm64" or platform_machine == "aarch64" or platform_machine == "ARM64")
10
+ Requires-Dist: superdoc-sdk-cli-darwin-x64==1.6.0.dev40; platform_system == "Darwin" and (platform_machine == "x86_64" or platform_machine == "AMD64" or platform_machine == "amd64")
11
+ Requires-Dist: superdoc-sdk-cli-linux-x64==1.6.0.dev40; platform_system == "Linux" and (platform_machine == "x86_64" or platform_machine == "AMD64" or platform_machine == "amd64")
12
+ Requires-Dist: superdoc-sdk-cli-linux-arm64==1.6.0.dev40; platform_system == "Linux" and (platform_machine == "arm64" or platform_machine == "aarch64" or platform_machine == "ARM64")
13
+ Requires-Dist: superdoc-sdk-cli-windows-x64==1.6.0.dev40; platform_system == "Windows" and (platform_machine == "x86_64" or platform_machine == "AMD64" or platform_machine == "amd64")
14
14
 
15
15
  # superdoc-sdk
16
16
 
@@ -1,15 +1,15 @@
1
1
 
2
2
  [:platform_system == "Darwin" and (platform_machine == "arm64" or platform_machine == "aarch64" or platform_machine == "ARM64")]
3
- superdoc-sdk-cli-darwin-arm64==1.6.0.dev37
3
+ superdoc-sdk-cli-darwin-arm64==1.6.0.dev40
4
4
 
5
5
  [:platform_system == "Darwin" and (platform_machine == "x86_64" or platform_machine == "AMD64" or platform_machine == "amd64")]
6
- superdoc-sdk-cli-darwin-x64==1.6.0.dev37
6
+ superdoc-sdk-cli-darwin-x64==1.6.0.dev40
7
7
 
8
8
  [:platform_system == "Linux" and (platform_machine == "arm64" or platform_machine == "aarch64" or platform_machine == "ARM64")]
9
- superdoc-sdk-cli-linux-arm64==1.6.0.dev37
9
+ superdoc-sdk-cli-linux-arm64==1.6.0.dev40
10
10
 
11
11
  [:platform_system == "Linux" and (platform_machine == "x86_64" or platform_machine == "AMD64" or platform_machine == "amd64")]
12
- superdoc-sdk-cli-linux-x64==1.6.0.dev37
12
+ superdoc-sdk-cli-linux-x64==1.6.0.dev40
13
13
 
14
14
  [:platform_system == "Windows" and (platform_machine == "x86_64" or platform_machine == "AMD64" or platform_machine == "amd64")]
15
- superdoc-sdk-cli-windows-x64==1.6.0.dev37
15
+ superdoc-sdk-cli-windows-x64==1.6.0.dev40
@@ -764,6 +764,54 @@ class TestAsyncCleanupLifecycle:
764
764
  finally:
765
765
  _cleanup_wrapper(cli)
766
766
 
767
+ @pytest.mark.asyncio
768
+ async def test_dispose_waits_for_cleanup_after_state_flips_disconnected(self):
769
+ # `_cleanup()` flips state to DISCONNECTED before awaiting
770
+ # `process.wait()`. dispose() must still wait for that cleanup task
771
+ # instead of short-circuiting and returning while teardown is in
772
+ # flight.
773
+ cli = _mock_cli_bin({'handshake': 'ok'})
774
+ try:
775
+ transport = AsyncHostTransport(cli, startup_timeout_ms=5_000)
776
+ await transport.connect()
777
+ process = transport._process
778
+ assert process is not None
779
+
780
+ wait_started = asyncio.Event()
781
+ release = asyncio.Event()
782
+ real_wait = process.wait
783
+
784
+ async def slow_wait():
785
+ wait_started.set()
786
+ await release.wait()
787
+ return await real_wait()
788
+
789
+ process.wait = slow_wait # type: ignore[assignment]
790
+
791
+ transport._schedule_cleanup(
792
+ SuperDocError('reader-overflow', code=HOST_PROTOCOL_ERROR),
793
+ )
794
+ cleanup_task = transport._cleanup_task
795
+ assert cleanup_task is not None
796
+
797
+ await asyncio.wait_for(wait_started.wait(), timeout=2.0)
798
+ assert transport.state == 'DISCONNECTED'
799
+ assert transport._process is None
800
+ assert not cleanup_task.done()
801
+
802
+ dispose_task = asyncio.create_task(transport.dispose())
803
+ await asyncio.sleep(0.05)
804
+ assert not dispose_task.done()
805
+
806
+ release.set()
807
+ await dispose_task
808
+ assert transport.state == 'DISCONNECTED'
809
+ assert transport._cleanup_task is None
810
+ await process.wait()
811
+ assert process.returncode is not None
812
+ finally:
813
+ _cleanup_wrapper(cli)
814
+
767
815
  @pytest.mark.asyncio
768
816
  async def test_ensure_connected_drains_in_flight_cleanup_before_spawn(self):
769
817
  # Round-3 regression: without this drain, `_start_host` reassigns