docs: update stale domain references in architectural documents
This commit is contained in:
parent
c9d8def03a
commit
3c2be80ce6
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
@ -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)
|
||||
@ -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)
|
||||
38
patch_pipeline_ansible.py
Normal file
38
patch_pipeline_ansible.py
Normal file
@ -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)
|
||||
22
patch_pipeline_v3.py
Normal file
22
patch_pipeline_v3.py
Normal file
@ -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)
|
||||
@ -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)
|
||||
Loading…
Reference in New Issue
Block a user