Files
isphere-ai-bridge/docs/superpowers/plans/2026-07-11-a-route-rpa-send.md
2026-07-11 20:21:41 +08:00

5.9 KiB
Raw Blame History

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 opC# 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.

  • Write failing test proving injected connector receives raw ContentText while response/audit do not leak it.

  • Run focused test and confirm failure.

  • Add ContentText to normalized args and connector request.

  • 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.

  • Write failing tests for missing config and successful helper call using a fake helper caller.

  • Implement adapter request mapping.

  • 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.

  • Add synthetic WinForms verification that starts a form with rtbSendMessage, btnSend, invokes uia_send_message, and verifies button-click side effect in a label.

  • Implement UiaSendAction with ValuePattern/Win32 fallback and InvokePattern/click fallback.

  • 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.

  • Add config loader and tests around production connector availability.

  • Keep standard smoke deterministic with env cleared.

  • Add server env routing test; helper synthetic UIA smoke covers the local write/click action.

  • Update docs with minimal usage.

Task 5: Verification, commit, push

  • Run git diff --check.
  • Run go test ./....
  • Run go build ./cmd/isphere-mcp then remove root binary.
  • Run powershell -NoProfile -ExecutionPolicy Bypass -File scripts\verify-win-helper.ps1.
  • Run powershell -NoProfile -ExecutionPolicy Bypass -File scripts\verify-go-mcp.ps1.
  • Commit and push branch codex/a-route-rpa-send.

Task 6: Open conversation window probe for A-route RPA

Files:

  • Create: scripts/open-offline-chat-window-probe.ps1
  • Create: scripts/test-open-offline-chat-window-probe.ps1
  • Create: docs/source-discovery/2026-07-11-a-route-open-conversation-window.md

Purpose: local environment cannot log in, but RPA still needs a stable conversation-window surface to prove identify/locate/click behavior. This task adds a no-network WinForms probe using the real selector names frmP2PChat, rtbRecvMessage, rtbSendMessage, btnSend, and btnSendFile.

  • Write failing test proving the open-conversation probe script is required.
  • Implement the offline chat-window probe.
  • Verify UIA classification finds send editor, send button, and file button.
  • Verify -ProbeClick writes text and clicks btnSend.
  • Verify marker says sent_real_message=false and uploaded_real_file=false.
  • Document why direct offline construction of the real frmP2PChat is still blocked by login/runtime singletons.