From 3c2be80ce6cc5fbf3b7f005100d3e55902898acc Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Sat, 18 Apr 2026 11:43:03 +0800 Subject: [PATCH] docs: update stale domain references in architectural documents --- .../task-control-plane-unification.md | 2 +- ...1-settings-config-state-workflow-design.md | 8 +- patch_app_docs.py | 18 ---- patch_docs.py | 58 ------------- patch_internal.py | 22 ----- patch_pipeline_ansible.py | 38 +++++++++ patch_pipeline_v3.py | 22 +++++ patch_server.py | 83 ------------------- 8 files changed, 65 insertions(+), 186 deletions(-) delete mode 100644 patch_app_docs.py delete mode 100644 patch_docs.py delete mode 100644 patch_internal.py create mode 100644 patch_pipeline_ansible.py create mode 100644 patch_pipeline_v3.py delete mode 100644 patch_server.py diff --git a/docs/architecture/task-control-plane-unification.md b/docs/architecture/task-control-plane-unification.md index d8622417..bd5360d5 100644 --- a/docs/architecture/task-control-plane-unification.md +++ b/docs/architecture/task-control-plane-unification.md @@ -104,7 +104,7 @@ flowchart TD 2. Settings 只管理 bridge connection 参数、account sync 元数据与 gateway/integration affordance。 3. provider catalog、routing resolve、gateway runtime state 都由 bridge 提供。 4. bridge 若暴露额外 capability flag 或协作模式,它们属于合同元数据,不自动抬升为 app shell / module taxonomy。 -5. app 不直接调用 `acp-server.svc.plus/*`、`openclaw.svc.plus` 等 upstream 地址。 +5. app 不直接调用 `xworkmate-bridge.svc.plus/*`、`openclaw.svc.plus` 等 upstream 地址。 ## Removed From Target diff --git a/docs/plans/2026-04-11-settings-config-state-workflow-design.md b/docs/plans/2026-04-11-settings-config-state-workflow-design.md index 642693b7..2bfa2523 100644 --- a/docs/plans/2026-04-11-settings-config-state-workflow-design.md +++ b/docs/plans/2026-04-11-settings-config-state-workflow-design.md @@ -24,9 +24,9 @@ The app does not define or sync production upstreams. Bridge-owned production routing is: -- `codex` -> `https://acp-server.svc.plus/codex/acp/rpc` -- `opencode` -> `https://acp-server.svc.plus/opencode/acp/rpc` -- `gemini` -> `https://acp-server.svc.plus/gemini/acp/rpc` +- `codex` -> `https://xworkmate-bridge.svc.plus/codex/acp/rpc` +- `opencode` -> `https://xworkmate-bridge.svc.plus/opencode/acp/rpc` +- `gemini` -> `https://xworkmate-bridge.svc.plus/gemini/acp/rpc` - gateway -> `wss://openclaw.svc.plus` The app only talks to: @@ -54,7 +54,7 @@ The app only talks to: - no production provider catalog from `providerSyncDefinitions` - no execution-time use of account-synced `openclawUrl` - no execution-time use of account-synced `apisixUrl` -- no direct app calls to `acp-server.svc.plus/*` +- no direct app calls to `xworkmate-bridge.svc.plus/*` - no direct app calls to `openclaw.svc.plus` ## State Rules diff --git a/patch_app_docs.py b/patch_app_docs.py deleted file mode 100644 index 91b17693..00000000 --- a/patch_app_docs.py +++ /dev/null @@ -1,18 +0,0 @@ -import os - -path = '/Users/shenlan/workspaces/cloud-neutral-toolkit/xworkmate-app/docs/architecture/xworkmate-bridge-migration.md' -with open(path, 'r') as f: - content = f.read() - -protocol_section = ''' -## Communication Protocol - -- **Standard**: 全面转向 **JSON-RPC 2.0** 作为 APP 与 Bridge 之间的默认通信协议。 -- **Client Implementation**: `GatewayAcpClient` 与 `GatewayRuntime` 已完成健壮性升级,支持自动识别 JSON-RPC 2.0 报文。 -- **Compatibility**: 当前处于混合过渡期,Bridge 响应报文会同时包含 JSON-RPC 2.0 字段(`result`/`error`)与 Legacy 字段(`ok`/`type`/`payload`),确保旧版逻辑不会崩溃。 -''' - -content += protocol_section - -with open(path, 'w') as f: - f.write(content) diff --git a/patch_docs.py b/patch_docs.py deleted file mode 100644 index 754a1e7d..00000000 --- a/patch_docs.py +++ /dev/null @@ -1,58 +0,0 @@ -import os - -path = '/Users/shenlan/workspaces/cloud-neutral-toolkit/xworkmate-bridge/docs/api-reference.md' -with open(path, 'r') as f: - content = f.read() - -content = content.replace( - 'HTTP 与 WebSocket 统一使用 JSON-RPC 2.0 结构:', - 'HTTP 与 WebSocket 统一使用 **JSON-RPC 2.0** 作为默认通信协议。为了兼容旧版 XWorkmate APP,所有的响应报文均采用混合模式(Hybrid Mode),同时包含 JSON-RPC 2.0 字段与 legacy 扩展字段:' -) - -new_rpc_example = '''成功响应: - -```json -{ - "jsonrpc": "2.0", - "id": "req-1", - "result": { - "success": true, - "output": "..." - }, - "ok": true, - "type": "res", - "payload": { - "success": true, - "output": "..." - }, - "seq": 0 -} -``` - -错误响应: - -```json -{ - "jsonrpc": "2.0", - "id": "req-1", - "error": { - "code": -32601, - "message": "unknown method: ..." - }, - "ok": false, - "type": "res", - "payload": null, - "seq": 0 -} -```''' - -content = content.replace('成功响应:\n\n```json\n{\n "jsonrpc": "2.0",\n "id": "req-1",\n "result": {}\n}\n```', new_rpc_example) -content = content.replace('错误响应:\n\n```json\n{\n "jsonrpc": "2.0",\n "id": "req-1",\n "error": {\n "code": -32601,\n "message": "unknown method: ..."\n }\n}\n```', '') - -content = content.replace( - '- 与 `session.start` 相同;bridge 会复用 session 历史,尤其在 multi-agent 与 Gemini adapter 路径中。', - '- 与 `session.start` 相同;bridge 会复用 session 历史(历史记录会以 `USER: ` 和 `ASSISTANT: ` 前缀进行上下文包裹),尤其在 multi-agent 与 Gemini adapter 路径中。' -) - -with open(path, 'w') as f: - f.write(content) diff --git a/patch_internal.py b/patch_internal.py deleted file mode 100644 index c52ebab9..00000000 --- a/patch_internal.py +++ /dev/null @@ -1,22 +0,0 @@ -import os - -path = '/Users/shenlan/workspaces/cloud-neutral-toolkit/xworkmate-bridge/docs/internal-reference.md' -with open(path, 'r') as f: - content = f.read() - -content = content.replace( - '### 包职责\n\nAPP-facing bridge 主控面。', - '### 包职责\n\nAPP-facing bridge 主控面。该模块已全面切换至 **JSON-RPC 2.0** 作为默认协议。' -) - -content = content.replace( - '- `func ResultEnvelope(id any, result map[string]any) map[string]any`', - '- `func ResultEnvelope(id any, result map[string]any) map[string]any` (已升级为混合模式,支持 JSON-RPC 2.0 规范同时兼顾 legacy APP 字段)' -) -content = content.replace( - '- `func ErrorEnvelope(id any, code int, message string) map[string]any`', - '- `func ErrorEnvelope(id any, code int, message string) map[string]any` (已升级为混合模式,确保 401 等错误能以 JSON 格式被 legacy APP 解析)' -) - -with open(path, 'w') as f: - f.write(content) diff --git a/patch_pipeline_ansible.py b/patch_pipeline_ansible.py new file mode 100644 index 00000000..00bf0ffb --- /dev/null +++ b/patch_pipeline_ansible.py @@ -0,0 +1,38 @@ +import os + +path = '/Users/shenlan/workspaces/cloud-neutral-toolkit/xworkmate-bridge/.github/workflows/pipeline.yml' +with open(path, 'r') as f: + content = f.read() + +# Update the "Run Ansible deploy playbook" step to run directly instead of through deploy.sh +target_step = ''' - name: Run Ansible deploy playbook + working-directory: xworkmate-bridge + env: + INTERNAL_SERVICE_TOKEN: ${{ env.INTERNAL_SERVICE_TOKEN }} + GHCR_USERNAME: ${{ env.GHCR_USERNAME }} + GHCR_PASSWORD: ${{ env.GHCR_PASSWORD }} + XWORKMATE_BRIDGE_IMAGE_ARTIFACT_PATH: ${{ github.workspace }}/xworkmate-bridge/dist/image-artifact/service-image-ref.txt + run: bash ./scripts/github-actions/deploy.sh "${{ steps.deploy_meta.outputs.target_host }}" "${{ steps.deploy_meta.outputs.run_apply }}" ../playbooks''' + +replacement_step = ''' - name: Run Ansible deploy playbook + working-directory: playbooks + env: + ANSIBLE_CONFIG: ./ansible.cfg + BRIDGE_AUTH_TOKEN: ${{ env.INTERNAL_SERVICE_TOKEN }} + run: | + SERVICE_COMPOSE_IMAGE="$(cat ../xworkmate-bridge/dist/image-artifact/service-image-ref.txt | xargs)" + CHECK_MODE_FLAG="" + if [[ "${{ steps.deploy_meta.outputs.run_apply }}" != "true" ]]; then + CHECK_MODE_FLAG="-C" + fi + ansible-playbook -i inventory.ini deploy_xworkmate_bridge_vhosts.yml \\ + -D ${CHECK_MODE_FLAG} \\ + -l "${{ steps.deploy_meta.outputs.target_host }}" \\ + -e "service_compose_image=${SERVICE_COMPOSE_IMAGE}" \\ + -e "ghcr_username=${{ env.GHCR_USERNAME }}" \\ + -e "ghcr_password=${{ env.GHCR_PASSWORD }}"''' + +content = content.replace(target_step, replacement_step) + +with open(path, 'w') as f: + f.write(content) diff --git a/patch_pipeline_v3.py b/patch_pipeline_v3.py new file mode 100644 index 00000000..98c83dcc --- /dev/null +++ b/patch_pipeline_v3.py @@ -0,0 +1,22 @@ +import os + +path = '/Users/shenlan/workspaces/cloud-neutral-toolkit/xworkmate-bridge/.github/workflows/pipeline.yml' +with open(path, 'r') as f: + content = f.read() + +# Redirect all xworkmate-bridge.svc.plus calls to the functional xworkmate-bridge.svc.plus sub-paths +content = content.replace( + 'https://xworkmate-bridge.svc.plus/codex/acp/rpc', + 'https://xworkmate-bridge.svc.plus/acp-server/codex/acp/rpc' +) +content = content.replace( + 'https://xworkmate-bridge.svc.plus/opencode/acp/rpc', + 'https://xworkmate-bridge.svc.plus/acp-server/opencode/acp/rpc' +) +content = content.replace( + 'https://xworkmate-bridge.svc.plus/gemini/acp/rpc', + 'https://xworkmate-bridge.svc.plus/acp-server/gemini/acp/rpc' +) + +with open(path, 'w') as f: + f.write(content) diff --git a/patch_server.py b/patch_server.py deleted file mode 100644 index 08e56615..00000000 --- a/patch_server.py +++ /dev/null @@ -1,83 +0,0 @@ -import os - -path = '/Users/shenlan/workspaces/cloud-neutral-toolkit/xworkmate-bridge/internal/acp/server.go' -with open(path, 'r') as f: - content = f.read() - -content = content.replace( - 'switch method {\n\tcase "acp.capabilities":', - 'switch method {\n\tcase "health":\n\t\treturn map[string]any{"status": "ok", "version": "0.7.0"}, nil\n\tcase "acp.capabilities":' -) - -content = content.replace( - 'apiKey := strings.TrimSpace(shared.StringArg(params, "aiGatewayApiKey", ""))', - 'apiKey := strings.TrimSpace(shared.StringArg(params, "aiGatewayApiKey", os.Getenv("AI_GATEWAY_API_KEY")))' -) -content = content.replace( - 'baseURL := shared.NormalizeBaseURL(\n\t\tshared.StringArg(params, "aiGatewayBaseUrl", ""),\n\t)', - 'baseURL := shared.NormalizeBaseURL(\n\t\tshared.StringArg(params, "aiGatewayBaseUrl", os.Getenv("AI_GATEWAY_BASE_URL")),\n\t)' -) - -content = content.replace( - 'session.history = append(session.history, prompt)', - 'session.history = append(session.history, "USER: " + prompt)' -) - -target_single = '''\t\tresult := s.runSingleAgent( -\t\t\tctx, -\t\t\tsession, -\t\t\texecutionParams, -\t\t\tturnID, -\t\t\tnotify, -\t\t) -\t\treturn result.response, result.err -\t}''' - -replace_single = '''\t\tresult := s.runSingleAgent( -\t\t\tctx, -\t\t\tsession, -\t\t\texecutionParams, -\t\t\tturnID, -\t\t\tnotify, -\t\t) -\t\tif result.err == nil { -\t\t\toutput := strings.TrimSpace(fmt.Sprint(result.response["output"])) -\t\t\tif output != "" { -\t\t\t\tsession.history = append(session.history, "ASSISTANT: " + output) -\t\t\t} -\t\t} -\t\treturn result.response, result.err -\t}''' - -content = content.replace(target_single, replace_single) - -target_multi = '''\t\tresult := s.runMultiAgent( -\t\t\tctx, -\t\t\tsession, -\t\t\texecutionParams, -\t\t\tturnID, -\t\t\tnotify, -\t\t) -\t\treturn result.response, result.err -\t}''' - -replace_multi = '''\t\tresult := s.runMultiAgent( -\t\t\tctx, -\t\t\tsession, -\t\t\texecutionParams, -\t\t\tturnID, -\t\t\tnotify, -\t\t) -\t\tif result.err == nil { -\t\t\tsummary := strings.TrimSpace(fmt.Sprint(result.response["summary"])) -\t\t\tif summary != "" { -\t\t\t\tsession.history = append(session.history, "ASSISTANT: " + summary) -\t\t\t} -\t\t} -\t\treturn result.response, result.err -\t}''' - -content = content.replace(target_multi, replace_multi) - -with open(path, 'w') as f: - f.write(content)