code-context-control 2.158.3__py3-none-any.whl → 2.158.4__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.
- cli/c3.py +1 -1
- cli/hook_session_open.py +18 -4
- cli/mcp_server.py +10 -1
- {code_context_control-2.158.3.dist-info → code_context_control-2.158.4.dist-info}/METADATA +1 -1
- {code_context_control-2.158.3.dist-info → code_context_control-2.158.4.dist-info}/RECORD +10 -9
- core/mcp_stack.py +114 -0
- {code_context_control-2.158.3.dist-info → code_context_control-2.158.4.dist-info}/WHEEL +0 -0
- {code_context_control-2.158.3.dist-info → code_context_control-2.158.4.dist-info}/entry_points.txt +0 -0
- {code_context_control-2.158.3.dist-info → code_context_control-2.158.4.dist-info}/licenses/LICENSE +0 -0
- {code_context_control-2.158.3.dist-info → code_context_control-2.158.4.dist-info}/top_level.txt +0 -0
cli/c3.py
CHANGED
|
@@ -91,7 +91,7 @@ console = Console() if HAS_RICH else None
|
|
|
91
91
|
# Config
|
|
92
92
|
CONFIG_DIR = ".c3"
|
|
93
93
|
CONFIG_FILE = ".c3/config.json"
|
|
94
|
-
__version__ = "2.158.
|
|
94
|
+
__version__ = "2.158.4"
|
|
95
95
|
|
|
96
96
|
# The PreToolUse matcher for native subagent calls (installer and hub migration).
|
|
97
97
|
AGENT_MATCHER = "Agent|Task"
|
cli/hook_session_open.py
CHANGED
|
@@ -40,14 +40,19 @@ by the host pid both of them share and hands it the new id
|
|
|
40
40
|
the same MCP process, and a "Session started" toast on every compaction
|
|
41
41
|
would teach the user to ignore the real ones.
|
|
42
42
|
|
|
43
|
+
When the installed fastmcp and mcp cannot load together
|
|
44
|
+
(``core.mcp_stack``), the MCP server dies before its handshake and the host
|
|
45
|
+
reports only a closed connection; this hook then returns the mismatch and
|
|
46
|
+
the pip repair as context, so the session can say why C3's tools are gone.
|
|
47
|
+
|
|
43
48
|
The MCP server's own ``session_start`` row is untouched — it carries the C3
|
|
44
49
|
id and, when the host put its id in the environment, ``host_session_id``
|
|
45
50
|
too. This hook is what lets a client see the session before the runtime has
|
|
46
51
|
finished starting (~seconds), and it is the row the desktop's "MCP failed to
|
|
47
52
|
connect" sentinel starts its 30 s clock from.
|
|
48
53
|
|
|
49
|
-
Returns None
|
|
50
|
-
|
|
54
|
+
Returns None, or ``{"_text": <mismatch>}`` for the case above: SessionStart
|
|
55
|
+
hook stdout becomes model context.
|
|
51
56
|
"""
|
|
52
57
|
from __future__ import annotations
|
|
53
58
|
|
|
@@ -249,10 +254,19 @@ def hand_off_runtime(project: Path, host: str, host_sid: str, start_source: str)
|
|
|
249
254
|
|
|
250
255
|
|
|
251
256
|
def run(payload: dict, project_path: Path | None = None):
|
|
252
|
-
"""Core logic — importable by the dispatcher and tests.
|
|
257
|
+
"""Core logic — importable by the dispatcher and tests.
|
|
258
|
+
|
|
259
|
+
Returns None, or ``{"_text": ...}`` naming a fastmcp/mcp mismatch.
|
|
260
|
+
"""
|
|
253
261
|
start_source = str(payload.get("source") or "").strip().lower()
|
|
254
262
|
if start_source in _SILENT_SOURCES:
|
|
255
263
|
return None
|
|
264
|
+
try:
|
|
265
|
+
from core.mcp_stack import problem
|
|
266
|
+
stack_problem = problem()
|
|
267
|
+
except Exception as exc:
|
|
268
|
+
log_hook_error("hook_session_open", exc)
|
|
269
|
+
stack_problem = None
|
|
256
270
|
project = find_project(payload, project_path)
|
|
257
271
|
if project is None:
|
|
258
272
|
return None
|
|
@@ -278,7 +292,7 @@ def run(payload: dict, project_path: Path | None = None):
|
|
|
278
292
|
pass
|
|
279
293
|
hand_off_runtime(project, host, host_sid, start_source)
|
|
280
294
|
ensure_ui(project, host_sid)
|
|
281
|
-
return None
|
|
295
|
+
return {"_text": stack_problem} if stack_problem else None
|
|
282
296
|
|
|
283
297
|
|
|
284
298
|
def main() -> None:
|
cli/mcp_server.py
CHANGED
|
@@ -21,7 +21,16 @@ from typing import Any
|
|
|
21
21
|
# Add parent to path for imports
|
|
22
22
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
try:
|
|
25
|
+
from fastmcp import Context, FastMCP
|
|
26
|
+
except Exception:
|
|
27
|
+
# The host shows only "connection closed"; stderr reaches its MCP log.
|
|
28
|
+
from core.mcp_stack import problem as _mcp_stack_problem
|
|
29
|
+
_stack_problem = _mcp_stack_problem()
|
|
30
|
+
if not _stack_problem:
|
|
31
|
+
raise
|
|
32
|
+
print(_stack_problem, file=sys.stderr)
|
|
33
|
+
raise SystemExit(1)
|
|
25
34
|
|
|
26
35
|
from cli.tools import _grants
|
|
27
36
|
from core.host import resolve_host
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: code-context-control
|
|
3
|
-
Version: 2.158.
|
|
3
|
+
Version: 2.158.4
|
|
4
4
|
Summary: Local MCP code-intelligence for AI coding tools: surgical search/read/edit, agent-config version history, path-level access + masking guards, and a multi-project hub.
|
|
5
5
|
Author-email: Dimitri Tselenchuk <dtselenc@gmail.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
cli/__init__.py,sha256=ec66drCZGNMRU4V6ov0zVhYZph1us12Vn8OvG_LJyRY,22
|
|
2
2
|
cli/_hook_utils.py,sha256=RhfS2WS5VMSi2w2Jxcts1wg5WC-UFp89JOQvcO5Jjb8,23002
|
|
3
3
|
cli/_shell_writes.py,sha256=iBbzK0v0d29rhrYgF3zKJIJbb1WSZhQjD_6w8-nOUec,7348
|
|
4
|
-
cli/c3.py,sha256=
|
|
4
|
+
cli/c3.py,sha256=QlpcSyxOZU2-Bx8q8d46RZiGQ1Q9W0myjH5Z_naXKHE,439372
|
|
5
5
|
cli/docs.html,sha256=pPxcP5ieY0DcfEDvegwIcRxbz1woLZoKLVSF-4JVy0Q,146784
|
|
6
6
|
cli/edits.html,sha256=UjAhoCmBmQ89cklGvJqzC6eyNP2tc8H6T-e01DVkLvE,43418
|
|
7
7
|
cli/hook_access_guard.py,sha256=4UF2YHp5_vISH7Gvolc_Bz3ppSye2lGpGx38egRLj1g,32116
|
|
@@ -20,13 +20,13 @@ cli/hook_pretool_enforce.py,sha256=pSFYgqiXktJPpNuzGXiFPhcGQRDN9QjMjpQHliO_7XQ,3
|
|
|
20
20
|
cli/hook_prompt_recall.py,sha256=LHyubu36pf5h3hbLBe0yH-yGhAlwLJdsc7hfa7WB1h4,3471
|
|
21
21
|
cli/hook_read.py,sha256=ZWZldgqGSNz78COhlgETQ7yxdOW5vWIIHUet9gZKhxk,8176
|
|
22
22
|
cli/hook_session_end.py,sha256=toFEPDKRoutDuVOmuOgHmQ8CM0o7tF7yALhMxJz7VEM,3482
|
|
23
|
-
cli/hook_session_open.py,sha256=
|
|
23
|
+
cli/hook_session_open.py,sha256=Bq8zKPkucPYASQDxJcT1bGm975d__RbTvaiWj9yVcDs,11969
|
|
24
24
|
cli/hook_session_stats.py,sha256=I-2NeLlV1NxeqKtTM2JH9haSpFU7r4qG0u8pfCJ80YU,8725
|
|
25
25
|
cli/hook_terse_advisor.py,sha256=W_zaTfX2akgX-ifuUTsLu2H1atM8XmWt6jpPoeU7Pm0,6252
|
|
26
26
|
cli/hub_server.py,sha256=CnpI0kqpVX-rJkPnGiVyuej8Ay0VHzBLWc-ZxDhEVZA,226168
|
|
27
27
|
cli/hub_ui.html,sha256=v41R_JAH4Jwodpy3tbeBUel-80FbNmffBrey-QH5Q64,2963
|
|
28
28
|
cli/mcp_proxy.py,sha256=r-Qhlie7gCtotex8yQUudCyBLRUK-IW6cNIW5RhBW0o,17648
|
|
29
|
-
cli/mcp_server.py,sha256=
|
|
29
|
+
cli/mcp_server.py,sha256=RcuX1Ljle6kRuMqzmwjsxkLHVQuATepaLJ1C3qIS4u4,84445
|
|
30
30
|
cli/progress.py,sha256=qTkNy0howOD3hXraMo4ok3dYTpBW5yG_tenKfF4UDM0,1470
|
|
31
31
|
cli/server.py,sha256=SQFONagf4Mmsv2Z0fdnr8cxAFUsBE3nPQ5XUZLgtjI8,174039
|
|
32
32
|
cli/ui.html,sha256=uuPwIJNKDQH_fsaR3xNB2AKky9WzKfaXnKr_k3aTtxo,5715
|
|
@@ -135,7 +135,7 @@ cli/ui/components/sessions.js,sha256=FIKtil76B8tCkAmcFV7hlj6GQ_DCJK2jCzvEmdK7NBE
|
|
|
135
135
|
cli/ui/components/settings.js,sha256=FXcn-UQE2mXC6HFsLeEas-wAUFKt0OJaLySroZQMhGA,84095
|
|
136
136
|
cli/ui/components/sidebar.js,sha256=K2ym2kUgpbyG-EBA_wBIIiqQY8qTatsiBZwzseMWuIQ,9939
|
|
137
137
|
cli/ui/components/tasks.js,sha256=vyKQ3uwoppMwvdEaHlhWXW4oWcAisx4NveqzMhsYqHo,38438
|
|
138
|
-
code_context_control-2.158.
|
|
138
|
+
code_context_control-2.158.4.dist-info/licenses/LICENSE,sha256=l8Kh5QCNWNvR6kIt8L0BUZvc2LAFiHv2c-FnsGnUZf4,11301
|
|
139
139
|
core/__init__.py,sha256=TSDCEcM4V7gcZVM3w2ykJaqEUch4Dkon-rivV17T73s,2501
|
|
140
140
|
core/codex_patch.py,sha256=CxvT_rQIwPNTRJZj9EHJmx0ZdOeSLxjiixuLI3Z7lPc,2107
|
|
141
141
|
core/config.py,sha256=wCjrZKXRywUbR6WRcO7optyOirAQ2DeRNdPCU0X5zIY,23762
|
|
@@ -143,6 +143,7 @@ core/grok_payload.py,sha256=EEwhvkKnCT6Rk9tc-DWDA__toE44244Xr4d6p7SoJwE,5365
|
|
|
143
143
|
core/hook_command.py,sha256=SvTDUaBLg1Qb4ZdAgpe14YA_8BSnkGJsd3ByPtqBsU0,1032
|
|
144
144
|
core/host.py,sha256=WUzS-572l9azYvu1Y4fmAVvb_0g4xyXqzsayJP_zH3M,2075
|
|
145
145
|
core/ide.py,sha256=0sk2MzrgIScE5fN1cIpjMrNqE5j1Hz_kyPfCT2w-ac8,7061
|
|
146
|
+
core/mcp_stack.py,sha256=ZCiCNKtN-IHFhwyRWz1djFFV1a3vbKBKB6Aefz1HvCo,4462
|
|
146
147
|
core/mcp_toml.py,sha256=VNZCjJsr4II_jX3cmjYzDh_OQ7Nk34mLnkg528Tl1GM,7047
|
|
147
148
|
core/web_security.py,sha256=HwgK5aBATfvRIeO_4gWgzK77gKwGuzVlmiuNGm4gGxI,7884
|
|
148
149
|
oracle/__init__.py,sha256=-OTD7Jh4mUMA4QgPGthPLWXttgZLpkIPhGQ87ZfHBx0,63
|
|
@@ -350,8 +351,8 @@ tui/screens/search_view.py,sha256=MMHjVdlk3HZSuDBSvq8IGrqv_Mh5Us6YqXQ80bcWSMk,19
|
|
|
350
351
|
tui/screens/session_view.py,sha256=eZ1eDwHTvPOck1wCCviixtOaCxIkBT_95ytNNNriGNA,5991
|
|
351
352
|
tui/screens/stats.py,sha256=p81PjzdaIv7hllb8f45-rlVe4lJZwSdIMqu7e86_u5s,6223
|
|
352
353
|
tui/screens/ui_view.py,sha256=1QJCgLh2YfgWIpvzRG1KOGXYEaOYX6ojN61Azjf2oX0,2125
|
|
353
|
-
code_context_control-2.158.
|
|
354
|
-
code_context_control-2.158.
|
|
355
|
-
code_context_control-2.158.
|
|
356
|
-
code_context_control-2.158.
|
|
357
|
-
code_context_control-2.158.
|
|
354
|
+
code_context_control-2.158.4.dist-info/METADATA,sha256=eM1RQSOMs0j_umJH6cdy2z9XvyRIpBbnfFmTk-2QU5A,29355
|
|
355
|
+
code_context_control-2.158.4.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
356
|
+
code_context_control-2.158.4.dist-info/entry_points.txt,sha256=7kX_WUsDCF2hbXzvbNyscyaBb9AeA-DJY5v_5hN0DlU,93
|
|
357
|
+
code_context_control-2.158.4.dist-info/top_level.txt,sha256=wRt41zBybVF3qAiNXHz9BURbkKvUvfhmWWtKMhaw6eE,29
|
|
358
|
+
code_context_control-2.158.4.dist-info/RECORD,,
|
core/mcp_stack.py
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"""Whether the installed fastmcp and mcp packages can load together.
|
|
2
|
+
|
|
3
|
+
fastmcp 3.x needs ``mcp<2`` and 4.x needs ``mcp>=2``, and pip installing some
|
|
4
|
+
other tool can move mcp out from under fastmcp anyway. Reads installed
|
|
5
|
+
metadata without importing either package, so the MCP server and the
|
|
6
|
+
SessionStart hook can name the mismatch and the pip command that repairs it.
|
|
7
|
+
"""
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import sys
|
|
11
|
+
from importlib import metadata
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
|
|
14
|
+
# fastmcp-slim declares mcp under these extras; fastmcp 3.2 and earlier
|
|
15
|
+
# declare it unconditionally ("").
|
|
16
|
+
_EXTRAS = ("", "client", "server", "mcp")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _packaging():
|
|
20
|
+
"""packaging's (Requirement, InvalidRequirement, canonicalize_name), or None."""
|
|
21
|
+
try:
|
|
22
|
+
from packaging.requirements import InvalidRequirement, Requirement
|
|
23
|
+
from packaging.utils import canonicalize_name
|
|
24
|
+
except ImportError:
|
|
25
|
+
try:
|
|
26
|
+
from pip._vendor.packaging.requirements import InvalidRequirement, Requirement
|
|
27
|
+
from pip._vendor.packaging.utils import canonicalize_name
|
|
28
|
+
except ImportError:
|
|
29
|
+
return None
|
|
30
|
+
return Requirement, InvalidRequirement, canonicalize_name
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _version(dist: str) -> str | None:
|
|
34
|
+
try:
|
|
35
|
+
return metadata.version(dist)
|
|
36
|
+
except metadata.PackageNotFoundError:
|
|
37
|
+
return None
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _mcp_requirement(requirement_cls, invalid_requirement, canonicalize_name):
|
|
41
|
+
"""The mcp Requirement the installed fastmcp declares, or None."""
|
|
42
|
+
fastmcp = _version("fastmcp")
|
|
43
|
+
if fastmcp is None:
|
|
44
|
+
return None
|
|
45
|
+
# From 3.3 the fastmcp wheel only depends on fastmcp-slim, which carries
|
|
46
|
+
# the mcp pin. A slim left behind at another version is not the code in
|
|
47
|
+
# use, so read it only when the two versions match.
|
|
48
|
+
dists = ["fastmcp"]
|
|
49
|
+
if _version("fastmcp-slim") == fastmcp:
|
|
50
|
+
dists.insert(0, "fastmcp-slim")
|
|
51
|
+
for dist in dists:
|
|
52
|
+
for raw in metadata.requires(dist) or []:
|
|
53
|
+
try:
|
|
54
|
+
req = requirement_cls(raw)
|
|
55
|
+
except invalid_requirement:
|
|
56
|
+
continue
|
|
57
|
+
if canonicalize_name(req.name) != "mcp":
|
|
58
|
+
continue
|
|
59
|
+
if req.marker is None or any(
|
|
60
|
+
req.marker.evaluate({"extra": e}) for e in _EXTRAS):
|
|
61
|
+
return req
|
|
62
|
+
return None
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _console_python(executable: str) -> str:
|
|
66
|
+
"""python.exe in place of pythonw.exe: the repair command needs a console."""
|
|
67
|
+
exe = Path(executable)
|
|
68
|
+
if exe.name.lower() == "pythonw.exe":
|
|
69
|
+
console = exe.with_name("python.exe")
|
|
70
|
+
if console.exists():
|
|
71
|
+
return str(console)
|
|
72
|
+
return executable
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def problem(executable: str | None = None) -> str | None:
|
|
76
|
+
"""Describe a fastmcp/mcp mismatch and how to repair it, or return None.
|
|
77
|
+
|
|
78
|
+
None also covers what this cannot judge: fastmcp not installed, no mcp pin
|
|
79
|
+
in its metadata, or no ``packaging`` to read the pin with.
|
|
80
|
+
"""
|
|
81
|
+
tools = _packaging()
|
|
82
|
+
if tools is None:
|
|
83
|
+
return None
|
|
84
|
+
req = _mcp_requirement(*tools)
|
|
85
|
+
if req is None:
|
|
86
|
+
return None
|
|
87
|
+
fastmcp = _version("fastmcp")
|
|
88
|
+
mcp = _version("mcp")
|
|
89
|
+
spec = str(req.specifier)
|
|
90
|
+
python = _console_python(executable or sys.executable)
|
|
91
|
+
pip = f'"{python}" -m pip'
|
|
92
|
+
if mcp is None:
|
|
93
|
+
return (f"C3's MCP server cannot start: fastmcp {fastmcp} needs "
|
|
94
|
+
f"mcp{spec}, and mcp is not installed in {sys.prefix}.\n"
|
|
95
|
+
f'Repair: {pip} install "mcp{spec}", then restart the session.')
|
|
96
|
+
if req.specifier.contains(mcp, prereleases=True):
|
|
97
|
+
return None
|
|
98
|
+
too_new = any(s.operator in ("<", "<=") and not s.contains(mcp, prereleases=True)
|
|
99
|
+
for s in req.specifier)
|
|
100
|
+
lines = [
|
|
101
|
+
f"C3's MCP server cannot start: fastmcp {fastmcp} needs mcp{spec}, "
|
|
102
|
+
f"but mcp {mcp} is installed in {sys.prefix}. Installing another "
|
|
103
|
+
"package that wants a different mcp moves it; pip warns about the "
|
|
104
|
+
"conflict but installs anyway.",
|
|
105
|
+
"Repair with one of:",
|
|
106
|
+
]
|
|
107
|
+
if too_new:
|
|
108
|
+
lines.append(f" {pip} install --upgrade fastmcp "
|
|
109
|
+
f"(moves fastmcp to the release built for mcp {mcp})")
|
|
110
|
+
lines.append(f' {pip} install "mcp{spec}" '
|
|
111
|
+
f"(moves mcp back to what fastmcp {fastmcp} needs)")
|
|
112
|
+
lines.append(f"Then run {pip} check to see whether another package "
|
|
113
|
+
"needs the other mcp line, and restart the session.")
|
|
114
|
+
return "\n".join(lines)
|
|
File without changes
|
{code_context_control-2.158.3.dist-info → code_context_control-2.158.4.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{code_context_control-2.158.3.dist-info → code_context_control-2.158.4.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{code_context_control-2.158.3.dist-info → code_context_control-2.158.4.dist-info}/top_level.txt
RENAMED
|
File without changes
|