answer42 0.5.8__tar.gz → 0.5.9__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.
- {answer42-0.5.8 → answer42-0.5.9}/PKG-INFO +2 -1
- {answer42-0.5.8 → answer42-0.5.9}/README.md +1 -0
- {answer42-0.5.8 → answer42-0.5.9}/pyproject.toml +1 -1
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/assets/MCPTestClient.cf +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/assets/MCPTestManager.cf +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/server.py +41 -3
- {answer42-0.5.8 → answer42-0.5.9}/.gitignore +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/LICENSE +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/credentials.example.json +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/docs/agent-installation.md +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/docs/architecture.md +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/docs/assets/answer42-logo.png +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/docs/assets/platform42-logo.svg +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/docs/installation.md +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/scripts/build_cf.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/scripts/build_pages.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/scripts/e2e_http_smoke.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/scripts/e2e_stable.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/scripts/openclaw_mcp_autoreload.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/scripts/rag_cli.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/scripts/read_webclient_start_info.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/cf/ConfigDumpInfo.xml +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/cf/Configuration.xml +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/cf/DataProcessors/MCPTestManager/Ext/ObjectModule.bsl +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/cf/DataProcessors/MCPTestManager/Forms//320/244/320/276/321/200/320/274/320/260/Ext/Form/Module.bsl" +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/cf/DataProcessors/MCPTestManager/Forms//320/244/320/276/321/200/320/274/320/260/Ext/Form.xml" +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/cf/DataProcessors/MCPTestManager/Forms//320/244/320/276/321/200/320/274/320/260.xml" +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/cf/DataProcessors/MCPTestManager.xml +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/cf/Ext/ManagedApplicationModule.bsl +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/cf/Languages//320/240/321/203/321/201/321/201/320/272/320/270/320/271.xml" +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/client_cf/Catalogs//320/237/320/241_/320/222/320/273/320/260/320/264/320/265/320/273/320/265/321/206.xml" +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/client_cf/Catalogs//320/237/320/241_/320/241/320/277/321/200/320/260/320/262/320/276/321/207/320/275/320/270/320/2721.xml" +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/client_cf/ConfigDumpInfo.xml +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/client_cf/Configuration.xml +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/client_cf/Languages//320/240/321/203/321/201/321/201/320/272/320/270/320/271.xml" +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/client_cf/Reports//320/237/320/241_/320/241/320/277/320/270/321/201/320/276/320/272/320/255/320/273/320/265/320/274/320/265/320/275/321/202/320/276/320/262/Ext/ManagerModule.bsl" +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/client_cf/Reports//320/237/320/241_/320/241/320/277/320/270/321/201/320/276/320/272/320/255/320/273/320/265/320/274/320/265/320/275/321/202/320/276/320/262/Ext/ObjectModule.bsl" +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/client_cf/Reports//320/237/320/241_/320/241/320/277/320/270/321/201/320/276/320/272/320/255/320/273/320/265/320/274/320/265/320/275/321/202/320/276/320/262/Templates//320/236/321/201/320/275/320/276/320/262/320/275/320/260/321/217/320/241/321/205/320/265/320/274/320/260/320/232/320/276/320/274/320/277/320/276/320/275/320/276/320/262/320/272/320/270/320/224/320/260/320/275/320/275/321/213/321/205/Ext/Template.xml" +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/client_cf/Reports//320/237/320/241_/320/241/320/277/320/270/321/201/320/276/320/272/320/255/320/273/320/265/320/274/320/265/320/275/321/202/320/276/320/262/Templates//320/236/321/201/320/275/320/276/320/262/320/275/320/260/321/217/320/241/321/205/320/265/320/274/320/260/320/232/320/276/320/274/320/277/320/276/320/275/320/276/320/262/320/272/320/270/320/224/320/260/320/275/320/275/321/213/321/205.xml" +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/client_cf/Reports//320/237/320/241_/320/241/320/277/320/270/321/201/320/276/320/272/320/255/320/273/320/265/320/274/320/265/320/275/321/202/320/276/320/262.xml" +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/__init__.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/assets/__init__.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/auth.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/bridge.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/credentials.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/os_support.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/platform.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/protocol.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/rag/__init__.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/rag/detect.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/rag/dump.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/rag/model.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/rag/parsers.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/rag/service.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/rag/store.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/rag/summary_backend.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/rag/summary_vector.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/recorder.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/release_helper.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/runtime.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/skill_installer.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/webclient_probe.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/win_desktop.py +0 -0
- {answer42-0.5.8 → answer42-0.5.9}/src/mcp_1c/window_control.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: answer42
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.9
|
|
4
4
|
Summary: Answer42 — The Answer to Life, Universe, and 1C — UI Driver. MCP-powered 1C:Enterprise UI automation: click, fill, navigate, test, and introspect managed forms through the test-client API
|
|
5
5
|
Author: Marvin (AI Assistant), 42Clouds, and contributors
|
|
6
6
|
Author-email: "Kosolapov Stanislav (proDOOMman)" <prodoomman@gmail.com>
|
|
@@ -190,6 +190,7 @@ answer42
|
|
|
190
190
|
- Каждый MCP-запрос должен содержать заголовок `Authorization: Bearer <token>`.
|
|
191
191
|
- `account_id` определяет namespace для credentials. Если не задан, вычисляется как стабильный хеш токена (`token-<16hex>`).
|
|
192
192
|
- Режим по умолчанию **stateless** (`--http-stateless`/`ONEC_MCP_HTTP_STATELESS` default `1`); для resumable sessions передай `--http-stateless`/`0`.
|
|
193
|
+
- Один HTTP-сервер обслуживает всех клиентов, поэтому неявной сессии по умолчанию нет: `start_session` без `session_id` создаёт сессию с уникальным id и возвращает его, а инструменты, работающие с сессией, без явного `session_id` возвращают ошибку. Список сессий — `sessions_list`.
|
|
193
194
|
|
|
194
195
|
## Безопасное хранение логинов и паролей
|
|
195
196
|
|
|
@@ -153,6 +153,7 @@ answer42
|
|
|
153
153
|
- Каждый MCP-запрос должен содержать заголовок `Authorization: Bearer <token>`.
|
|
154
154
|
- `account_id` определяет namespace для credentials. Если не задан, вычисляется как стабильный хеш токена (`token-<16hex>`).
|
|
155
155
|
- Режим по умолчанию **stateless** (`--http-stateless`/`ONEC_MCP_HTTP_STATELESS` default `1`); для resumable sessions передай `--http-stateless`/`0`.
|
|
156
|
+
- Один HTTP-сервер обслуживает всех клиентов, поэтому неявной сессии по умолчанию нет: `start_session` без `session_id` создаёт сессию с уникальным id и возвращает его, а инструменты, работающие с сессией, без явного `session_id` возвращают ошибку. Список сессий — `sessions_list`.
|
|
156
157
|
|
|
157
158
|
## Безопасное хранение логинов и паролей
|
|
158
159
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "answer42"
|
|
3
|
-
version = "0.5.
|
|
3
|
+
version = "0.5.9"
|
|
4
4
|
description = "Answer42 — The Answer to Life, Universe, and 1C — UI Driver. MCP-powered 1C:Enterprise UI automation: click, fill, navigate, test, and introspect managed forms through the test-client API"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
Binary file
|
|
Binary file
|
|
@@ -240,6 +240,7 @@ def _shared_file_servers_lock():
|
|
|
240
240
|
|
|
241
241
|
_PORT_BAND_SIZE = 20
|
|
242
242
|
_PORT_SCAN_WIDTH = 10
|
|
243
|
+
_PORT_FALLBACK_SCAN_WIDTH = 3000
|
|
243
244
|
|
|
244
245
|
|
|
245
246
|
@dataclass(slots=True)
|
|
@@ -511,7 +512,14 @@ def _stable_session_port_offset(session_id: str) -> int:
|
|
|
511
512
|
|
|
512
513
|
def _find_session_port(base: int, offset: int, *, sub_offset: int = 0) -> int:
|
|
513
514
|
start = base + offset + sub_offset
|
|
514
|
-
|
|
515
|
+
try:
|
|
516
|
+
return runtime.find_free_port(start, start + _PORT_SCAN_WIDTH)
|
|
517
|
+
except RuntimeError:
|
|
518
|
+
# The whole band can be unusable, e.g. inside a Windows excluded port
|
|
519
|
+
# range reserved by Hyper-V/WinNAT (netsh ... show excludedportrange).
|
|
520
|
+
port = runtime.find_free_port(start + _PORT_SCAN_WIDTH, start + _PORT_FALLBACK_SCAN_WIDTH)
|
|
521
|
+
logging.info("Port band %s..%s is unavailable; using port %s", start, start + _PORT_SCAN_WIDTH - 1, port)
|
|
522
|
+
return port
|
|
515
523
|
|
|
516
524
|
|
|
517
525
|
def _direct_range_from_regport(direct_regport: int, width: int = 8) -> tuple[int, int]:
|
|
@@ -1639,6 +1647,7 @@ async def _cleanup_failed_start_session(sess: SessionState, reason: str) -> None
|
|
|
1639
1647
|
|
|
1640
1648
|
|
|
1641
1649
|
async def _ensure_restored_session(session_id: str = DEFAULT_SESSION) -> SessionState:
|
|
1650
|
+
_require_explicit_session(session_id)
|
|
1642
1651
|
if session_id in _SESSIONS:
|
|
1643
1652
|
return _SESSIONS[session_id]
|
|
1644
1653
|
persisted = _load_persisted_sessions()
|
|
@@ -1676,7 +1685,28 @@ async def _wait_for_bridge_connected(sess: SessionState, timeout: float = 45.0)
|
|
|
1676
1685
|
)
|
|
1677
1686
|
|
|
1678
1687
|
|
|
1688
|
+
# StreamableHTTP serves every MCP client from one process, so an implicit
|
|
1689
|
+
# DEFAULT_SESSION would be silently shared between unrelated clients. In that
|
|
1690
|
+
# mode a tool that needs a 1C session must be given an explicit session_id.
|
|
1691
|
+
_REQUIRE_EXPLICIT_SESSION_ID = False
|
|
1692
|
+
_SESSION_ID_OMITTED: contextvars.ContextVar[bool] = contextvars.ContextVar(
|
|
1693
|
+
"answer42_session_id_omitted", default=False
|
|
1694
|
+
)
|
|
1695
|
+
|
|
1696
|
+
|
|
1697
|
+
def _require_explicit_session(session_id: str) -> None:
|
|
1698
|
+
if not (_REQUIRE_EXPLICIT_SESSION_ID and _SESSION_ID_OMITTED.get() and session_id == DEFAULT_SESSION):
|
|
1699
|
+
return
|
|
1700
|
+
known = sorted(set(_SESSIONS) | set(_load_persisted_sessions()))
|
|
1701
|
+
hint = f" Известные сессии: {', '.join(known)}." if known else " Сначала вызовите start_session."
|
|
1702
|
+
raise ToolError(
|
|
1703
|
+
"В режиме StreamableHTTP сервер общий для всех клиентов, поэтому session_id обязателен: "
|
|
1704
|
+
"передайте session_id, который вернул start_session (или см. sessions_list)." + hint
|
|
1705
|
+
)
|
|
1706
|
+
|
|
1707
|
+
|
|
1679
1708
|
def _session(session_id: str = DEFAULT_SESSION) -> SessionState:
|
|
1709
|
+
_require_explicit_session(session_id)
|
|
1680
1710
|
try:
|
|
1681
1711
|
return _SESSIONS[session_id]
|
|
1682
1712
|
except KeyError:
|
|
@@ -3802,6 +3832,9 @@ def _install_tool_call_logger() -> None:
|
|
|
3802
3832
|
session_id = params.get("session_id", DEFAULT_SESSION)
|
|
3803
3833
|
start = time.monotonic()
|
|
3804
3834
|
call_token = _MCP_TOOL_CALL_ACTIVE.set(True)
|
|
3835
|
+
omitted_token = _SESSION_ID_OMITTED.set(
|
|
3836
|
+
not (isinstance(params, dict) and str(params.get("session_id") or "").strip())
|
|
3837
|
+
)
|
|
3805
3838
|
try:
|
|
3806
3839
|
result = await original(*args, **kwargs)
|
|
3807
3840
|
_log_tool_call(session_id, name, params, result, None, time.monotonic() - start)
|
|
@@ -3814,6 +3847,7 @@ def _install_tool_call_logger() -> None:
|
|
|
3814
3847
|
_log_tool_call(session_id, name, params, None, str(exc), time.monotonic() - start)
|
|
3815
3848
|
raise
|
|
3816
3849
|
finally:
|
|
3850
|
+
_SESSION_ID_OMITTED.reset(omitted_token)
|
|
3817
3851
|
_MCP_TOOL_CALL_ACTIVE.reset(call_token)
|
|
3818
3852
|
|
|
3819
3853
|
mcp.call_tool = _logged_call_tool
|
|
@@ -4571,6 +4605,7 @@ def session_status(*,
|
|
|
4571
4605
|
session_id: Annotated[str, "Session id"] = DEFAULT_SESSION,
|
|
4572
4606
|
) -> dict[str, Any]:
|
|
4573
4607
|
"""Return bridge, runtime, test-client and RAG state for a session."""
|
|
4608
|
+
_require_explicit_session(session_id)
|
|
4574
4609
|
sess = _SESSIONS.get(session_id) or _load_persisted_sessions().get(session_id)
|
|
4575
4610
|
if sess is not None:
|
|
4576
4611
|
_touch_session(sess)
|
|
@@ -4757,7 +4792,9 @@ async def start_session(
|
|
|
4757
4792
|
logging.info("start_session: version=%s platform_dir=%s", actual_version, platform_dir)
|
|
4758
4793
|
mark_stage("resolve_credentials_version_platform")
|
|
4759
4794
|
|
|
4760
|
-
|
|
4795
|
+
# Over StreamableHTTP an implicit shared default would mix clients up:
|
|
4796
|
+
# give each new session its own id and return it to the caller.
|
|
4797
|
+
sid = session_id or (_new_session_id() if _REQUIRE_EXPLICIT_SESSION_ID else DEFAULT_SESSION)
|
|
4761
4798
|
if sid in _SESSIONS:
|
|
4762
4799
|
raise ValueError(f"Session {sid!r} already exists.")
|
|
4763
4800
|
|
|
@@ -10944,7 +10981,7 @@ def _apply_tool_profile(profile: str) -> dict[str, Any]:
|
|
|
10944
10981
|
|
|
10945
10982
|
|
|
10946
10983
|
def main(argv: list[str] | None = None) -> None:
|
|
10947
|
-
global _RAG_ENABLED, _CREDENTIAL_STORE_ENABLED, _DEV_TOOLS_ENABLED
|
|
10984
|
+
global _RAG_ENABLED, _CREDENTIAL_STORE_ENABLED, _DEV_TOOLS_ENABLED, _REQUIRE_EXPLICIT_SESSION_ID
|
|
10948
10985
|
|
|
10949
10986
|
argv = list(sys.argv[1:] if argv is None else argv)
|
|
10950
10987
|
if argv and argv[0] in {"install-skills", "skills-install"}:
|
|
@@ -11090,6 +11127,7 @@ def main(argv: list[str] | None = None) -> None:
|
|
|
11090
11127
|
stale = False
|
|
11091
11128
|
_reap_global_orphan_sessions()
|
|
11092
11129
|
if args.http:
|
|
11130
|
+
_REQUIRE_EXPLICIT_SESSION_ID = True
|
|
11093
11131
|
asyncio.run(_run_http(args))
|
|
11094
11132
|
else:
|
|
11095
11133
|
asyncio.run(_run(stale))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|