answer42 0.13.1__tar.gz → 0.13.2__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.13.1 → answer42-0.13.2}/PKG-INFO +3 -1
- {answer42-0.13.1 → answer42-0.13.2}/README.md +2 -0
- {answer42-0.13.1 → answer42-0.13.2}/docs/installation.md +1 -1
- {answer42-0.13.1 → answer42-0.13.2}/pyproject.toml +1 -1
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/assets/MCPTestClient.cf +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/assets/MCPTestManager.cf +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/runtime.py +20 -1
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/server.py +141 -2
- {answer42-0.13.1 → answer42-0.13.2}/.gitignore +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/LICENSE +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/credentials.example.json +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/docs/agent-installation.md +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/docs/architecture.md +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/docs/assets/answer42-logo.png +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/docs/assets/platform42-logo.svg +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/scripts/build_cf.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/scripts/e2e_http_smoke.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/scripts/e2e_stable.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/scripts/openclaw_mcp_autoreload.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/scripts/rag_cli.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/scripts/read_webclient_start_info.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/cf/ConfigDumpInfo.xml +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/cf/Configuration.xml +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/cf/DataProcessors/MCPTestManager/Ext/ObjectModule.bsl +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/cf/DataProcessors/MCPTestManager/Forms//320/244/320/276/321/200/320/274/320/260/Ext/Form/Module.bsl" +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/cf/DataProcessors/MCPTestManager/Forms//320/244/320/276/321/200/320/274/320/260/Ext/Form.xml" +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/cf/DataProcessors/MCPTestManager/Forms//320/244/320/276/321/200/320/274/320/260.xml" +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/cf/DataProcessors/MCPTestManager.xml +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/cf/Ext/ManagedApplicationModule.bsl +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/cf/Languages//320/240/321/203/321/201/321/201/320/272/320/270/320/271.xml" +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/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.13.1 → answer42-0.13.2}/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.13.1 → answer42-0.13.2}/src/client_cf/ConfigDumpInfo.xml +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/client_cf/Configuration.xml +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/client_cf/Languages//320/240/321/203/321/201/321/201/320/272/320/270/320/271.xml" +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/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.13.1 → answer42-0.13.2}/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.13.1 → answer42-0.13.2}/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.13.1 → answer42-0.13.2}/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.13.1 → answer42-0.13.2}/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.13.1 → answer42-0.13.2}/src/mcp_1c/__init__.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/assets/__init__.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/auth.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/bridge.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/browser_agent.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/credentials.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/credentials_cli.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/html_agent.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/os_support.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/platform.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/protocol.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/rag/__init__.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/rag/detect.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/rag/dump.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/rag/model.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/rag/parsers.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/rag/service.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/rag/store.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/rag/summary_backend.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/rag/summary_vector.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/recorder.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/release_helper.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/skill_installer.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/tool_groups.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/version_proxy.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/webclient_probe.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/webkit_patch.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/src/mcp_1c/win_desktop.py +0 -0
- {answer42-0.13.1 → answer42-0.13.2}/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.13.
|
|
3
|
+
Version: 0.13.2
|
|
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>
|
|
@@ -378,6 +378,8 @@ stop_session(session_id="my-session", clean_data=False)
|
|
|
378
378
|
|
|
379
379
|
`start_session` всё ещё принимает `username` и `password` напрямую для разовых сценариев и обратной совместимости. Используйте это только когда осознанно готовы раскрыть значения вызывающему агенту: параметры MCP-вызова могут попасть в историю чата, логи клиента или отладочный вывод. Если вместо реального пароля передан редактированный плейсхолдер из звёздочек (`***`, `********` и т.п.), Answer42 остановит запуск с явной ошибкой: нужно указать настоящий пароль или сохранить корректные креды через `credentials_save()`.
|
|
380
380
|
|
|
381
|
+
Если для веб-публикации (`/WS`) или серверной базы (`/S`) не передан логин и в хранилище нет записи для `base_url` (с учётом аккаунта MCP), `start_session` сразу возвращает ошибку «Нет сохранённых учётных данных для <url> (аккаунт <id>)» и не запускает клиент: с ключом `/DisableStartupDialogs` тонкий клиент не может показать окно входа и молча завершается. Для баз, куда законно входить без логина (аутентификация ОС, база без пользователей), передайте `allow_empty_login=true`; публикация, которая пустила пробный запрос без логина, и аргументы `/N` или `/WA+` в `extra_args` проверку тоже проходят. Файловые базы (`/F`) не проверяются. Если клиент всё же завершился при подключении, в ошибке будут вероятные причины, командная строка клиента без пароля (`/P ***`) и путь к копии его логов в `<temp>/answer42/failed-starts/<session_id>/` (хранятся 20 последних).
|
|
382
|
+
|
|
381
383
|
Примеры в документации используют только плейсхолдеры (`<TARGET_INFOBASE_URL>`, `<USERNAME>`, `<PASSWORD>`). Перед публикацией артефактов проверяйте, что параметры вызовов заредактированы: recorder маскирует ключи вроде `password`, но URL и логин тоже не должны попадать в публичные материалы.
|
|
382
384
|
|
|
383
385
|
## Архитектура
|
|
@@ -336,6 +336,8 @@ stop_session(session_id="my-session", clean_data=False)
|
|
|
336
336
|
|
|
337
337
|
`start_session` всё ещё принимает `username` и `password` напрямую для разовых сценариев и обратной совместимости. Используйте это только когда осознанно готовы раскрыть значения вызывающему агенту: параметры MCP-вызова могут попасть в историю чата, логи клиента или отладочный вывод. Если вместо реального пароля передан редактированный плейсхолдер из звёздочек (`***`, `********` и т.п.), Answer42 остановит запуск с явной ошибкой: нужно указать настоящий пароль или сохранить корректные креды через `credentials_save()`.
|
|
338
338
|
|
|
339
|
+
Если для веб-публикации (`/WS`) или серверной базы (`/S`) не передан логин и в хранилище нет записи для `base_url` (с учётом аккаунта MCP), `start_session` сразу возвращает ошибку «Нет сохранённых учётных данных для <url> (аккаунт <id>)» и не запускает клиент: с ключом `/DisableStartupDialogs` тонкий клиент не может показать окно входа и молча завершается. Для баз, куда законно входить без логина (аутентификация ОС, база без пользователей), передайте `allow_empty_login=true`; публикация, которая пустила пробный запрос без логина, и аргументы `/N` или `/WA+` в `extra_args` проверку тоже проходят. Файловые базы (`/F`) не проверяются. Если клиент всё же завершился при подключении, в ошибке будут вероятные причины, командная строка клиента без пароля (`/P ***`) и путь к копии его логов в `<temp>/answer42/failed-starts/<session_id>/` (хранятся 20 последних).
|
|
340
|
+
|
|
339
341
|
Примеры в документации используют только плейсхолдеры (`<TARGET_INFOBASE_URL>`, `<USERNAME>`, `<PASSWORD>`). Перед публикацией артефактов проверяйте, что параметры вызовов заредактированы: recorder маскирует ключи вроде `password`, но URL и логин тоже не должны попадать в публичные материалы.
|
|
340
342
|
|
|
341
343
|
## Архитектура
|
|
@@ -80,7 +80,7 @@ OpenClaw хранит MCP-серверы в `mcp.servers`. Добавьте `Ans
|
|
|
80
80
|
|
|
81
81
|
Для OpenClaw новых инсталляций задавайте внешний MCP request timeout для Answer42 с запасом: рекомендуемое значение — **600 секунд** (`timeout: 600` или эквивалентный `requestTimeoutMs: 600000`). Не ставьте его равным самым длинным внутренним timeout'ам tools: например, если агент вызывает `wait_client_idle(timeout=180)` или `tabular_document_save(watchdog_timeout=180)`, внешний MCP timeout должен быть больше этого значения и покрывать накладные расходы транспорта, сериализацию результата, диагностику и медленные ответы web-клиента 1С. Для тяжёлых отчётов, сохранения больших табличных документов или очень медленных web-баз допустимо увеличить внешний timeout до 900–1200 секунд, но обычные интерактивные действия лучше держать с меньшими `watchdog_timeout`, чтобы зависания диагностировались структурированным ответом, а не обрывались внешним MCP timeout.
|
|
82
82
|
|
|
83
|
-
`ONEC_MCP_CREDENTIALS_FILE` указывает на локальный JSON с логинами и паролями. В штатном режиме агент вызывает `start_session(base_url="...")` без `username`/`password`, а Answer42 сам подставляет креды внутри MCP-процесса. Для сохранения или обновления записи используйте tool `credentials_save(url="...", username="...", password="...")`, для удаления — `credentials_remove(url="...")`, для проверки наличия записи — `credentials_check(base_url="...")`; эти tools не возвращают ни логин, ни пароль, ни маску пароля. `credentials_list` рекомендуется скрывать через `toolFilter.exclude`, чтобы агент не видел список URL-шаблонов. Если в `start_session`/`connect_test_client` передан пароль вида `***`, Answer42 считает это плейсхолдером и выдаёт явную ошибку вместо попытки авторизации.
|
|
83
|
+
`ONEC_MCP_CREDENTIALS_FILE` указывает на локальный JSON с логинами и паролями. В штатном режиме агент вызывает `start_session(base_url="...")` без `username`/`password`, а Answer42 сам подставляет креды внутри MCP-процесса. Для сохранения или обновления записи используйте tool `credentials_save(url="...", username="...", password="...")`, для удаления — `credentials_remove(url="...")`, для проверки наличия записи — `credentials_check(base_url="...")`; эти tools не возвращают ни логин, ни пароль, ни маску пароля. `credentials_list` рекомендуется скрывать через `toolFilter.exclude`, чтобы агент не видел список URL-шаблонов. Если в `start_session`/`connect_test_client` передан пароль вида `***`, Answer42 считает это плейсхолдером и выдаёт явную ошибку вместо попытки авторизации. Если логин не передан и записи для веб-публикации или серверной базы нет, `start_session` отказывает до запуска клиента; для аутентификации ОС или базы без пользователей передайте `allow_empty_login=true`.
|
|
84
84
|
|
|
85
85
|
После изменения MCP config перезапустите или перезагрузите OpenClaw gateway, если hot reload не подхватил конфигурацию.
|
|
86
86
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "answer42"
|
|
3
|
-
version = "0.13.
|
|
3
|
+
version = "0.13.2"
|
|
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
|
|
@@ -782,6 +782,25 @@ def build_test_client_argv(
|
|
|
782
782
|
return argv
|
|
783
783
|
|
|
784
784
|
|
|
785
|
+
def redact_argv(argv: list[str]) -> list[str]:
|
|
786
|
+
"""Copy of a 1C command line with the /P password value replaced by ``***``."""
|
|
787
|
+
redacted = list(argv)
|
|
788
|
+
for index, item in enumerate(redacted[:-1]):
|
|
789
|
+
if item.upper() == "/P":
|
|
790
|
+
redacted[index + 1] = "***"
|
|
791
|
+
return redacted
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
def format_argv(argv: list[str]) -> str:
|
|
795
|
+
"""Printable 1C command line without the password (for logs and error messages)."""
|
|
796
|
+
def quote(item: str) -> str:
|
|
797
|
+
if item == "***":
|
|
798
|
+
return item
|
|
799
|
+
return subprocess.list2cmdline([item]) if os_support.IS_WINDOWS else shlex.quote(item)
|
|
800
|
+
|
|
801
|
+
return " ".join(quote(item) for item in redact_argv(argv))
|
|
802
|
+
|
|
803
|
+
|
|
785
804
|
EXTERNAL_OPEN_LOG_NAME = "external_open.log"
|
|
786
805
|
|
|
787
806
|
# 1C opens URLs and files with `sh -c xdg-open ...` and waits for it, and xdg-open waits for a
|
|
@@ -862,7 +881,7 @@ def start_test_client(
|
|
|
862
881
|
with suppress(OSError):
|
|
863
882
|
stdout_log_path.replace(stdout_log_path.with_name(stdout_log_path.name + ".previous"))
|
|
864
883
|
with stdout_log_path.open("wb", buffering=0) as log_handle:
|
|
865
|
-
LOGGER.info("Starting test client: %s",
|
|
884
|
+
LOGGER.info("Starting test client: %s", format_argv(argv))
|
|
866
885
|
proc = _popen_on_display(
|
|
867
886
|
argv,
|
|
868
887
|
display,
|
|
@@ -16,6 +16,7 @@ import shlex
|
|
|
16
16
|
import shutil
|
|
17
17
|
import subprocess
|
|
18
18
|
import sys
|
|
19
|
+
import tempfile
|
|
19
20
|
import time
|
|
20
21
|
import typing
|
|
21
22
|
import urllib.parse
|
|
@@ -1761,8 +1762,44 @@ _FAILED_START_DISCONNECT_TIMEOUT = 5.0
|
|
|
1761
1762
|
_STOP_DISCONNECT_TIMEOUT = float(os.getenv("ONEC_MCP_STOP_DISCONNECT_TIMEOUT", "15"))
|
|
1762
1763
|
|
|
1763
1764
|
|
|
1765
|
+
_FAILED_START_LOGS_KEEP = 20
|
|
1766
|
+
|
|
1767
|
+
|
|
1768
|
+
def _failed_start_logs_root() -> Path:
|
|
1769
|
+
return Path(tempfile.gettempdir()) / "answer42" / "failed-starts"
|
|
1770
|
+
|
|
1771
|
+
|
|
1772
|
+
def _preserve_failed_start_logs(sess: SessionState) -> Path | None:
|
|
1773
|
+
"""Copy the test client's logs out of the session directory, which a failed start removes.
|
|
1774
|
+
|
|
1775
|
+
Returns the copy, or None when there is nothing to keep. Only the newest
|
|
1776
|
+
``_FAILED_START_LOGS_KEEP`` copies are kept.
|
|
1777
|
+
"""
|
|
1778
|
+
source = sess.client_log_dir
|
|
1779
|
+
try:
|
|
1780
|
+
if not source.is_dir() or not any(source.iterdir()):
|
|
1781
|
+
return None
|
|
1782
|
+
root = _failed_start_logs_root()
|
|
1783
|
+
target = root / re.sub(r"[^\w.-]", "_", sess.session_id)
|
|
1784
|
+
shutil.copytree(source, target, dirs_exist_ok=True)
|
|
1785
|
+
argv = getattr(sess.test_client_process, "answer42_argv", None)
|
|
1786
|
+
if argv:
|
|
1787
|
+
(target / "command_line.txt").write_text(runtime.format_argv(list(argv)) + "\n", encoding="utf-8")
|
|
1788
|
+
copies = sorted((item for item in root.iterdir() if item.is_dir()), key=lambda item: item.stat().st_mtime)
|
|
1789
|
+
for stale in copies[:-_FAILED_START_LOGS_KEEP]:
|
|
1790
|
+
if stale != target:
|
|
1791
|
+
shutil.rmtree(stale, ignore_errors=True)
|
|
1792
|
+
return target
|
|
1793
|
+
except OSError as exc:
|
|
1794
|
+
logging.warning("Could not keep the logs of failed start_session %s: %s", sess.session_id, exc)
|
|
1795
|
+
return None
|
|
1796
|
+
|
|
1797
|
+
|
|
1764
1798
|
async def _cleanup_failed_start_session(sess: SessionState, reason: str) -> None:
|
|
1765
1799
|
logging.info("Cleaning failed start_session %s: %s", sess.session_id, reason)
|
|
1800
|
+
kept_logs = _preserve_failed_start_logs(sess)
|
|
1801
|
+
if kept_logs is not None:
|
|
1802
|
+
logging.info("Logs of failed start_session %s kept in %s", sess.session_id, kept_logs)
|
|
1766
1803
|
# The manager may still be busy with the failed attach (1C retries the
|
|
1767
1804
|
# test-client connection for minutes); everything is killed below anyway,
|
|
1768
1805
|
# so do not let a polite disconnect delay the error report.
|
|
@@ -5633,13 +5670,19 @@ async def start_session(
|
|
|
5633
5670
|
browser_headless: Annotated[bool, "client_mode=browser: run the browser without a window"] = False,
|
|
5634
5671
|
manager_version: Annotated[str, "Thin client mode, for a target platform that has only a thin client (for example a cloud): version of an installed full platform to run the test manager on, such as 8.5.1.1343. The client still runs on the target's version (version, or the version of base_url); the version difference is hidden by an internal proxy. Empty = one platform for both (or ONEC_MCP_MANAGER_VERSION)"] = "",
|
|
5635
5672
|
browser_test_server: Annotated[str, "client_mode=browser, base on another host: host[:port] the test manager connects to, 1C server cluster manager (default port 1541) or the web server of a file base (port 1538), for example 10.0.0.5 or myhost:1541. The host must be reachable from this machine (VPN, tailscale); the 80/443 ports of a reverse proxy are not enough. Empty = the test manager is not paired with a base on another host (or ONEC_MCP_BROWSER_TEST_SERVER)"] = "",
|
|
5673
|
+
allow_empty_login: Annotated[bool, "Thin client: start a web publication (/WS) or server infobase (/S) without a 1C login, for OS authentication or an infobase without users. By default such a start without username and without saved credentials fails at once, before the client is started: the client cannot show its login dialog and would exit silently"] = False,
|
|
5636
5674
|
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)"] = "",
|
|
5637
5675
|
) -> dict[str, Any]:
|
|
5638
5676
|
"""One-shot session factory: detect version, start infrastructure, and connect the 1C test client.
|
|
5639
5677
|
|
|
5640
5678
|
`base_url` may be a web publication URL, `server/infobase`, or a file
|
|
5641
5679
|
infobase path. Prefer credentials saved with `credentials_save` over
|
|
5642
|
-
passing secrets in tool calls.
|
|
5680
|
+
passing secrets in tool calls. A thin-client start of a web publication or
|
|
5681
|
+
server infobase with no username and no saved credentials fails before the
|
|
5682
|
+
client is started (the client cannot show its login dialog); pass
|
|
5683
|
+
`allow_empty_login=true` for OS authentication or an infobase without users.
|
|
5684
|
+
When the client exits during startup, its logs are kept under
|
|
5685
|
+
`<temp>/answer42/failed-starts/<session_id>/`. After a long UI operation, use
|
|
5643
5686
|
`client_busy_status` or `wait_client_idle` before sending more commands.
|
|
5644
5687
|
|
|
5645
5688
|
The html_* tools reach live pages in HTML document fields as `html_mode` says:
|
|
@@ -5723,7 +5766,19 @@ async def start_session(
|
|
|
5723
5766
|
if web_runtime_probe.get("authentication_failed"):
|
|
5724
5767
|
# No local 1C runtime/process has been started yet. Do not hide a
|
|
5725
5768
|
# confirmed publication login rejection behind a later timeout.
|
|
5726
|
-
|
|
5769
|
+
auth_message = str(web_runtime_probe.get("message") or "1C web authentication failed")
|
|
5770
|
+
# "incorrect user or password" when nobody gave a user: say that the login is missing.
|
|
5771
|
+
missing_login = _missing_login_error(
|
|
5772
|
+
target=base_url,
|
|
5773
|
+
connection_mode="ws",
|
|
5774
|
+
username=username,
|
|
5775
|
+
extra_args=extra_args,
|
|
5776
|
+
web_runtime_probe={},
|
|
5777
|
+
allow_empty_login=False,
|
|
5778
|
+
account_id=credential_account_id,
|
|
5779
|
+
empty_login_rejected=True,
|
|
5780
|
+
)
|
|
5781
|
+
raise ValueError(f"{missing_login}\n\nОтвет публикации: {auth_message}" if missing_login else auth_message)
|
|
5727
5782
|
selected_credential_index = web_runtime_probe.pop("_selected_credential_index", None)
|
|
5728
5783
|
if selected_credential_index is not None and not supplied_username and not supplied_password:
|
|
5729
5784
|
candidates = _credentials_store().matching_entries(base_url, account_id=credential_account_id)
|
|
@@ -5732,6 +5787,20 @@ async def start_session(
|
|
|
5732
5787
|
password = str(selected["password"])
|
|
5733
5788
|
saved_credentials_used = True
|
|
5734
5789
|
saved_credentials_unverified = not bool(selected.get("verified", False))
|
|
5790
|
+
if effective_client_mode != "browser":
|
|
5791
|
+
missing_login = _missing_login_error(
|
|
5792
|
+
target=base_url or connection_value,
|
|
5793
|
+
connection_mode=initial_connection_mode,
|
|
5794
|
+
username=username,
|
|
5795
|
+
extra_args=extra_args,
|
|
5796
|
+
web_runtime_probe=web_runtime_probe,
|
|
5797
|
+
allow_empty_login=allow_empty_login,
|
|
5798
|
+
account_id=credential_account_id,
|
|
5799
|
+
)
|
|
5800
|
+
if missing_login:
|
|
5801
|
+
# Nothing has been started yet: with /DisableStartupDialogs the client could not ask for a login
|
|
5802
|
+
# and would exit silently with code 1.
|
|
5803
|
+
raise ValueError(missing_login)
|
|
5735
5804
|
inferred_summary_rag_config = "" if summary_rag_config else _summary_rag_config_from_42clouds_url(base_url)
|
|
5736
5805
|
effective_summary_rag_config = summary_rag_config or inferred_summary_rag_config
|
|
5737
5806
|
resolved_version = version or None
|
|
@@ -6421,6 +6490,58 @@ def _lookup_credentials(base_url: str) -> dict[str, str] | None:
|
|
|
6421
6490
|
return _credentials_store().lookup(base_url, account_id=_current_account_id())
|
|
6422
6491
|
|
|
6423
6492
|
|
|
6493
|
+
def _extra_args_supply_login(extra_args: str) -> bool:
|
|
6494
|
+
"""Whether raw client arguments already log in: /N user or OS authentication /WA+."""
|
|
6495
|
+
for item in runtime._split_extra_args(extra_args):
|
|
6496
|
+
upper = item.upper()
|
|
6497
|
+
if upper == "/N" or upper.startswith("/WA+"):
|
|
6498
|
+
return True
|
|
6499
|
+
return False
|
|
6500
|
+
|
|
6501
|
+
|
|
6502
|
+
def _missing_login_error(
|
|
6503
|
+
*,
|
|
6504
|
+
target: str,
|
|
6505
|
+
connection_mode: str,
|
|
6506
|
+
username: str,
|
|
6507
|
+
extra_args: str,
|
|
6508
|
+
web_runtime_probe: dict[str, Any],
|
|
6509
|
+
allow_empty_login: bool,
|
|
6510
|
+
account_id: str,
|
|
6511
|
+
empty_login_rejected: bool = False,
|
|
6512
|
+
) -> str:
|
|
6513
|
+
"""Message for a thin-client start that has no login, or "" when the start may go on.
|
|
6514
|
+
|
|
6515
|
+
The test client runs with /DisableStartupDialogs: without /N it cannot show the login dialog and
|
|
6516
|
+
exits with code 1 and empty logs. Only /WS and /S are checked: a file infobase without users is
|
|
6517
|
+
common and opens without a login.
|
|
6518
|
+
"""
|
|
6519
|
+
if allow_empty_login or username or not target or connection_mode not in {"ws", "server"}:
|
|
6520
|
+
return ""
|
|
6521
|
+
if _extra_args_supply_login(extra_args):
|
|
6522
|
+
return ""
|
|
6523
|
+
if connection_mode == "ws" and web_runtime_probe.get("status") == "ok":
|
|
6524
|
+
# The publication accepted the probe without a login (an infobase without users, OS authentication).
|
|
6525
|
+
return ""
|
|
6526
|
+
if _CREDENTIAL_STORE_ENABLED:
|
|
6527
|
+
store = _credentials_store()
|
|
6528
|
+
if store.lookup(target, account_id=account_id) or store.matching_entries(target, account_id=account_id):
|
|
6529
|
+
return ""
|
|
6530
|
+
store_hint = "сохраните их через credentials_save"
|
|
6531
|
+
else:
|
|
6532
|
+
store_hint = "хранилище учётных данных отключено (--disable-credential-store)"
|
|
6533
|
+
message = (
|
|
6534
|
+
f"Нет сохранённых учётных данных для {target} (аккаунт {account_id}): {store_hint} "
|
|
6535
|
+
"или передайте username/password. Клиент 1С не запускался"
|
|
6536
|
+
)
|
|
6537
|
+
if empty_login_rejected:
|
|
6538
|
+
return message + ": публикация отклонила вход без логина."
|
|
6539
|
+
return message + (
|
|
6540
|
+
": без логина он не может показать окно входа и молча завершается. Если база пускает без логина "
|
|
6541
|
+
"(аутентификация ОС, база без пользователей), передайте allow_empty_login=true."
|
|
6542
|
+
)
|
|
6543
|
+
|
|
6544
|
+
|
|
6424
6545
|
def _resolve_credential_reference(value: str) -> dict[str, str] | None:
|
|
6425
6546
|
if not _CREDENTIAL_STORE_ENABLED or not value:
|
|
6426
6547
|
return None
|
|
@@ -6801,6 +6922,23 @@ def _client_ibsrv_state(rt: runtime.ManagerRuntime | None) -> str:
|
|
|
6801
6922
|
return state
|
|
6802
6923
|
|
|
6803
6924
|
|
|
6925
|
+
def _client_exit_hint(message: str, sess: SessionState, argv: list[str], *, logs_empty: bool) -> str:
|
|
6926
|
+
"""Add likely causes, the command line (password hidden) and the kept logs to a client-exit error."""
|
|
6927
|
+
if logs_empty:
|
|
6928
|
+
message += (
|
|
6929
|
+
"\n\nКлиент 1С завершился, не оставив сообщений в логах. Вероятные причины:\n"
|
|
6930
|
+
"- нет логина: учётные данные не переданы и не сохранены (credentials_save), а с "
|
|
6931
|
+
"/DisableStartupDialogs клиент не может показать окно входа;\n"
|
|
6932
|
+
"- неверный логин или пароль;\n"
|
|
6933
|
+
"- публикация или сервер 1С недоступны с этой машины, либо требуют другой версии клиента."
|
|
6934
|
+
)
|
|
6935
|
+
message += f"\n\nКомандная строка клиента: {runtime.format_argv(argv)}"
|
|
6936
|
+
kept_logs = _preserve_failed_start_logs(sess)
|
|
6937
|
+
if kept_logs is not None:
|
|
6938
|
+
message += f"\n\nКопия логов клиента сохранена: {kept_logs}"
|
|
6939
|
+
return message
|
|
6940
|
+
|
|
6941
|
+
|
|
6804
6942
|
def _client_failure_diagnostics(sess: SessionState, error: Exception, target_connection_mode: str) -> RuntimeError:
|
|
6805
6943
|
message = str(error)
|
|
6806
6944
|
message = _append_file_tail(message, "Лог stdout/stderr клиента тестирования", sess.client_log_dir / "test_client_stdout.log")
|
|
@@ -7287,6 +7425,7 @@ async def _connect_test_client_impl(
|
|
|
7287
7425
|
"Лог 1С /Out клиента тестирования",
|
|
7288
7426
|
sess.client_log_dir / "test_client_1c_out.log",
|
|
7289
7427
|
)
|
|
7428
|
+
message = _client_exit_hint(message, sess, argv, logs_empty=not _test_client_startup_error_from_logs(sess))
|
|
7290
7429
|
raise RuntimeError(message)
|
|
7291
7430
|
for pending_task in pending:
|
|
7292
7431
|
pending_task.cancel()
|
|
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.13.1 → answer42-0.13.2}/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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|