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
muse_code/__init__.py
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"""Muse Code SDK for MSP: the asyncio-first Python facade.
|
|
2
|
+
|
|
3
|
+
Owning spec: ``specs/638-muse-sdk-python`` (governing ADR
|
|
4
|
+
``docs/adr/638-muse-sdk-python.md``). Wire shapes are imported from the
|
|
5
|
+
generated ``muse_code_msp`` package, never restated here (INV-638-01/02).
|
|
6
|
+
|
|
7
|
+
S1 (the transport-less core) is in: the SS4 fold (``muse_code.fold``), the
|
|
8
|
+
SS4.13 pending set (``muse_code.pending``), the transcript replay runner
|
|
9
|
+
(``muse_code.replay``), and the typed error family (``muse_code.errors``).
|
|
10
|
+
S2 is in: the NDJSON connection machine, the owned-process spawn path, host
|
|
11
|
+
discovery, and the strict fingerprint gate (``muse_code.connection``). S3 is in:
|
|
12
|
+
the asyncio facade (``muse_code.facade`` — ``MuseClient``, ``Session``,
|
|
13
|
+
``Turn``) with the host-death discharge, the approval/user-input round trip,
|
|
14
|
+
the SS4.8 gap splice-fill, and the sync loop-runner wrapper
|
|
15
|
+
(``muse_code.sync_facade`` — ``SyncMuseClient``).
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
from typing import Final
|
|
21
|
+
|
|
22
|
+
from .errors import (
|
|
23
|
+
GapFillFailureReason,
|
|
24
|
+
MuseForeignSessionError,
|
|
25
|
+
MuseGapFillError,
|
|
26
|
+
MuseSessionDiscardedError,
|
|
27
|
+
)
|
|
28
|
+
from .fold import ItemStore, SessionFold, SessionStateStore
|
|
29
|
+
from .pending import PendingCommandSet
|
|
30
|
+
from .replay import Transcript, load_transcript, replay_into_fold, transcript_dirs
|
|
31
|
+
|
|
32
|
+
__all__ = [
|
|
33
|
+
"EXPECTED_SCHEMA_FINGERPRINT",
|
|
34
|
+
"ApprovalDecisionInput",
|
|
35
|
+
"ApprovalFailure",
|
|
36
|
+
"ApprovalFailureHandler",
|
|
37
|
+
"ApprovalHandler",
|
|
38
|
+
"DiscardedSessions",
|
|
39
|
+
"GapFillFailureHandler",
|
|
40
|
+
"GapFillFailureReason",
|
|
41
|
+
"HostDeathDischarge",
|
|
42
|
+
"HostDeathNotification",
|
|
43
|
+
"ItemStore",
|
|
44
|
+
"MuseClient",
|
|
45
|
+
"MuseClientOptions",
|
|
46
|
+
"MuseClientSpawnOptions",
|
|
47
|
+
"MuseForeignSessionError",
|
|
48
|
+
"MuseGapFillError",
|
|
49
|
+
"MuseHostDiedError",
|
|
50
|
+
"MuseSessionDiscardedError",
|
|
51
|
+
"PendingCommandSet",
|
|
52
|
+
"PendingCommandView",
|
|
53
|
+
"ResumeSessionOptions",
|
|
54
|
+
"SendUserTurnOptions",
|
|
55
|
+
"Session",
|
|
56
|
+
"SessionApplyOutcome",
|
|
57
|
+
"SessionDurabilityProfile",
|
|
58
|
+
"SessionFold",
|
|
59
|
+
"SessionFoldView",
|
|
60
|
+
"SessionGapBuffered",
|
|
61
|
+
"SessionGapOverlap",
|
|
62
|
+
"SessionStateStore",
|
|
63
|
+
"StartSessionOptions",
|
|
64
|
+
"SyncMuseClient",
|
|
65
|
+
"SyncSession",
|
|
66
|
+
"SyncTurn",
|
|
67
|
+
"Transcript",
|
|
68
|
+
"TransportEof",
|
|
69
|
+
"Turn",
|
|
70
|
+
"TurnOutcome",
|
|
71
|
+
"is_abnormal_host_death",
|
|
72
|
+
"is_launch_failure",
|
|
73
|
+
"load_transcript",
|
|
74
|
+
"read_session_durability",
|
|
75
|
+
"replay_into_fold",
|
|
76
|
+
"transcript_dirs",
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
EXPECTED_SCHEMA_FINGERPRINT: Final[str] = (
|
|
80
|
+
"sha256:ab69549a7ebb423fce94068762da0b5ff3cdec1f8fc263dcc17248eda117f852"
|
|
81
|
+
)
|
|
82
|
+
"""The stable schema-bundle fingerprint this SDK was built against.
|
|
83
|
+
|
|
84
|
+
The one deliberately duplicated fact (spec 638 FR-638-006, the 14990 FR-006
|
|
85
|
+
pattern): ``clients/sdk-py/tests/test_manifests.py`` binds it to
|
|
86
|
+
``schema/msp/stable/manifest.json``, so a schema advance that forgets the
|
|
87
|
+
Python SDK reds this lane instead of drifting silently.
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
# D-063 lockstep (ADR 25304 D4): the release train bumps pyproject.toml, the
|
|
91
|
+
# distribution-metadata authority; this constant is aligned at publication
|
|
92
|
+
# time (the publish itself is owner-run, permitted by D-065, ADR 29534 D1).
|
|
93
|
+
__version__: Final[str] = "1.3.0"
|
|
94
|
+
|
|
95
|
+
# The facade is imported last so the constants above are already bound: the
|
|
96
|
+
# spawn path reads ``EXPECTED_SCHEMA_FINGERPRINT`` (lazily, at initialize
|
|
97
|
+
# time), and importing the facade first would risk a partially initialized
|
|
98
|
+
# module.
|
|
99
|
+
from .facade import ( # noqa: E402
|
|
100
|
+
ApprovalDecisionInput,
|
|
101
|
+
ApprovalFailure,
|
|
102
|
+
ApprovalFailureHandler,
|
|
103
|
+
ApprovalHandler,
|
|
104
|
+
DiscardedSessions,
|
|
105
|
+
GapFillFailureHandler,
|
|
106
|
+
HostDeathDischarge,
|
|
107
|
+
HostDeathNotification,
|
|
108
|
+
MuseClient,
|
|
109
|
+
MuseClientOptions,
|
|
110
|
+
MuseClientSpawnOptions,
|
|
111
|
+
MuseHostDiedError,
|
|
112
|
+
PendingCommandView,
|
|
113
|
+
ResumeSessionOptions,
|
|
114
|
+
SendUserTurnOptions,
|
|
115
|
+
Session,
|
|
116
|
+
SessionApplyOutcome,
|
|
117
|
+
SessionDurabilityProfile,
|
|
118
|
+
SessionFoldView,
|
|
119
|
+
SessionGapBuffered,
|
|
120
|
+
SessionGapOverlap,
|
|
121
|
+
StartSessionOptions,
|
|
122
|
+
TransportEof,
|
|
123
|
+
Turn,
|
|
124
|
+
TurnOutcome,
|
|
125
|
+
is_abnormal_host_death,
|
|
126
|
+
is_launch_failure,
|
|
127
|
+
read_session_durability,
|
|
128
|
+
)
|
|
129
|
+
from .sync_facade import SyncMuseClient, SyncSession, SyncTurn # noqa: E402
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""The MSP connection plane (spec 638 FR-638-011..018): the transport-less
|
|
2
|
+
NDJSON connection machine, the owned-process spawn path, and host discovery.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from .connection import (
|
|
8
|
+
Connection,
|
|
9
|
+
DuplexTransport,
|
|
10
|
+
MspError,
|
|
11
|
+
NotificationHandler,
|
|
12
|
+
Params,
|
|
13
|
+
ProtocolError,
|
|
14
|
+
ProtocolErrorHandler,
|
|
15
|
+
RetryDelay,
|
|
16
|
+
ServerRequestHandler,
|
|
17
|
+
create_uuid_v7_mint,
|
|
18
|
+
)
|
|
19
|
+
from .discovery import discover_muse_bin
|
|
20
|
+
from .spawn import (
|
|
21
|
+
ConnectionOptions,
|
|
22
|
+
ExitClassification,
|
|
23
|
+
MspHandshake,
|
|
24
|
+
MuseServeChild,
|
|
25
|
+
ProcessExit,
|
|
26
|
+
SpawnedMspConnection,
|
|
27
|
+
spawn_msp_connection,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
__all__ = [
|
|
31
|
+
"Connection",
|
|
32
|
+
"ConnectionOptions",
|
|
33
|
+
"DuplexTransport",
|
|
34
|
+
"ExitClassification",
|
|
35
|
+
"MspError",
|
|
36
|
+
"MspHandshake",
|
|
37
|
+
"MuseServeChild",
|
|
38
|
+
"NotificationHandler",
|
|
39
|
+
"Params",
|
|
40
|
+
"ProcessExit",
|
|
41
|
+
"ProtocolError",
|
|
42
|
+
"ProtocolErrorHandler",
|
|
43
|
+
"RetryDelay",
|
|
44
|
+
"ServerRequestHandler",
|
|
45
|
+
"SpawnedMspConnection",
|
|
46
|
+
"create_uuid_v7_mint",
|
|
47
|
+
"discover_muse_bin",
|
|
48
|
+
"spawn_msp_connection",
|
|
49
|
+
]
|