answer42 0.11.2__tar.gz → 0.11.4__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.11.2 → answer42-0.11.4}/PKG-INFO +1 -1
- {answer42-0.11.2 → answer42-0.11.4}/pyproject.toml +1 -1
- {answer42-0.11.2 → answer42-0.11.4}/src/cf/DataProcessors/MCPTestManager/Forms//320/244/320/276/321/200/320/274/320/260/Ext/Form/Module.bsl +5 -1
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/assets/MCPTestClient.cf +0 -0
- answer42-0.11.4/src/mcp_1c/assets/MCPTestManager.cf +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/browser_agent.py +73 -10
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/protocol.py +1 -1
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/server.py +13 -3
- answer42-0.11.2/src/mcp_1c/assets/MCPTestManager.cf +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/.gitignore +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/LICENSE +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/README.md +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/credentials.example.json +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/docs/agent-installation.md +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/docs/architecture.md +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/docs/assets/answer42-logo.png +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/docs/assets/platform42-logo.svg +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/docs/installation.md +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/scripts/build_cf.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/scripts/e2e_http_smoke.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/scripts/e2e_stable.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/scripts/openclaw_mcp_autoreload.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/scripts/rag_cli.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/scripts/read_webclient_start_info.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/cf/ConfigDumpInfo.xml +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/cf/Configuration.xml +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/cf/DataProcessors/MCPTestManager/Ext/ObjectModule.bsl +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/cf/DataProcessors/MCPTestManager/Forms//320/244/320/276/321/200/320/274/320/260/Ext/Form.xml" +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/cf/DataProcessors/MCPTestManager/Forms//320/244/320/276/321/200/320/274/320/260.xml" +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/cf/DataProcessors/MCPTestManager.xml +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/cf/Ext/ManagedApplicationModule.bsl +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/cf/Languages//320/240/321/203/321/201/321/201/320/272/320/270/320/271.xml" +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/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.11.2 → answer42-0.11.4}/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.11.2 → answer42-0.11.4}/src/client_cf/ConfigDumpInfo.xml +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/client_cf/Configuration.xml +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/client_cf/Languages//320/240/321/203/321/201/321/201/320/272/320/270/320/271.xml" +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/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.11.2 → answer42-0.11.4}/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.11.2 → answer42-0.11.4}/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.11.2 → answer42-0.11.4}/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.11.2 → answer42-0.11.4}/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.11.2 → answer42-0.11.4}/src/mcp_1c/__init__.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/assets/__init__.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/auth.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/bridge.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/credentials.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/credentials_cli.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/html_agent.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/os_support.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/platform.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/rag/__init__.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/rag/detect.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/rag/dump.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/rag/model.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/rag/parsers.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/rag/service.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/rag/store.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/rag/summary_backend.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/rag/summary_vector.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/recorder.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/release_helper.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/runtime.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/skill_installer.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/tool_groups.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/webclient_probe.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/webkit_patch.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/src/mcp_1c/win_desktop.py +0 -0
- {answer42-0.11.2 → answer42-0.11.4}/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.11.
|
|
3
|
+
Version: 0.11.4
|
|
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>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "answer42"
|
|
3
|
-
version = "0.11.
|
|
3
|
+
version = "0.11.4"
|
|
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"
|
|
@@ -359,7 +359,7 @@
|
|
|
359
359
|
|
|
360
360
|
&НаКлиенте
|
|
361
361
|
Функция ВерсияПротоколаМенеджераMCP()
|
|
362
|
-
Возврат "2026.11.
|
|
362
|
+
Возврат "2026.11.16.1";
|
|
363
363
|
КонецФункции
|
|
364
364
|
|
|
365
365
|
&НаКлиенте
|
|
@@ -761,8 +761,12 @@
|
|
|
761
761
|
// Клиент тестирования в браузере: его находят по идентификатору (параметр TESTCLIENTID адреса публикации),
|
|
762
762
|
// без адреса и порта: с ними платформа ищет тонкий клиент по TCP и не находит браузер.
|
|
763
763
|
ИдентификаторКлиента = СвойствоСтруктуры(Параметры, "client_id", "");
|
|
764
|
+
АдресСервераСопряжения = СвойствоСтруктуры(Параметры, "pairing_host", "");
|
|
764
765
|
Если ПустаяСтрока(ИдентификаторКлиента) Тогда
|
|
765
766
|
ТестируемоеПриложение = Новый ТестируемоеПриложение(АдресКлиентаТестирования, Порт);
|
|
767
|
+
ИначеЕсли Не ПустаяСтрока(АдресСервераСопряжения) Тогда
|
|
768
|
+
// Клиент зарегистрирован на другом сервере (менеджер кластера, порт 1541, или веб-сервер, порт 1538).
|
|
769
|
+
ТестируемоеПриложение = Новый ТестируемоеПриложение(АдресСервераСопряжения, СвойствоСтруктуры(Параметры, "pairing_port", 1541), ИдентификаторКлиента);
|
|
766
770
|
Иначе
|
|
767
771
|
ТестируемоеПриложение = Новый ТестируемоеПриложение(Неопределено, Неопределено, ИдентификаторКлиента);
|
|
768
772
|
КонецЕсли;
|
|
Binary file
|
|
Binary file
|
|
@@ -171,15 +171,24 @@ class BrowserPage:
|
|
|
171
171
|
closed: bool = False
|
|
172
172
|
console_log: list[dict[str, Any]] = field(default_factory=list)
|
|
173
173
|
reader: asyncio.Task | None = None
|
|
174
|
+
kind: str = "page" # "iframe": a cross-origin frame the browser runs as a target of its own
|
|
175
|
+
parent: BrowserPage | None = None # a frame of the parent page (an HTML document field is one)
|
|
176
|
+
frame_id: str = ""
|
|
177
|
+
contexts: dict[str, int] = field(default_factory=dict) # frame id -> its main execution context
|
|
174
178
|
|
|
175
179
|
def to_json(self) -> dict[str, Any]:
|
|
176
|
-
|
|
180
|
+
data = {
|
|
177
181
|
"page": self.page_id,
|
|
178
182
|
"url": self.url,
|
|
179
183
|
"title": self.title,
|
|
180
184
|
"alive": not self.closed,
|
|
181
185
|
"opened_at": _dt.datetime.fromtimestamp(self.opened_at, _dt.UTC).isoformat(timespec="seconds"),
|
|
182
186
|
}
|
|
187
|
+
if self.parent is not None:
|
|
188
|
+
data["frame_of"] = self.parent.page_id
|
|
189
|
+
if self.kind != "page":
|
|
190
|
+
data["kind"] = self.kind
|
|
191
|
+
return data
|
|
183
192
|
|
|
184
193
|
|
|
185
194
|
def _console_entry(method: str, params: dict[str, Any]) -> dict[str, Any] | None:
|
|
@@ -223,6 +232,7 @@ class BrowserBridge:
|
|
|
223
232
|
self.process: subprocess.Popen[Any] | None = None
|
|
224
233
|
self.profile_dir: Path | None = None
|
|
225
234
|
self.pages: dict[str, BrowserPage] = {}
|
|
235
|
+
self.frames: dict[str, BrowserPage] = {} # child frames of the live pages, rebuilt by refresh_frames
|
|
226
236
|
self.last_error = ""
|
|
227
237
|
self.start_url = ""
|
|
228
238
|
self.client_id = ""
|
|
@@ -315,7 +325,7 @@ class BrowserBridge:
|
|
|
315
325
|
def fetch() -> list[dict[str, Any]]:
|
|
316
326
|
reply = requests.get(f"http://127.0.0.1:{self.cdp_port}/json/list", timeout=3)
|
|
317
327
|
reply.raise_for_status()
|
|
318
|
-
return [t for t in reply.json() if t.get("type")
|
|
328
|
+
return [t for t in reply.json() if t.get("type") in ("page", "iframe") and t.get("webSocketDebuggerUrl")]
|
|
319
329
|
|
|
320
330
|
return await asyncio.to_thread(fetch)
|
|
321
331
|
|
|
@@ -328,6 +338,20 @@ class BrowserBridge:
|
|
|
328
338
|
if future is not None and not future.done():
|
|
329
339
|
future.set_result(message)
|
|
330
340
|
continue
|
|
341
|
+
method = message.get("method")
|
|
342
|
+
if method == "Runtime.executionContextCreated":
|
|
343
|
+
context = (message.get("params") or {}).get("context") or {}
|
|
344
|
+
aux = context.get("auxData") or {}
|
|
345
|
+
if aux.get("isDefault") and aux.get("frameId"):
|
|
346
|
+
page.contexts[str(aux["frameId"])] = int(context["id"])
|
|
347
|
+
continue
|
|
348
|
+
if method == "Runtime.executionContextDestroyed":
|
|
349
|
+
gone = (message.get("params") or {}).get("executionContextId")
|
|
350
|
+
page.contexts = {k: v for k, v in page.contexts.items() if v != gone}
|
|
351
|
+
continue
|
|
352
|
+
if method == "Runtime.executionContextsCleared":
|
|
353
|
+
page.contexts.clear()
|
|
354
|
+
continue
|
|
331
355
|
if message.get("method") == "Network.responseReceived":
|
|
332
356
|
self._note_test_request(message.get("params") or {})
|
|
333
357
|
continue
|
|
@@ -352,6 +376,7 @@ class BrowserBridge:
|
|
|
352
376
|
counter[status] = counter.get(status, 0) + 1
|
|
353
377
|
|
|
354
378
|
async def send(self, page: BrowserPage, method: str, params: dict[str, Any] | None = None, timeout: float = 30.0) -> Any:
|
|
379
|
+
page = page.parent or page # a frame is reached through the connection of its page
|
|
355
380
|
if page.closed or page.connection is None:
|
|
356
381
|
raise HtmlAgentError(f"Page {page.page_id} is closed")
|
|
357
382
|
message_id = next(self._ids)
|
|
@@ -389,7 +414,8 @@ class BrowserBridge:
|
|
|
389
414
|
if existing is not None and not existing.closed:
|
|
390
415
|
continue
|
|
391
416
|
page = BrowserPage(f"browser{next(self._numbers)}", target["id"], target["webSocketDebuggerUrl"],
|
|
392
|
-
url=str(target.get("url") or ""), title=str(target.get("title") or "")
|
|
417
|
+
url=str(target.get("url") or ""), title=str(target.get("title") or ""),
|
|
418
|
+
kind="iframe" if target.get("type") == "iframe" else "page")
|
|
393
419
|
try:
|
|
394
420
|
page.connection = await websockets.connect(page.ws_url, max_size=None, ping_interval=None)
|
|
395
421
|
except Exception as exc:
|
|
@@ -411,10 +437,14 @@ class BrowserBridge:
|
|
|
411
437
|
# --- the HtmlInspector interface ---
|
|
412
438
|
|
|
413
439
|
async def evaluate(self, page: BrowserPage, expression: str, timeout: float = 30.0) -> Any:
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
440
|
+
params: dict[str, Any] = {"expression": expression, "returnByValue": True, "awaitPromise": True, "userGesture": True}
|
|
441
|
+
if page.parent is not None:
|
|
442
|
+
context = page.parent.contexts.get(page.frame_id)
|
|
443
|
+
if context is None: # the frame's own world was not announced: an isolated one sees the same DOM
|
|
444
|
+
world = await self.send(page, "Page.createIsolatedWorld", {"frameId": page.frame_id, "worldName": "answer42"})
|
|
445
|
+
context = world.get("executionContextId")
|
|
446
|
+
params["contextId"] = context
|
|
447
|
+
result = await self.send(page, "Runtime.evaluate", params, timeout=timeout)
|
|
418
448
|
if result.get("exceptionDetails"):
|
|
419
449
|
details = result["exceptionDetails"]
|
|
420
450
|
exception = details.get("exception") or {}
|
|
@@ -431,18 +461,47 @@ class BrowserBridge:
|
|
|
431
461
|
info = await self.run(page, "info", {}, timeout=10)
|
|
432
462
|
page.url, page.title = str(info.get("url") or ""), str(info.get("title") or "")
|
|
433
463
|
|
|
464
|
+
async def refresh_frames(self) -> None:
|
|
465
|
+
"""Rebuild the list of child frames (HTML document fields among them) of the live pages."""
|
|
466
|
+
fresh: dict[str, BrowserPage] = {}
|
|
467
|
+
|
|
468
|
+
def walk(tree: dict[str, Any], top: BrowserPage) -> None:
|
|
469
|
+
for child in tree.get("childFrames") or []:
|
|
470
|
+
frame = child.get("frame") or {}
|
|
471
|
+
page_id = f"{top.page_id}.f{len([k for k in fresh if k.startswith(top.page_id + '.')]) + 1}"
|
|
472
|
+
fresh[page_id] = BrowserPage(
|
|
473
|
+
page_id, f"{top.target_id}:{frame.get('id')}", "", url=str(frame.get("url") or ""),
|
|
474
|
+
title=str(frame.get("name") or ""), parent=top, frame_id=str(frame.get("id") or ""),
|
|
475
|
+
)
|
|
476
|
+
walk(child, top)
|
|
477
|
+
|
|
478
|
+
for top in self.pages.values():
|
|
479
|
+
if top.closed:
|
|
480
|
+
continue
|
|
481
|
+
with suppress(HtmlAgentError):
|
|
482
|
+
tree = (await self.send(top, "Page.getFrameTree", timeout=10)).get("frameTree") or {}
|
|
483
|
+
walk(tree, top)
|
|
484
|
+
self.frames = fresh
|
|
485
|
+
for frame_page in fresh.values():
|
|
486
|
+
with suppress(HtmlAgentError):
|
|
487
|
+
await self.refresh(frame_page)
|
|
488
|
+
|
|
434
489
|
async def list_pages(self, include_dead: bool = False) -> list[dict[str, Any]]:
|
|
435
490
|
for page in self.pages.values():
|
|
436
491
|
if not page.closed:
|
|
437
492
|
with suppress(HtmlAgentError):
|
|
438
493
|
await self.refresh(page)
|
|
439
|
-
|
|
494
|
+
await self.refresh_frames()
|
|
495
|
+
listed = [p for p in self.pages.values() if include_dead or not p.closed]
|
|
496
|
+
return [p.to_json() for p in [*listed, *self.frames.values()]]
|
|
440
497
|
|
|
441
498
|
def resolve_page(self, selector: str = "") -> BrowserPage:
|
|
442
499
|
alive = [p for p in self.pages.values() if not p.closed]
|
|
443
500
|
if selector:
|
|
444
501
|
if selector in self.pages:
|
|
445
502
|
return self.pages[selector]
|
|
503
|
+
if selector in self.frames:
|
|
504
|
+
return self.frames[selector]
|
|
446
505
|
found = [p for p in alive if selector.lower() in p.url.lower() or selector.lower() in p.title.lower()]
|
|
447
506
|
if len(found) == 1:
|
|
448
507
|
return found[0]
|
|
@@ -450,6 +509,7 @@ class BrowserBridge:
|
|
|
450
509
|
f"{'Several' if found else 'No'} live browser pages match {selector!r}; pages: "
|
|
451
510
|
+ json.dumps([p.to_json() for p in alive], ensure_ascii=False)
|
|
452
511
|
)
|
|
512
|
+
alive = [p for p in alive if p.kind == "page"] # without a selector only real pages, not cross-origin frames
|
|
453
513
|
if len(alive) == 1:
|
|
454
514
|
return alive[0]
|
|
455
515
|
if not alive:
|
|
@@ -458,6 +518,8 @@ class BrowserBridge:
|
|
|
458
518
|
|
|
459
519
|
async def page(self, selector: str = "") -> BrowserPage:
|
|
460
520
|
await self.open_inspectors()
|
|
521
|
+
if selector and selector not in self.pages:
|
|
522
|
+
await self.refresh_frames()
|
|
461
523
|
return self.resolve_page(selector)
|
|
462
524
|
|
|
463
525
|
async def command(self, selector: str, op: str, args: dict[str, Any], timeout: float = 30.0) -> Any:
|
|
@@ -466,9 +528,10 @@ class BrowserBridge:
|
|
|
466
528
|
async def console(self, selector: str = "", levels: frozenset[str] = frozenset({"error", "warning"}),
|
|
467
529
|
limit: int = 100, clear: bool = False, check_scripts: bool = True) -> dict[str, Any]:
|
|
468
530
|
page = await self.page(selector)
|
|
469
|
-
|
|
531
|
+
log = (page.parent or page).console_log # frames share the console of their page
|
|
532
|
+
messages = list(log)
|
|
470
533
|
if clear:
|
|
471
|
-
|
|
534
|
+
log.clear()
|
|
472
535
|
selected = [m for m in messages if not levels or m.get("level") in levels]
|
|
473
536
|
result: dict[str, Any] = {"page": page.page_id, "url": page.url, "collected_since": "page connection"}
|
|
474
537
|
result["messages"] = selected[-limit:] if limit > 0 else selected
|
|
@@ -5534,6 +5534,7 @@ async def start_session(
|
|
|
5534
5534
|
client_mode: Annotated[str, "Test client kind: thin (1cv8c /TESTCLIENT; default, or ONEC_MCP_CLIENT_MODE) or browser (the 1C web client in Chrome/Edge: needs a web publication URL; the html_* tools then work on the whole client page as on a site: DOM, text, clicks, typing, scripts, console, plus browser_screenshot/browser_press_key/browser_navigate)"] = "",
|
|
5535
5535
|
browser_path: Annotated[str, "client_mode=browser: Chrome/Edge executable; empty = ONEC_MCP_BROWSER_PATH or an installed Chrome/Edge"] = "",
|
|
5536
5536
|
browser_headless: Annotated[bool, "client_mode=browser: run the browser without a window"] = False,
|
|
5537
|
+
browser_test_server: Annotated[str, "client_mode=browser, remote publication: host[:port] of the server the web client registers on for testing (cluster manager, default port 1541; file base: web server, 1538); empty = ONEC_MCP_BROWSER_TEST_SERVER"] = "",
|
|
5537
5538
|
html_mode: Annotated[str, "How the html_* tools reach live pages in HTML document fields: auto (Linux: remote; Windows: patched when the platform's Web Inspector has the Answer42 bridge, console otherwise; default, or ONEC_MCP_HTML_MODE), console (Windows: the inspector hot key and a loader typed into its console), patched (the bridge built into the inspector front end: Windows — installed into the platform, see html_inspector_patch; Linux — overlaid per session, nothing to install, needs xdotool), remote (Linux: the WebKitGTK remote inspector), disabled (no bridge: the html_* tools are unavailable)"] = "",
|
|
5538
5539
|
) -> dict[str, Any]:
|
|
5539
5540
|
"""One-shot session factory: detect version, start infrastructure, and connect the 1C test client.
|
|
@@ -5917,6 +5918,7 @@ async def start_session(
|
|
|
5917
5918
|
connect_result = await _connect_browser_client_impl(
|
|
5918
5919
|
sess, base_url=connect_base_url, username=username, password=password,
|
|
5919
5920
|
browser_path=browser_path, headless=browser_headless, query=browser_query,
|
|
5921
|
+
test_server=browser_test_server,
|
|
5920
5922
|
)
|
|
5921
5923
|
else:
|
|
5922
5924
|
connect_result = await _connect_test_client_impl(
|
|
@@ -6744,6 +6746,7 @@ async def _connect_browser_client_impl(
|
|
|
6744
6746
|
browser_path: str = "",
|
|
6745
6747
|
headless: bool = False,
|
|
6746
6748
|
query: str = "",
|
|
6749
|
+
test_server: str = "",
|
|
6747
6750
|
) -> Any:
|
|
6748
6751
|
"""Open the web client in Chrome/Edge as a test client and attach the test manager to it by identifier."""
|
|
6749
6752
|
start_monotonic = time.perf_counter()
|
|
@@ -6771,6 +6774,11 @@ async def _connect_browser_client_impl(
|
|
|
6771
6774
|
# The manager finds the browser client through the server of its own infobase; a client registered on a
|
|
6772
6775
|
# remote server is out of its reach.
|
|
6773
6776
|
remote = (urlsplit(r_base).hostname or "").lower() not in {"localhost", "127.0.0.1", "::1", "[::1]"}
|
|
6777
|
+
pairing_host, pairing_port = "", 0
|
|
6778
|
+
test_server = (test_server or os.environ.get("ONEC_MCP_BROWSER_TEST_SERVER", "")).strip()
|
|
6779
|
+
if test_server:
|
|
6780
|
+
server_parts = urlsplit(f"//{test_server}")
|
|
6781
|
+
pairing_host, pairing_port = server_parts.hostname or "", server_parts.port or 1541
|
|
6774
6782
|
try:
|
|
6775
6783
|
open_url = f"{r_base}?{raw_query}" if raw_query else r_base
|
|
6776
6784
|
url = browser_agent.browser_client_url(open_url, client_id)
|
|
@@ -6788,6 +6796,7 @@ async def _connect_browser_client_impl(
|
|
|
6788
6796
|
"client_log": "", "connection_mode": "ws", "connection_value": r_base,
|
|
6789
6797
|
"target_connection_mode": "ws", "expected_manager_protocol_version": MANAGER_PROTOCOL_VERSION,
|
|
6790
6798
|
"connect_timeout_seconds": _BROWSER_PAIRING_SECONDS,
|
|
6799
|
+
"pairing_host": pairing_host, "pairing_port": pairing_port,
|
|
6791
6800
|
}
|
|
6792
6801
|
_touch_session(sess)
|
|
6793
6802
|
page: dict[str, Any] = {}
|
|
@@ -6800,7 +6809,7 @@ async def _connect_browser_client_impl(
|
|
|
6800
6809
|
# The web client registers itself with the server when its interface has started; the manager then finds
|
|
6801
6810
|
# it by the identifier (it keeps trying for the pairing time).
|
|
6802
6811
|
try:
|
|
6803
|
-
if remote and os.environ.get("ONEC_MCP_BROWSER_FORCE_PAIRING") != "1":
|
|
6812
|
+
if remote and not pairing_host and os.environ.get("ONEC_MCP_BROWSER_FORCE_PAIRING") != "1":
|
|
6804
6813
|
# The manager cannot see a client registered on a remote server and then blocks for minutes.
|
|
6805
6814
|
raise BridgeError("pairing not attempted: remote publication")
|
|
6806
6815
|
result = await sess.bridge.call("attach_test_client", params)
|
|
@@ -6810,8 +6819,9 @@ async def _connect_browser_client_impl(
|
|
|
6810
6819
|
hint = (
|
|
6811
6820
|
f"The publication {urlsplit(r_base).netloc} is on another host: the test manager looks for the "
|
|
6812
6821
|
"browser client on the server of its own infobase, so it cannot find a client that registered "
|
|
6813
|
-
"on a remote server.
|
|
6814
|
-
"
|
|
6822
|
+
"on a remote server. Pass browser_test_server (host[:port] of that server reachable from this "
|
|
6823
|
+
"machine, for example over a VPN: the cluster manager port 1541 or the web server port 1538), "
|
|
6824
|
+
"open the base on this machine, or work through the html_* and browser_* tools."
|
|
6815
6825
|
)
|
|
6816
6826
|
else:
|
|
6817
6827
|
hint = "Check that the web publication is reachable and its web server allows the test-client ports."
|
|
Binary file
|
|
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
|
{answer42-0.11.2 → answer42-0.11.4}/src/cf/DataProcessors/MCPTestManager/Ext/ObjectModule.bsl
RENAMED
|
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
|