feat: add a-route uia send connector
This commit is contained in:
@@ -383,3 +383,16 @@ R14 release-candidate report is complete:
|
||||
- Updated `docs\go-mcp-runbook.md` with the R14 business status and package paths.
|
||||
- Verification passed: package builders/verifiers, `git diff --check`, `scripts\verify-business-goals-smoke.ps1`, `go test ./...`, `go build ./cmd/isphere-mcp`, and `scripts\verify-go-mcp.ps1`.
|
||||
- Final R14 business conclusion: search contacts, search groups, receive messages, and receive-file list are usable; send-message preview and send-file preview are usable; production send, real file download, and production file upload remain evidence-blocked.
|
||||
|
||||
|
||||
## A-route UIA send branch
|
||||
|
||||
A-route UIA send branch is in progress on `codex/a-route-rpa-send`:
|
||||
|
||||
- User direction: do not add a product approval gate; implement function first and let the digital employee layer decide when to call it.
|
||||
- Added plan `docs\superpowers\plans\2026-07-11-a-route-rpa-send.md`.
|
||||
- Go connector request now carries raw `ContentText` only to the action connector; response and audit remain redacted.
|
||||
- Added Go `uia-rpa` send connector adapter and env loader.
|
||||
- Added C# helper op `uia_send_message` that sets the send editor text and invokes the send button through UI Automation.
|
||||
- Synthetic local verification in `scripts\verify-win-helper.ps1` proves the helper can write to a WinForms send box and trigger a send button marker.
|
||||
- Default MCP smoke still clears A-route env and remains preview/blocked unless explicitly configured.
|
||||
|
||||
@@ -574,7 +574,38 @@ runs\send-file-sandbox-gate-package.zip
|
||||
|
||||
They are generated under ignored `runs\` and are not committed.
|
||||
|
||||
## 18. Troubleshooting
|
||||
## 18. A-route UIA send connector
|
||||
|
||||
A-route is the UI Automation fallback for text sending when the B-route sidecar cannot be tested. It is function-first: there is no human approval ID gate inside the connector. The digital employee layer is responsible for deciding when to call production mode.
|
||||
|
||||
Local verification uses a synthetic WinForms window:
|
||||
|
||||
```powershell
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\verify-win-helper.ps1
|
||||
```
|
||||
|
||||
Expected output includes helper version `0.5.0` and:
|
||||
|
||||
```json
|
||||
{"synthetic_uia_send_action":"uia_send_message"}
|
||||
```
|
||||
|
||||
To enable A-route in a logged-in desktop session, configure the MCP server environment before startup:
|
||||
|
||||
```powershell
|
||||
$env:ISPHERE_SEND_CONNECTOR_MODE = "uia_rpa"
|
||||
$env:ISPHERE_SEND_UIA_HWND = "0x001A0B2C"
|
||||
$env:ISPHERE_SEND_UIA_EDITOR_AUTOMATION_ID = "rtbSendMessage"
|
||||
$env:ISPHERE_SEND_UIA_BUTTON_AUTOMATION_ID = "btnSend"
|
||||
# optional if not using runs\win-helper\ISphereWinHelper.exe
|
||||
$env:ISPHERE_SEND_UIA_HELPER_PATH = "E:\coding\codex\isphere-ai-bridge\runs\win-helper\ISphereWinHelper.exe"
|
||||
```
|
||||
|
||||
Then call `isphere_send_message` with `execution_mode="production"`. The connector will set the send editor text and invoke the send button through UI Automation. Response metadata uses `connector_mode="uia-rpa"`; the audit still stores hashes and metadata, not the raw message body or raw idempotency key.
|
||||
|
||||
Standard `scripts\verify-go-mcp.ps1` clears all A-route env vars so the deterministic smoke remains preview/blocked by default.
|
||||
|
||||
## 19. Troubleshooting
|
||||
|
||||
- If C# helper build fails, run `scripts\build-win-helper.ps1` directly and check for missing .NET Framework reference assemblies.
|
||||
- If `win_helper_version` fails, rerun `powershell -NoProfile -ExecutionPolicy Bypass -File scripts\verify-win-helper.ps1` first.
|
||||
|
||||
30
docs/source-discovery/2026-07-11-a-route-uia-send.md
Normal file
30
docs/source-discovery/2026-07-11-a-route-uia-send.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# A-route UIA Send Implementation Note
|
||||
|
||||
Date: 2026-07-11
|
||||
Branch: `codex/a-route-rpa-send`
|
||||
|
||||
## Decision
|
||||
|
||||
The A-route fallback is now function-first. It does not introduce an approval ID gate inside the MCP tool or connector. Digital employee policy can decide when to call `execution_mode="production"`; the connector focuses on performing the UI action when explicitly configured.
|
||||
|
||||
## Implemented local-safe proof
|
||||
|
||||
- `SendMessageConnectorRequest` now carries `ContentText` to the connector only.
|
||||
- `internal/tools/send_message_uia_adapter.go` maps production send requests to helper op `uia_send_message`.
|
||||
- `native/ISphereWinHelper/UiaSendAction.cs` sets the send editor text and invokes the send button by UI Automation / Win32 fallback.
|
||||
- `scripts/verify-win-helper.ps1` uses a synthetic WinForms window to prove write + button invoke without requiring iSphere login.
|
||||
|
||||
## Runtime configuration
|
||||
|
||||
```powershell
|
||||
$env:ISPHERE_SEND_CONNECTOR_MODE = "uia_rpa"
|
||||
$env:ISPHERE_SEND_UIA_HWND = "0x001A0B2C"
|
||||
$env:ISPHERE_SEND_UIA_EDITOR_AUTOMATION_ID = "rtbSendMessage"
|
||||
$env:ISPHERE_SEND_UIA_BUTTON_AUTOMATION_ID = "btnSend"
|
||||
```
|
||||
|
||||
Then call `isphere_send_message` with `execution_mode="production"`.
|
||||
|
||||
## Remaining real-environment work
|
||||
|
||||
The local environment still cannot log in to iSphere. The code path is implemented and locally proven against synthetic UIA, but real iSphere success still needs a logged-in window handle and one real run in the online environment.
|
||||
95
docs/superpowers/plans/2026-07-11-a-route-rpa-send.md
Normal file
95
docs/superpowers/plans/2026-07-11-a-route-rpa-send.md
Normal file
@@ -0,0 +1,95 @@
|
||||
# A-Route RPA Send Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** 在 `codex/a-route-rpa-send` 分支实现 A 方案:通过受控 UI Automation 路线让 `isphere_send_message` 能配置为真实 UI 写入并点击发送。
|
||||
|
||||
**Architecture:** Go MCP 继续保留稳定 `isphere_send_message` 接口、hash、idempotency、audit。新增 A-route connector 调用 C# `ISphereWinHelper` 的 UIA action op;C# helper 根据窗口句柄、发送框 AutomationId、发送按钮 AutomationId 写入文本并点击。B-route sidecar 仍是主路线,但当前不可测时先实现 A-route 功能兜底。
|
||||
|
||||
**Tech Stack:** Go 1.23.4, github.com/modelcontextprotocol/go-sdk, Windows PowerShell, .NET Framework C# helper, Windows UI Automation.
|
||||
|
||||
## Global Constraints
|
||||
|
||||
- Repository root: `E:\coding\codex\isphere-ai-bridge`.
|
||||
- Active branch: `codex/a-route-rpa-send`.
|
||||
- Do not use `rg`; use `git ls-files`, `ag`, `grep -R`, or PowerShell commands.
|
||||
- Local machine cannot log in; use synthetic WinForms/UIA verification for local tests.
|
||||
- User explicitly removed human approval as a product gate for A-route; do not add approval IDs or approval queues in this plan.
|
||||
- Keep audit redaction: do not store raw message body or raw idempotency key in committed docs/audit tests.
|
||||
- Real UI action requires explicit env configuration; default MCP behavior remains preview/blocked.
|
||||
|
||||
---
|
||||
|
||||
## Task 1: Go connector must carry raw content to action connector
|
||||
|
||||
**Files:**
|
||||
- Modify: `internal/tools/send_message_connector.go`
|
||||
- Modify: `internal/tools/isphere_send_message.go`
|
||||
- Modify: `internal/tools/isphere_send_message_test.go`
|
||||
|
||||
**Interfaces:**
|
||||
- Produces: `SendMessageConnectorRequest.ContentText string` for connector execution only.
|
||||
- Audit and response still omit raw content.
|
||||
|
||||
- [x] Write failing test proving injected connector receives raw `ContentText` while response/audit do not leak it.
|
||||
- [x] Run focused test and confirm failure.
|
||||
- [x] Add `ContentText` to normalized args and connector request.
|
||||
- [x] Run focused send-message tests.
|
||||
|
||||
## Task 2: Go A-route UIA connector adapter
|
||||
|
||||
**Files:**
|
||||
- Create: `internal/tools/send_message_uia_adapter.go`
|
||||
- Create: `internal/tools/send_message_uia_adapter_test.go`
|
||||
|
||||
**Interfaces:**
|
||||
- Produces: `type UiaSendMessageAdapterConfig struct { HelperPath string; TimeoutSeconds int; Hwnd string; SendEditorAutomationID string; SendButtonAutomationID string; Mode string }`.
|
||||
- Produces: `NewUiaSendMessageConnector(config UiaSendMessageAdapterConfig, caller UiaHelperCaller) SendMessageConnector`.
|
||||
- Helper op: `uia_send_message`.
|
||||
|
||||
- [x] Write failing tests for missing config and successful helper call using a fake helper caller.
|
||||
- [x] Implement adapter request mapping.
|
||||
- [x] Run focused adapter tests.
|
||||
|
||||
## Task 3: C# WinHelper UIA send action
|
||||
|
||||
**Files:**
|
||||
- Create: `native/ISphereWinHelper/UiaSendAction.cs`
|
||||
- Modify: `native/ISphereWinHelper/Program.cs`
|
||||
- Modify: `scripts/verify-win-helper.ps1`
|
||||
|
||||
**Interfaces:**
|
||||
- Helper op `uia_send_message` args: `hwnd`, `send_editor_automation_id`, `send_button_automation_id`, `content_text`, `content_sha256`, `target_ref`.
|
||||
- Helper data: `action_mode="uia_send_message"`, `typed_text=true`, `clicked_ui=true`, `sent_message=true`, `content_sha256`, `target_ref`, `editor_found`, `button_found`.
|
||||
|
||||
- [x] Add synthetic WinForms verification that starts a form with `rtbSendMessage`, `btnSend`, invokes `uia_send_message`, and verifies button-click side effect in a label.
|
||||
- [x] Implement `UiaSendAction` with ValuePattern/Win32 fallback and InvokePattern/click fallback.
|
||||
- [x] Run `scripts\verify-win-helper.ps1`.
|
||||
|
||||
## Task 4: Wire A-route connector into MCP env config
|
||||
|
||||
**Files:**
|
||||
- Modify: `internal/tools/isphere_send_message.go`
|
||||
- Modify: `internal/mcpserver/server.go`
|
||||
- Modify: `scripts/verify-go-mcp.ps1`
|
||||
- Modify: `docs/go-mcp-runbook.md`
|
||||
- Modify: `docs/current-status-card.md`
|
||||
|
||||
**Interfaces:**
|
||||
- Env `ISPHERE_SEND_CONNECTOR_MODE=uia_rpa` enables A-route connector.
|
||||
- Env `ISPHERE_SEND_UIA_HWND`, `ISPHERE_SEND_UIA_EDITOR_AUTOMATION_ID`, `ISPHERE_SEND_UIA_BUTTON_AUTOMATION_ID`, optional `ISPHERE_SEND_UIA_HELPER_PATH` configure the action.
|
||||
- Default env remains no real send.
|
||||
|
||||
- [x] Add config loader and tests around production connector availability.
|
||||
- [x] Keep standard smoke deterministic with env cleared.
|
||||
- [x] Add server env routing test; helper synthetic UIA smoke covers the local write/click action.
|
||||
- [x] Update docs with minimal usage.
|
||||
|
||||
## Task 5: Verification, commit, push
|
||||
|
||||
- [x] Run `git diff --check`.
|
||||
- [x] Run `go test ./...`.
|
||||
- [x] Run `go build ./cmd/isphere-mcp` then remove root binary.
|
||||
- [x] Run `powershell -NoProfile -ExecutionPolicy Bypass -File scripts\verify-win-helper.ps1`.
|
||||
- [x] Run `powershell -NoProfile -ExecutionPolicy Bypass -File scripts\verify-go-mcp.ps1`.
|
||||
- [x] Commit and push branch `codex/a-route-rpa-send`.
|
||||
Reference in New Issue
Block a user