answer42 0.11.3__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.
Files changed (68) hide show
  1. {answer42-0.11.3 → answer42-0.11.4}/PKG-INFO +1 -1
  2. {answer42-0.11.3 → answer42-0.11.4}/pyproject.toml +1 -1
  3. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/assets/MCPTestClient.cf +0 -0
  4. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/assets/MCPTestManager.cf +0 -0
  5. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/browser_agent.py +73 -10
  6. {answer42-0.11.3 → answer42-0.11.4}/.gitignore +0 -0
  7. {answer42-0.11.3 → answer42-0.11.4}/LICENSE +0 -0
  8. {answer42-0.11.3 → answer42-0.11.4}/README.md +0 -0
  9. {answer42-0.11.3 → answer42-0.11.4}/credentials.example.json +0 -0
  10. {answer42-0.11.3 → answer42-0.11.4}/docs/agent-installation.md +0 -0
  11. {answer42-0.11.3 → answer42-0.11.4}/docs/architecture.md +0 -0
  12. {answer42-0.11.3 → answer42-0.11.4}/docs/assets/answer42-logo.png +0 -0
  13. {answer42-0.11.3 → answer42-0.11.4}/docs/assets/platform42-logo.svg +0 -0
  14. {answer42-0.11.3 → answer42-0.11.4}/docs/installation.md +0 -0
  15. {answer42-0.11.3 → answer42-0.11.4}/scripts/build_cf.py +0 -0
  16. {answer42-0.11.3 → answer42-0.11.4}/scripts/e2e_http_smoke.py +0 -0
  17. {answer42-0.11.3 → answer42-0.11.4}/scripts/e2e_stable.py +0 -0
  18. {answer42-0.11.3 → answer42-0.11.4}/scripts/openclaw_mcp_autoreload.py +0 -0
  19. {answer42-0.11.3 → answer42-0.11.4}/scripts/rag_cli.py +0 -0
  20. {answer42-0.11.3 → answer42-0.11.4}/scripts/read_webclient_start_info.py +0 -0
  21. {answer42-0.11.3 → answer42-0.11.4}/src/cf/ConfigDumpInfo.xml +0 -0
  22. {answer42-0.11.3 → answer42-0.11.4}/src/cf/Configuration.xml +0 -0
  23. {answer42-0.11.3 → answer42-0.11.4}/src/cf/DataProcessors/MCPTestManager/Ext/ObjectModule.bsl +0 -0
  24. {answer42-0.11.3 → answer42-0.11.4}/src/cf/DataProcessors/MCPTestManager/Forms//320/244/320/276/321/200/320/274/320/260/Ext/Form/Module.bsl" +0 -0
  25. {answer42-0.11.3 → answer42-0.11.4}/src/cf/DataProcessors/MCPTestManager/Forms//320/244/320/276/321/200/320/274/320/260/Ext/Form.xml" +0 -0
  26. {answer42-0.11.3 → answer42-0.11.4}/src/cf/DataProcessors/MCPTestManager/Forms//320/244/320/276/321/200/320/274/320/260.xml" +0 -0
  27. {answer42-0.11.3 → answer42-0.11.4}/src/cf/DataProcessors/MCPTestManager.xml +0 -0
  28. {answer42-0.11.3 → answer42-0.11.4}/src/cf/Ext/ManagedApplicationModule.bsl +0 -0
  29. {answer42-0.11.3 → answer42-0.11.4}/src/cf/Languages//320/240/321/203/321/201/321/201/320/272/320/270/320/271.xml" +0 -0
  30. {answer42-0.11.3 → 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
  31. {answer42-0.11.3 → 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
  32. {answer42-0.11.3 → answer42-0.11.4}/src/client_cf/ConfigDumpInfo.xml +0 -0
  33. {answer42-0.11.3 → answer42-0.11.4}/src/client_cf/Configuration.xml +0 -0
  34. {answer42-0.11.3 → 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
  35. {answer42-0.11.3 → 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
  36. {answer42-0.11.3 → 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
  37. {answer42-0.11.3 → 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
  38. {answer42-0.11.3 → 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
  39. {answer42-0.11.3 → 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
  40. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/__init__.py +0 -0
  41. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/assets/__init__.py +0 -0
  42. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/auth.py +0 -0
  43. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/bridge.py +0 -0
  44. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/credentials.py +0 -0
  45. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/credentials_cli.py +0 -0
  46. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/html_agent.py +0 -0
  47. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/os_support.py +0 -0
  48. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/platform.py +0 -0
  49. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/protocol.py +0 -0
  50. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/rag/__init__.py +0 -0
  51. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/rag/detect.py +0 -0
  52. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/rag/dump.py +0 -0
  53. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/rag/model.py +0 -0
  54. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/rag/parsers.py +0 -0
  55. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/rag/service.py +0 -0
  56. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/rag/store.py +0 -0
  57. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/rag/summary_backend.py +0 -0
  58. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/rag/summary_vector.py +0 -0
  59. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/recorder.py +0 -0
  60. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/release_helper.py +0 -0
  61. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/runtime.py +0 -0
  62. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/server.py +0 -0
  63. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/skill_installer.py +0 -0
  64. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/tool_groups.py +0 -0
  65. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/webclient_probe.py +0 -0
  66. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/webkit_patch.py +0 -0
  67. {answer42-0.11.3 → answer42-0.11.4}/src/mcp_1c/win_desktop.py +0 -0
  68. {answer42-0.11.3 → 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
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"
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"
@@ -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
- return {
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") == "page" and t.get("webSocketDebuggerUrl")]
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
- result = await self.send(
415
- page, "Runtime.evaluate",
416
- {"expression": expression, "returnByValue": True, "awaitPromise": True, "userGesture": True}, timeout=timeout,
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
- return [p.to_json() for p in self.pages.values() if include_dead or not p.closed]
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
- messages = list(page.console_log)
531
+ log = (page.parent or page).console_log # frames share the console of their page
532
+ messages = list(log)
470
533
  if clear:
471
- page.console_log.clear()
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes