muse-code-sdk 1.3.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.
- muse_code/__init__.py +129 -0
- muse_code/connection/__init__.py +49 -0
- muse_code/connection/connection.py +905 -0
- muse_code/connection/discovery.py +55 -0
- muse_code/connection/spawn.py +1067 -0
- muse_code/connection/validation.py +149 -0
- muse_code/errors.py +199 -0
- muse_code/facade/__init__.py +89 -0
- muse_code/facade/approval.py +279 -0
- muse_code/facade/client.py +444 -0
- muse_code/facade/discarded.py +45 -0
- muse_code/facade/gap_fill.py +483 -0
- muse_code/facade/host_death.py +254 -0
- muse_code/facade/session.py +977 -0
- muse_code/facade/turn_handle.py +440 -0
- muse_code/facade/turn_submit.py +289 -0
- muse_code/fold/__init__.py +82 -0
- muse_code/fold/item_store.py +268 -0
- muse_code/fold/session_fold.py +785 -0
- muse_code/fold/state_store.py +141 -0
- muse_code/pending/__init__.py +53 -0
- muse_code/pending/pending_command_set.py +842 -0
- muse_code/py.typed +0 -0
- muse_code/replay.py +144 -0
- muse_code/sync_facade.py +493 -0
- muse_code_sdk-1.3.0.dist-info/METADATA +47 -0
- muse_code_sdk-1.3.0.dist-info/RECORD +30 -0
- muse_code_sdk-1.3.0.dist-info/WHEEL +5 -0
- muse_code_sdk-1.3.0.dist-info/licenses/LICENSE +21 -0
- muse_code_sdk-1.3.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""Host discovery for the UNBUNDLED wheel (spec 638 FR-638-020, INV-638-08).
|
|
2
|
+
|
|
3
|
+
The wheel carries no host binary and no code path assumes one (#29216 fence).
|
|
4
|
+
Exactly the two ruled tiers, first hit wins: an explicit ``muse_bin``
|
|
5
|
+
argument, then a ``muse`` on ``PATH``. The LIBRARY reads no environment
|
|
6
|
+
variable (TS parity: ``spawn.ts`` takes a required command; ``MUSE_BIN`` is
|
|
7
|
+
a knob of the quickstart/cookbook HARNESSES, which read it themselves and
|
|
8
|
+
pass the explicit parameter down — PR #29277 review, thread 6). No
|
|
9
|
+
discoverable host fails BEFORE any process is spawned, with an exact error
|
|
10
|
+
naming the parameter and the compatibility page.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import shutil
|
|
16
|
+
|
|
17
|
+
from ..errors import COMPATIBILITY_PAGE_URL, MuseHostDiscoveryError
|
|
18
|
+
|
|
19
|
+
HOST_BINARY_NAME = "muse"
|
|
20
|
+
"""What the second tier looks for on ``PATH``."""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def discover_muse_bin(muse_bin: str | None = None) -> str:
|
|
24
|
+
"""Resolves the MSP host binary to spawn (spec 638 FR-638-020).
|
|
25
|
+
|
|
26
|
+
Exactly two ruled inputs (FR-638-020 / INV-638-08): an explicit
|
|
27
|
+
``muse_bin``, else the process ``PATH``. There is deliberately no ``env``
|
|
28
|
+
knob — no production caller passes one, the TS twin has none, and a
|
|
29
|
+
harness wanting hermetic discovery exports ``PATH`` itself; a future S3
|
|
30
|
+
consumer that needs the child's own env adds it there (PR #30094 review).
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
muse_bin: An explicit host path; when given it wins outright and is
|
|
34
|
+
returned verbatim (existence is the spawn's to prove — an
|
|
35
|
+
explicit path is the caller's statement, not a search hint).
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
The binary to spawn.
|
|
39
|
+
|
|
40
|
+
Raises:
|
|
41
|
+
MuseHostDiscoveryError: Neither tier produced a host. The message
|
|
42
|
+
names the ``muse_bin`` parameter and the compatibility page
|
|
43
|
+
whose Python row states which host versions this SDK supports.
|
|
44
|
+
"""
|
|
45
|
+
if muse_bin is not None:
|
|
46
|
+
return muse_bin
|
|
47
|
+
found = shutil.which(HOST_BINARY_NAME)
|
|
48
|
+
if found is not None:
|
|
49
|
+
return found
|
|
50
|
+
raise MuseHostDiscoveryError(
|
|
51
|
+
"no muse host found: pass muse_bin=<path to a muse binary> or put "
|
|
52
|
+
f"`{HOST_BINARY_NAME}` on PATH. The wheel does not bundle a host (it "
|
|
53
|
+
"is installed separately); supported host versions are listed on the "
|
|
54
|
+
f"compatibility page's Python row: {COMPATIBILITY_PAGE_URL}"
|
|
55
|
+
)
|