kuaifan a3d5bdf93c feat(ai-assistant): 重构页面操作为统一执行器(Web DOM floor + Electron CDP 双后端)
页面操作(doo page → /ws → 浮窗 operation-module → action-executor)原用手写
iView-only 选择器 + 朴素 value= 赋值,在 React+Radix 同源 iframe 业务表单上几乎
填不进。重构为「复用 Playwright 注入脚本的描述层 + 按环境选后端的执行层」:

描述层(共用):
- 新增 aria/aria-bundle.js,vendoring Playwright ariaSnapshot/roleUtils/domUtils
  子集预构建为 ESM(Apache-2.0 NOTICE + 固定上游 commit),产出 YAML 快照与活的
  ref→Element Map。
- page-context-collector 改用 buildSnapshot 采集,operation-module 经 setRefMap
  以 Map 直接持有元素取代 selector 反查。

执行层(按环境选后端,失败回退):
- web-backend:原生 prototype value setter + beforeinput/input/change/blur 序列
  + 回读校验(不符报 value_not_applied,绝不假报成功);自定义下拉/日期 open→click。
- electron-backend + electron/lib/page-input.js:经 webContents.debugger 走 CDP
  Input 域产生 isTrusted=true 可信输入(insertText/dispatchMouseEvent/KeyEvent),
  任一步失败回退 Web 后端。
- 复杂控件(动态明细表/成员选择器/文件上传)如实返回 unsupported_widget。

协议与链路(doo page、active-context 失效守卫、导航类 action)保持不变。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 02:03:59 +00:00

20 lines
845 B
Plaintext

aria-bundle.js is a vendored, esbuild-bundled subset of Playwright's injected
ariaSnapshot code.
Playwright
Copyright (c) Microsoft Corporation
Licensed under the Apache License, Version 2.0
https://github.com/microsoft/playwright/blob/main/LICENSE
Included source (from packages/injected/src and packages/isomorphic):
ariaSnapshot.ts, roleUtils.ts, domUtils.ts, and @isomorphic helpers
(stringUtils, yaml, cssTokenizer, ariaSnapshot).
Regenerate:
1. git clone github.com/microsoft/playwright (pin the commit in aria-bundle.js banner)
2. esbuild esm-entry.ts --bundle --format=esm --platform=browser \
--tsconfig=spike-tsconfig.json --outfile=aria-bundle.js
esm-entry.ts and spike-tsconfig.json in this folder are the build inputs.
This file is provided to comply with the Apache-2.0 NOTICE/attribution requirement.