mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-11-28 09:26:54 +08:00
* chore(sdk): import langbot-plugin-sdk v0.7.24 snapshot into sdk/ (LANG-420) Snapshot of langbot-app/langbot-plugin-sdk at 76443bb8 (tag v0.7.24), without history. The repository's .github/ workflows are not imported; they are replaced by sdk-*.yml workflows in the next commit. The root .gitignore keeps the template .vscode/launch.json.example tracked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai> * feat(sdk): move the plugin SDK into the monorepo with independent releases (LANG-420) - CI: sdk-tests.yml / sdk-box-docker.yml run the SDK suite from sdk/ in its own environment (Python 3.10-3.12); run-tests.yml gains a "Core with in-tree SDK" job that overlays sdk/ on Core's venv. - Releases: sdk-publish.yml publishes langbot-plugin from sdk/vX.Y.Z tag pushes and never creates a GitHub Release. Core release workflows now only accept v* tags, and scripts/check_sdk_release_pin.py blocks a Core PyPI/Docker release whose langbot-plugin pin differs from the released, unchanged sdk/. - Packaging: Core still installs the PyPI pin. Core wheel/sdist, git export, Docker context, release ZIP and fnOS package exclude sdk/. - Generator/tests: generate_plugin_workspace_api.py writes sdk/ directly; the SDK's generator drift tests now run instead of skipping. - Docs: AGENTS/ARCHITECTURE, sdk/ guides (+ RELEASING.md, SOURCE.json), agent skills and lbs probes, public docs (zh/en/ja) and dev-docs point at sdk/ instead of the sibling langbot-plugin-sdk checkout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
62 lines
1.7 KiB
Python
62 lines
1.7 KiB
Python
from __future__ import annotations
|
|
|
|
import asyncio
|
|
import io
|
|
import sys
|
|
|
|
import pytest
|
|
|
|
from langbot_plugin.runtime.io.controllers.stdio import server
|
|
|
|
|
|
class _TextStream:
|
|
def __init__(self, buffer: io.BytesIO):
|
|
self.buffer = buffer
|
|
|
|
|
|
async def test_windows_stdio_uses_threaded_binary_streams(monkeypatch):
|
|
stdin_buffer = io.BytesIO(b"request\n")
|
|
stdout_buffer = io.BytesIO()
|
|
monkeypatch.setattr(server.sys, "platform", "win32")
|
|
monkeypatch.setattr(server.sys, "stdin", _TextStream(stdin_buffer))
|
|
monkeypatch.setattr(server.sys, "stdout", _TextStream(stdout_buffer))
|
|
|
|
reader, writer = await server.connect_stdin_stdout()
|
|
|
|
assert await reader.readline() == b"request\n"
|
|
writer.write(b"response\n")
|
|
await writer.drain()
|
|
assert stdout_buffer.getvalue() == b"response\n"
|
|
|
|
writer.close()
|
|
assert writer.is_closing() is True
|
|
await writer.wait_closed()
|
|
|
|
|
|
@pytest.mark.skipif(sys.platform != "win32", reason="Windows stdio handle behavior")
|
|
async def test_windows_stdio_works_in_redirected_subprocess():
|
|
child_code = r"""
|
|
import asyncio
|
|
from langbot_plugin.runtime.io.controllers.stdio.server import connect_stdin_stdout
|
|
|
|
async def main():
|
|
_, writer = await connect_stdin_stdout()
|
|
writer.write(b"READY\n")
|
|
await writer.drain()
|
|
|
|
asyncio.run(main())
|
|
"""
|
|
process = await asyncio.create_subprocess_exec(
|
|
sys.executable,
|
|
"-c",
|
|
child_code,
|
|
stdin=asyncio.subprocess.PIPE,
|
|
stdout=asyncio.subprocess.PIPE,
|
|
stderr=asyncio.subprocess.PIPE,
|
|
)
|
|
|
|
stdout, stderr = await asyncio.wait_for(process.communicate(), timeout=10)
|
|
|
|
assert process.returncode == 0, stderr.decode(errors="replace")
|
|
assert stdout == b"READY\n"
|