Files
isphere-ai-bridge/docs/source-discovery/2026-07-11-a-route-open-conversation-window.md
2026-07-11 20:21:41 +08:00

121 lines
4.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# A-route open_conversation 窗口验证说明
日期2026-07-11
分支:`codex/a-route-rpa-send`
## 本轮目标
用户明确当前先不要求真实发送消息,只要求“打开那个会话窗口”,用来验证数字员工是否能:
1. 识别会话窗口。
2. 定位发送编辑框。
3. 定位发送按钮/文件按钮。
4. 执行一次可审计的点击。
本地环境没有 iSphere 服务端,无法登录,所以真实会话窗口不能通过正常业务路径打开。
## 已实现:离线会话窗口探针
新增脚本:
```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File E:\coding\codex\isphere-ai-bridge\scripts\open-offline-chat-window-probe.ps1 -ProbeClick
```
它会打开一个本地 WinForms 会话窗口探针,不连接服务端,不发送真实消息。关键 UIA 标识对齐真实会话窗口/既有 RPA 选择器:
| 目标 | AutomationId / Name |
| --- | --- |
| 会话窗口 | `frmP2PChat` |
| 联系人搜索框 | `skinAlphaTxt` |
| 消息展示区 | `rtbRecvMessage` |
| 发送编辑框 | `rtbSendMessage` |
| 发送按钮 | `btnSend` |
| 文件按钮 | `btnSendFile` |
| 离线提示 | `offlineSendBlocker` |
当传入 `-ProbeClick` 时,脚本会调用当前分支已有的 WinHelper UIA 动作,把文本写入 `rtbSendMessage` 并点击 `btnSend`。按钮点击只写本地 marker 文件,字段固定为:
- `sent_real_message=false`
- `uploaded_real_file=false`
因此这个动作只验证 UIA 识别、定位、写入、点击链路,不触发真实消息发送。
## 自动化测试
新增测试:
```powershell
powershell -NoProfile -ExecutionPolicy Bypass -File E:\coding\codex\isphere-ai-bridge\scripts\test-open-offline-chat-window-probe.ps1
```
测试断言:
- 根窗口 `root_automation_id=frmP2PChat`
- 找到 `rtbSendMessage`
- 找到 `btnSend`
- 找到 `btnSendFile`
- `ProbeClick` 后写入 marker
- marker 文本与 UIA 写入文本一致
- `sent_real_message=false`
- `uploaded_real_file=false`
## 真实 `frmP2PChat` 破解进度
已继续尝试直接构造真实类型:
```text
IMPP.Client.Business.ChatManager.SingleChat.frmP2PChat
```
构造函数签名:
```text
frmP2PChat(com.vision.smack.Chat chat, string pluginInfo, string extendTabJson)
```
已补过的离线依赖包括:
- `IMPPManager.Instance.MessageCenter`
- `IMPPManager.Instance.LogonUser`
- `IMPPManager.Instance.UserInfo`
- `SmarkManager.Connection`
- `SmarkManager.RosterManager`
- `SmarkManager.PresenceManager`
- `SmarkManager.P2PChatManager`
- `ConfigSystemManager.config`
- `P2PChat.OtherJid`
仍未成功打开真实窗体。当前阻塞不再是脚本能力而是构造函数内部把窗体初始化、登录态、连接态、名册状态、消息中心事件、配置状态混在一起。IL 证据显示构造函数中直接访问:
- `IMPPManager.Instance.Connection.add_OnConnectError`
- `IMPPManager.Instance.Connection.add_OnReConnectOk`
- `P2PChat.OtherJid.getBareJid`
- `IMPPManager.Instance.UserInfo.get_Jid`
- `UCChatSendMessageBox.GetChatRichTextBox`
- `UCChatSendMessageBox.GetReceiptCheckBox`
- `IMPPManager.Instance.GetMessageCenter().add_OnTcpMessageArrived`
- `IMPPManager.Instance.RosterManager.UpdateStrangerStatus`
- `Config.BaseConfig.VisualPhoneEnable`
这说明真实 `frmP2PChat` 不是独立窗口类;它要求完整登录运行态。没有服务端/登录态时继续硬构造,投入会越来越像“重建一个假客户端运行时”。
## 当前业务结论
从“验证 RPA 能否识别、定位、点击会话窗口”的业务目标看,本轮已经可验证:
- 会话窗口可打开。
- 核心 AutomationId 可识别。
- 文本可写入。
- 按钮可点击。
- 点击结果可留本地审计 marker。
- 全程不发真实消息、不上传真实文件。
从“真实 iSphere 会话窗口”的目标看,仍需要在线登录环境或继续补完整客户端运行态。
## 下一步建议
1. 当前分支先使用 `open-offline-chat-window-probe.ps1` 验证 RPA 识别/定位/点击效果。
2. 在线环境拿到真实登录后的 `frmP2PChat` HWND 后,用同一套 WinHelper 选择器直接验证真实窗口。
3. 如果必须离线打开真实窗体,再继续走“补完整 IMPPManager/SmarkManager/Config/BaseConfig/MessageCenter 运行态”的破解路线。