answer42 0.8.0__tar.gz → 0.8.1__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.8.0 → answer42-0.8.1}/PKG-INFO +1 -1
- {answer42-0.8.0 → answer42-0.8.1}/docs/architecture.md +1 -1
- {answer42-0.8.0 → answer42-0.8.1}/pyproject.toml +1 -1
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/assets/MCPTestClient.cf +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/assets/MCPTestManager.cf +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/html_agent.py +31 -8
- {answer42-0.8.0 → answer42-0.8.1}/.gitignore +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/LICENSE +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/README.md +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/credentials.example.json +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/docs/agent-installation.md +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/docs/assets/answer42-logo.png +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/docs/assets/platform42-logo.svg +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/docs/installation.md +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/scripts/build_cf.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/scripts/e2e_http_smoke.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/scripts/e2e_stable.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/scripts/openclaw_mcp_autoreload.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/scripts/rag_cli.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/scripts/read_webclient_start_info.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/cf/ConfigDumpInfo.xml +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/cf/Configuration.xml +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/cf/DataProcessors/MCPTestManager/Ext/ObjectModule.bsl +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/cf/DataProcessors/MCPTestManager/Forms//320/244/320/276/321/200/320/274/320/260/Ext/Form/Module.bsl" +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/cf/DataProcessors/MCPTestManager/Forms//320/244/320/276/321/200/320/274/320/260/Ext/Form.xml" +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/cf/DataProcessors/MCPTestManager/Forms//320/244/320/276/321/200/320/274/320/260.xml" +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/cf/DataProcessors/MCPTestManager.xml +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/cf/Ext/ManagedApplicationModule.bsl +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/cf/Languages//320/240/321/203/321/201/321/201/320/272/320/270/320/271.xml" +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/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.8.0 → answer42-0.8.1}/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.8.0 → answer42-0.8.1}/src/client_cf/ConfigDumpInfo.xml +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/client_cf/Configuration.xml +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/client_cf/Languages//320/240/321/203/321/201/321/201/320/272/320/270/320/271.xml" +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/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.8.0 → answer42-0.8.1}/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.8.0 → answer42-0.8.1}/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.8.0 → answer42-0.8.1}/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.8.0 → answer42-0.8.1}/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.8.0 → answer42-0.8.1}/src/mcp_1c/__init__.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/assets/__init__.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/auth.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/bridge.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/credentials.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/credentials_cli.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/os_support.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/platform.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/protocol.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/rag/__init__.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/rag/detect.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/rag/dump.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/rag/model.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/rag/parsers.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/rag/service.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/rag/store.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/rag/summary_backend.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/rag/summary_vector.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/recorder.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/release_helper.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/runtime.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/server.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/skill_installer.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/tool_groups.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/webclient_probe.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/webkit_patch.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/src/mcp_1c/win_desktop.py +0 -0
- {answer42-0.8.0 → answer42-0.8.1}/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.8.
|
|
3
|
+
Version: 0.8.1
|
|
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>
|
|
@@ -138,7 +138,7 @@ flowchart LR
|
|
|
138
138
|
end
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
**Windows.** Встроенный WebKit (старый Windows-порт WebKit1) не имеет сервера удалённой отладки, но в нём включены developer extras. `find_webviews` перечисляет окна `WebViewWindowClass` процесса тест-клиента (на скрытом рабочем столе — через `EnumDesktopWindows`). Для каждого нового WebView Answer42 отправляет Ctrl+Alt+Shift+F12. Модификаторы попадают в состояние клавиатуры потока окна (`AttachThreadInput` + `SetKeyboardState`), а сами клавиши отправляются `SendMessageTimeout`: вызов возвращается, когда окно обработало сообщение, поэтому паузы не нужны (`SendInput` на скрытый рабочий стол не доходит). 1С встраивает интерфейс инспектора в форму ещё одним WebView; всё, что появилось после горячей клавиши, запоминается как интерфейс инспектора и само не инспектируется. Признак того, что интерфейс загрузился, — заголовок скрытого окна `WebInspectorWindowClass`: WebKit меняет его на «Web Inspector — <адрес>», когда интерфейс сообщает адрес страницы (около 1,4 с после горячей клавиши).
|
|
141
|
+
**Windows.** Встроенный WebKit (старый Windows-порт WebKit1) не имеет сервера удалённой отладки, но в нём включены developer extras. `find_webviews` перечисляет окна `WebViewWindowClass` процесса тест-клиента (на скрытом рабочем столе — через `EnumDesktopWindows`). Для каждого нового WebView Answer42 отправляет Ctrl+Alt+Shift+F12. Модификаторы попадают в состояние клавиатуры потока окна (`AttachThreadInput` + `SetKeyboardState`), а сами клавиши отправляются `SendMessageTimeout`: вызов возвращается, когда окно обработало сообщение, поэтому паузы не нужны (`SendInput` на скрытый рабочий стол не доходит). 1С встраивает интерфейс инспектора в форму ещё одним WebView; всё, что появилось после горячей клавиши, запоминается как интерфейс инспектора и само не инспектируется. Если за 3 с интерфейс инспектора не появился, клавиша нажимается снова (`HOTKEY_REPEAT_SECONDS`; повторное нажатие безопасно — инспектор открывается один); если WebView поля за это время исчезло (клиент пересоздал поле), `open_inspectors` сразу делает второй проход по актуальному списку WebView. Признак того, что интерфейс загрузился, — заголовок скрытого окна `WebInspectorWindowClass`: WebKit меняет его на «Web Inspector — <адрес>», когда интерфейс сообщает адрес страницы (около 1,4 с после горячей клавиши).
|
|
142
142
|
|
|
143
143
|
Дальше `_type_into_console`: `WM_SETFOCUS` делает интерфейс инспектора активным для WebKit, не трогая фокус внутри его документа; Ctrl+Alt+C открывает вкладку Console, которая сама ставит фокус в строку ввода (инспектор запоминает вкладку). На вкладку Elements ввод попадать не должен: её дерево DOM забирает фокус, когда догружается, и набранные в нём клавиши, особенно Enter, правят DOM страницы. Esc тоже нельзя — его первой обрабатывает 1С и закрывает форму. Загрузчик `loader_js` (около 110 символов) вводится за комментарием `//`: автодополнение консоли асинхронно отвечает на набранный код и может заменить набранное после него, но внутри комментария не срабатывает. Home и два Delete снимают `//`, Enter выполняет строку. Загрузчик открывает WebSocket с одноразовым токеном в адресе, сервер в ответ присылает `PAGE_BRIDGE_JS`, который выполняет присланные выражения через `eval`. Подключение к странице занимает около 2–3 секунд; время по этапам — в `last_connect` статуса моста. Мост живёт в странице: после перезагрузки следующий вызов вводит загрузчик заново.
|
|
144
144
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "answer42"
|
|
3
|
-
version = "0.8.
|
|
3
|
+
version = "0.8.1"
|
|
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
|
|
@@ -54,6 +54,7 @@ LOGGER = logging.getLogger(__name__)
|
|
|
54
54
|
WEBVIEW_CLASS = "WebViewWindowClass"
|
|
55
55
|
INSPECTOR_WINDOW_CLASS = "WebInspectorWindowClass"
|
|
56
56
|
INSPECTOR_OPEN_SECONDS = 10.0 # only a limit: the first opening after a cold start can take several seconds
|
|
57
|
+
HOTKEY_REPEAT_SECONDS = 3.0 # no new front end by then: press the inspector hot key again
|
|
57
58
|
CONNECT_TIMEOUT_SECONDS = 15.0
|
|
58
59
|
# The first evaluation in a fresh console can take a second; then the loader is typed again.
|
|
59
60
|
RETYPE_SECONDS = 2.0
|
|
@@ -299,6 +300,10 @@ class HtmlAgentError(RuntimeError):
|
|
|
299
300
|
pass
|
|
300
301
|
|
|
301
302
|
|
|
303
|
+
class ViewGoneError(HtmlAgentError):
|
|
304
|
+
"""The WebKit view was destroyed (the client recreated the field) before its inspector opened."""
|
|
305
|
+
|
|
306
|
+
|
|
302
307
|
def _protocol_value(reply: dict[str, Any]) -> Any:
|
|
303
308
|
"""The JSON value of a Runtime.evaluate reply (returnByValue)."""
|
|
304
309
|
if "error" in reply:
|
|
@@ -975,6 +980,7 @@ class HtmlInspector:
|
|
|
975
980
|
self._front_ends: dict[int, int] = {}
|
|
976
981
|
self._known_front_ends: set[int] = set()
|
|
977
982
|
self._attempts: dict[int, int] = {}
|
|
983
|
+
self._view_gone = False # Windows: a view disappeared while open_inspectors was opening it
|
|
978
984
|
self._open_lock = asyncio.Lock()
|
|
979
985
|
self.last_connect: dict[str, Any] = {} # Windows: timings of the latest page connection
|
|
980
986
|
# remote: the client is started with its WebKit remote inspector server on this port.
|
|
@@ -1196,14 +1202,19 @@ class HtmlInspector:
|
|
|
1196
1202
|
async with self._open_lock:
|
|
1197
1203
|
return await self._open_linux_local()
|
|
1198
1204
|
async with self._open_lock:
|
|
1199
|
-
live = {p.hwnd for p in self.pages.values() if not p.closed}
|
|
1200
1205
|
opened: list[str] = []
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1206
|
+
# A second pass picks up the view that replaced one which disappeared while it was opened.
|
|
1207
|
+
for _ in range(2):
|
|
1208
|
+
self._view_gone = False
|
|
1209
|
+
live = {p.hwnd for p in self.pages.values() if not p.closed}
|
|
1210
|
+
for view in await self._views():
|
|
1211
|
+
if view in self._known_front_ends or view in live or self._attempts.get(view, 0) >= self.MAX_ATTEMPTS:
|
|
1212
|
+
continue
|
|
1213
|
+
page = await self._connect(view)
|
|
1214
|
+
if page is not None:
|
|
1215
|
+
opened.append(page.page_id)
|
|
1216
|
+
if not self._view_gone:
|
|
1217
|
+
break
|
|
1207
1218
|
return opened
|
|
1208
1219
|
|
|
1209
1220
|
async def _open_remote(self) -> list[str]:
|
|
@@ -1297,11 +1308,20 @@ class HtmlInspector:
|
|
|
1297
1308
|
inspectors = set(await asyncio.to_thread(find_inspector_windows, self.desktop, self.client_pid))
|
|
1298
1309
|
await asyncio.to_thread(_run_on_client_desktop, self.desktop, lambda: _press_inspector_hotkey(view))
|
|
1299
1310
|
deadline = time.monotonic() + INSPECTOR_OPEN_SECONDS
|
|
1311
|
+
repress_at = time.monotonic() + HOTKEY_REPEAT_SECONDS
|
|
1300
1312
|
new: set[int] = set()
|
|
1301
1313
|
loaded = False
|
|
1302
1314
|
while not (new and loaded) and time.monotonic() < deadline:
|
|
1303
1315
|
await asyncio.sleep(0.05)
|
|
1304
|
-
|
|
1316
|
+
current = set(await self._views())
|
|
1317
|
+
new = new or current - views
|
|
1318
|
+
if not new and view not in current:
|
|
1319
|
+
raise ViewGoneError(f"WebKit view {view} disappeared before its inspector opened")
|
|
1320
|
+
if not new and time.monotonic() >= repress_at:
|
|
1321
|
+
# A hot key the field missed (seen once right after a modal dialog closed) is not
|
|
1322
|
+
# repeated by anyone else; pressing it again is harmless: one inspector opens either way.
|
|
1323
|
+
await asyncio.to_thread(_run_on_client_desktop, self.desktop, lambda: _press_inspector_hotkey(view))
|
|
1324
|
+
repress_at = time.monotonic() + HOTKEY_REPEAT_SECONDS
|
|
1305
1325
|
titles = await asyncio.to_thread(find_inspector_windows, self.desktop, self.client_pid)
|
|
1306
1326
|
loaded = any(title for hwnd, title in titles.items() if hwnd not in inspectors)
|
|
1307
1327
|
# Whatever appeared is a front end and must never be inspected itself.
|
|
@@ -1366,6 +1386,9 @@ class HtmlInspector:
|
|
|
1366
1386
|
except (HtmlAgentError, TimeoutError) as exc:
|
|
1367
1387
|
self.last_error = str(exc) or f"The page of WebKit view {view} did not connect within {CONNECT_TIMEOUT_SECONDS:g}s"
|
|
1368
1388
|
LOGGER.warning("%s", self.last_error)
|
|
1389
|
+
if isinstance(exc, ViewGoneError):
|
|
1390
|
+
self._view_gone = True
|
|
1391
|
+
self._attempts.pop(view, None)
|
|
1369
1392
|
return None
|
|
1370
1393
|
finally:
|
|
1371
1394
|
self._tokens.pop(token, None)
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|