@markus-global/cli 0.11.3-rc.0 → 0.12.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/backend.d.ts.map +1 -1
  2. package/dist/backend.js +5 -1
  3. package/dist/backend.js.map +1 -1
  4. package/dist/commands/approval-card.d.ts +53 -0
  5. package/dist/commands/approval-card.d.ts.map +1 -0
  6. package/dist/commands/approval-card.js +43 -0
  7. package/dist/commands/approval-card.js.map +1 -0
  8. package/dist/commands/auth.d.ts.map +1 -1
  9. package/dist/commands/auth.js +11 -5
  10. package/dist/commands/auth.js.map +1 -1
  11. package/dist/commands/init.d.ts.map +1 -1
  12. package/dist/commands/init.js +7 -5
  13. package/dist/commands/init.js.map +1 -1
  14. package/dist/commands/model.d.ts.map +1 -1
  15. package/dist/commands/model.js +6 -4
  16. package/dist/commands/model.js.map +1 -1
  17. package/dist/commands/outbound.d.ts +76 -0
  18. package/dist/commands/outbound.d.ts.map +1 -0
  19. package/dist/commands/outbound.js +80 -0
  20. package/dist/commands/outbound.js.map +1 -0
  21. package/dist/commands/start.d.ts +124 -2
  22. package/dist/commands/start.d.ts.map +1 -1
  23. package/dist/commands/start.js +718 -82
  24. package/dist/commands/start.js.map +1 -1
  25. package/dist/index.js +5 -20
  26. package/dist/index.js.map +1 -1
  27. package/dist/markus.mjs +112615 -103125
  28. package/dist/web-ui/assets/AsyncState-BebkDWbq.js +1 -0
  29. package/dist/web-ui/assets/{CommentInput-C-niUbUY.js → CommentInput-BRZWIC3U.js} +1 -1
  30. package/dist/web-ui/assets/{ContentRenderer-DxsnJJRX.js → ContentRenderer-PGP8H_Zz.js} +2 -2
  31. package/dist/web-ui/assets/DeliverableShareModal-CcigVYGz.js +1 -0
  32. package/dist/web-ui/assets/Deliverables-CQwXaCA4.js +3 -0
  33. package/dist/web-ui/assets/{Notifications-4KXYRdkr.js → Notifications-BvHJCIRG.js} +1 -1
  34. package/dist/web-ui/assets/Search-BA-aXh7i.js +1 -0
  35. package/dist/web-ui/assets/SendToChat-CAfyKhpq.js +1 -0
  36. package/dist/web-ui/assets/Settings-icFp6tNI.js +8 -0
  37. package/dist/web-ui/assets/{Store-JWjwXfTU.js → Store-DKwOcmMu.js} +1 -1
  38. package/dist/web-ui/assets/Switch-C7lFnHA7.js +1 -0
  39. package/dist/web-ui/assets/Team-DyqXLZ-X.js +84 -0
  40. package/dist/web-ui/assets/Work-BXGrda4S.js +12 -0
  41. package/dist/web-ui/assets/{arc-DPZmpo1U.js → arc-Dnk6N-Zc.js} +1 -1
  42. package/dist/web-ui/assets/{architectureDiagram-3BPJPVTR-DlOs02JO.js → architectureDiagram-3BPJPVTR-CV8JIXXD.js} +1 -1
  43. package/dist/web-ui/assets/{blockDiagram-GPEHLZMM-C7qsXNUe.js → blockDiagram-GPEHLZMM-D9pKmrXH.js} +1 -1
  44. package/dist/web-ui/assets/{c4Diagram-AAUBKEIU-Drwp-rtM.js → c4Diagram-AAUBKEIU-Q26HvIpY.js} +1 -1
  45. package/dist/web-ui/assets/channel-BZs6ereM.js +1 -0
  46. package/dist/web-ui/assets/{chunk-2J33WTMH-VgR09Mqk.js → chunk-2J33WTMH-BSjFVwnx.js} +1 -1
  47. package/dist/web-ui/assets/{chunk-4BX2VUAB-CuwDpBRL.js → chunk-4BX2VUAB-BZXv4MQp.js} +1 -1
  48. package/dist/web-ui/assets/{chunk-55IACEB6-nC7YWJ_i.js → chunk-55IACEB6-CeKd3oeJ.js} +1 -1
  49. package/dist/web-ui/assets/{chunk-727SXJPM-Dw6mBsRE.js → chunk-727SXJPM-DP1tSQo5.js} +1 -1
  50. package/dist/web-ui/assets/{chunk-AQP2D5EJ-CPhNJbHl.js → chunk-AQP2D5EJ-DqEncn7j.js} +1 -1
  51. package/dist/web-ui/assets/{chunk-FMBD7UC4-AyhQakG8.js → chunk-FMBD7UC4-tuDUJ9Xx.js} +1 -1
  52. package/dist/web-ui/assets/{chunk-ND2GUHAM-DgYemv8I.js → chunk-ND2GUHAM-DoC8aLWB.js} +1 -1
  53. package/dist/web-ui/assets/{chunk-QZHKN3VN-CLdqxrFB.js → chunk-QZHKN3VN-74zpvcgs.js} +1 -1
  54. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-C9JIxJeJ.js +1 -0
  55. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-C9JIxJeJ.js +1 -0
  56. package/dist/web-ui/assets/{cose-bilkent-S5V4N54A-DrOgwDIH.js → cose-bilkent-S5V4N54A-DjYUalC1.js} +1 -1
  57. package/dist/web-ui/assets/{dagre-BM42HDAG-DhoJiA83.js → dagre-BM42HDAG-oSewacE8.js} +1 -1
  58. package/dist/web-ui/assets/{diagram-2AECGRRQ-BDILSgqK.js → diagram-2AECGRRQ-C1fiWe46.js} +1 -1
  59. package/dist/web-ui/assets/{diagram-5GNKFQAL-CeXywd1i.js → diagram-5GNKFQAL-9G_q6hCa.js} +1 -1
  60. package/dist/web-ui/assets/{diagram-KO2AKTUF-Bi4RlMT0.js → diagram-KO2AKTUF-CSm-lJp-.js} +1 -1
  61. package/dist/web-ui/assets/{diagram-LMA3HP47-Cw1yxk8b.js → diagram-LMA3HP47-BTAORcHx.js} +1 -1
  62. package/dist/web-ui/assets/{diagram-OG6HWLK6-Bl857da2.js → diagram-OG6HWLK6-DbcCkDfo.js} +1 -1
  63. package/dist/web-ui/assets/{docx-preview-CjoUhrMq.js → docx-preview-DjqdA44x.js} +1 -1
  64. package/dist/web-ui/assets/{erDiagram-TEJ5UH35-DEiaMhuV.js → erDiagram-TEJ5UH35-DFa-B8-u.js} +1 -1
  65. package/dist/web-ui/assets/{flowDiagram-I6XJVG4X-BgKZhO0h.js → flowDiagram-I6XJVG4X-WCTnaK9M.js} +1 -1
  66. package/dist/web-ui/assets/{ganttDiagram-6RSMTGT7-Dkx-EaS8.js → ganttDiagram-6RSMTGT7-DbW1CoJJ.js} +1 -1
  67. package/dist/web-ui/assets/{gitGraphDiagram-PVQCEYII-DXaQwA0y.js → gitGraphDiagram-PVQCEYII-1faDfO29.js} +1 -1
  68. package/dist/web-ui/assets/index-B8h1PPzP.js +883 -0
  69. package/dist/web-ui/assets/index-DD3NMntN.css +1 -0
  70. package/dist/web-ui/assets/{infoDiagram-5YYISTIA-Dpx9IOkx.js → infoDiagram-5YYISTIA-DfXKP4tQ.js} +1 -1
  71. package/dist/web-ui/assets/{ishikawaDiagram-YF4QCWOH-BWqWgitQ.js → ishikawaDiagram-YF4QCWOH-D6FOsFQ5.js} +1 -1
  72. package/dist/web-ui/assets/{journeyDiagram-JHISSGLW-BBwIZ4k9.js → journeyDiagram-JHISSGLW-DXpxntIF.js} +1 -1
  73. package/dist/web-ui/assets/{kanban-definition-UN3LZRKU-C_MRWV8R.js → kanban-definition-UN3LZRKU-Dt7FBCF3.js} +1 -1
  74. package/dist/web-ui/assets/{mermaid.core-BMAh3nnq.js → mermaid.core-sTcSUoRD.js} +5 -5
  75. package/dist/web-ui/assets/{mindmap-definition-RKZ34NQL-B6vJQcat.js → mindmap-definition-RKZ34NQL-CvOU23ga.js} +1 -1
  76. package/dist/web-ui/assets/{pieDiagram-4H26LBE5-BxdEttqt.js → pieDiagram-4H26LBE5-DUedtXVj.js} +1 -1
  77. package/dist/web-ui/assets/{quadrantDiagram-W4KKPZXB-gsNs2VfP.js → quadrantDiagram-W4KKPZXB-CqpHHRca.js} +1 -1
  78. package/dist/web-ui/assets/{requirementDiagram-4Y6WPE33-BSC9KvC2.js → requirementDiagram-4Y6WPE33-CKZYvVDJ.js} +1 -1
  79. package/dist/web-ui/assets/{sankeyDiagram-5OEKKPKP-DktAZfe_.js → sankeyDiagram-5OEKKPKP-gZ0nzDfs.js} +1 -1
  80. package/dist/web-ui/assets/{sequenceDiagram-3UESZ5HK-BIPt8kGU.js → sequenceDiagram-3UESZ5HK-DN3XdBkW.js} +1 -1
  81. package/dist/web-ui/assets/{stateDiagram-AJRCARHV-DiXmJWB0.js → stateDiagram-AJRCARHV-BvtafGxO.js} +1 -1
  82. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-B2nWDV5R.js +1 -0
  83. package/dist/web-ui/assets/{timeline-definition-PNZ67QCA-LRi7H35g.js → timeline-definition-PNZ67QCA-BrR919lp.js} +1 -1
  84. package/dist/web-ui/assets/{vennDiagram-CIIHVFJN-DWQ1I022.js → vennDiagram-CIIHVFJN-B7CTm4yM.js} +1 -1
  85. package/dist/web-ui/assets/{wardley-L42UT6IY-BUb6dYqN.js → wardley-L42UT6IY-CyqFngx_.js} +1 -1
  86. package/dist/web-ui/assets/{wardleyDiagram-YWT4CUSO-BYE1B3xT.js → wardleyDiagram-YWT4CUSO-BCqEPBJ5.js} +1 -1
  87. package/dist/web-ui/assets/{xychartDiagram-2RQKCTM6-D-pS2-Sa.js → xychartDiagram-2RQKCTM6-BmT6Cmz-.js} +1 -1
  88. package/dist/web-ui/index.html +2 -2
  89. package/docs/README.md +1 -0
  90. package/docs/architecture/architecture.md +1 -1
  91. package/docs/architecture/configuration-model.md +156 -0
  92. package/docs/architecture/messaging-gateway.md +1043 -0
  93. package/docs/architecture/notification-delivery.md +273 -0
  94. package/docs/design/remote-access-contract.md +445 -0
  95. package/docs/guides/development.md +1 -1
  96. package/docs/guides/guide.md +4 -2
  97. package/docs/guides/remote-access.md +147 -214
  98. package/docs/handoff/approval-tri-state-handoff.md +69 -0
  99. package/docs/handoff/remote-access-handoff.md +160 -0
  100. package/docs/records/agent-platform-friction-2026-10.md +102 -2
  101. package/package.json +1 -1
  102. package/dist/web-ui/assets/DeliverableShareModal-DV3TiZx0.js +0 -1
  103. package/dist/web-ui/assets/Deliverables-tlLsJnxZ.js +0 -3
  104. package/dist/web-ui/assets/Search-CPFwZv1U.js +0 -1
  105. package/dist/web-ui/assets/Settings-DIa-_qre.js +0 -8
  106. package/dist/web-ui/assets/Team-COBxn96h.js +0 -84
  107. package/dist/web-ui/assets/Work-BScJUqWL.js +0 -12
  108. package/dist/web-ui/assets/channel-DCChB-1T.js +0 -1
  109. package/dist/web-ui/assets/classDiagram-4FO5ZUOK-CrNiYfSI.js +0 -1
  110. package/dist/web-ui/assets/classDiagram-v2-Q7XG4LA2-CrNiYfSI.js +0 -1
  111. package/dist/web-ui/assets/index-C_QhfMcC.js +0 -882
  112. package/dist/web-ui/assets/index-DEN_qReg.css +0 -1
  113. package/dist/web-ui/assets/modelCapabilities-DDtCBZ6o.js +0 -1
  114. package/dist/web-ui/assets/stateDiagram-v2-BHNVJYJU-COOgTXIX.js +0 -1
@@ -1,286 +1,219 @@
1
1
  # Remote Access Guide
2
2
 
3
- This guide covers how to make your local Markus instance accessible from the internet — for remote team collaboration, external agent (OpenClaw) integration, or mobile access.
3
+ > **Architecture v2 — "bring your own tunnel".** Earlier versions routed all remote
4
+ > traffic through a single Markus-operated VPS (signal server + TURN + in-band
5
+ > HTTP/WS proxy). That is gone. Your tunnel carries the data; Markus Hub only
6
+ > provides the **entry domain**, an **endpoint registry**, and a **login gate**.
7
+ >
8
+ > Normative interface: [`docs/design/remote-access-contract.md`](../design/remote-access-contract.md) (frozen, T1).
9
+ > Shared types: `packages/remote/src/contract.ts`. UI logic: `packages/web-ui/src/lib/remoteAccess.ts`.
4
10
 
5
11
  ---
6
12
 
7
- ## Quick Comparison
13
+ ## 0. What changed
8
14
 
9
- | Method | Setup Time | Requires Domain | Requires Public Server | Security | Best For |
10
- |--------|-----------|-----------------|----------------------|----------|----------|
11
- | **Cloudflare Tunnel** | 5 min | Yes (free) | No | High (built-in WAF + DDoS) | Recommended default |
12
- | **Tailscale** | 3 min | No | No | Very High (WireGuard mesh) | Private team access |
13
- | **FRP** | 15 min | Optional | Yes (need a VPS) | Medium | China mainland, self-hosted |
14
- | **ngrok** | 2 min | No | No | Medium | Quick demos / testing |
15
+ | | Old (v1) | New (v2) |
16
+ |---|---|---|
17
+ | Data path | through our Relay/TURN VPS | **your own tunnel** (Cloudflare / Tailscale / your proxy) |
18
+ | Cost/quality | on us, single choke point | on the tunnel provider's free tier; scales with you |
19
+ | Public address | our relay | a tunnel hostname you own or get for free |
20
+ | Hub's job | signal + relay + proxy | entry domain + endpoint registry + auth gate |
21
+ | Public entry | relay URL | `https://{user}.remote.markus.global` → **302** to your tunnel after login |
15
22
 
16
- ---
17
-
18
- ## Option 1: Cloudflare Tunnel (Recommended)
19
-
20
- Zero-trust tunnel — no open inbound ports, free HTTPS, built-in DDoS protection. Works with WebSocket out of the box.
21
-
22
- ### Prerequisites
23
-
24
- - A domain name (can use a free one via Cloudflare registrar)
25
- - A free Cloudflare account
26
-
27
- ### Setup
28
-
29
- ```bash
30
- # 1. Install cloudflared
31
- # macOS
32
- brew install cloudflared
33
- # Linux
34
- curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -o /usr/local/bin/cloudflared
35
- chmod +x /usr/local/bin/cloudflared
36
-
37
- # 2. Authenticate with Cloudflare
38
- cloudflared tunnel login
39
-
40
- # 3. Create a tunnel
41
- cloudflared tunnel create markus
42
-
43
- # 4. Route your subdomain to the tunnel
44
- cloudflared tunnel route dns markus markus.yourdomain.com
23
+ The remote access section of the app is now an **onboarding wizard**: pick a
24
+ method, run (or delegate) the setup, watch six steps, then share a ready link.
45
25
 
46
- # 5. Create config file
47
- mkdir -p ~/.cloudflared
48
- cat > ~/.cloudflared/config.yml << 'EOF'
49
- tunnel: markus
50
- credentials-file: ~/.cloudflared/<TUNNEL_ID>.json
26
+ ---
51
27
 
52
- ingress:
53
- - hostname: markus.yourdomain.com
54
- service: http://localhost:8056
55
- - service: http_status:404
56
- EOF
28
+ ## 1. Architecture
57
29
 
58
- # 6. Run the tunnel
59
- cloudflared tunnel run markus
30
+ ```
31
+ Your phone / laptop
32
+ │ 1. open https://{user}.remote.markus.global
33
+ ▼
34
+ Markus Hub ── 2. login gate (Hub session cookie, Domain=.markus.global)
35
+ │
36
+ │ 3. 302 redirect → your registered public URL
37
+ ▼
38
+ Your tunnel (cloudflared / tailscale / your proxy)
39
+ │
40
+ ▼
41
+ Your local Markus (http://127.0.0.1:8056, the local api-server)
60
42
  ```
61
43
 
62
- ### Run as a System Service (Recommended)
44
+ * **No traffic passes through Markus servers.** Hub never proxies the data — it
45
+ answers one request with a `302`.
46
+ * **Hub keeps an endpoint registry** (`remote_endpoints`): which local install
47
+ owns which public URL, health, and a server-side encrypted secret used to
48
+ verify ownership. The local agent registers on startup and on address change.
49
+ * **Ownership is proven** with a challenge–response handshake (the Hub calls your
50
+ tunnel at `verifyPath` and expects the `verifyToken`), with strict SSRF
51
+ protection on the target address.
63
52
 
64
- ```bash
65
- # Install as a system service so it auto-starts
66
- sudo cloudflared service install
67
- ```
53
+ ---
68
54
 
69
- ### Access Markus
55
+ ## 2. Connection methods
70
56
 
71
- Once the tunnel is running, visit `https://markus.yourdomain.com` from anywhere.
57
+ The wizard shows every method with **门槛 / 稳定性 / 账号? / 域名?** badges and a
58
+ live **binary-detected ✓** marker (`cloudflared` / `tailscale` found on this
59
+ machine).
72
60
 
73
- ### Add Authentication with Cloudflare Access (Optional but Recommended)
61
+ | Method | Public address | Account | Domain needed | Setup | Stability |
62
+ |---|---|---|---|---|---|
63
+ | **Cloudflare Quick Tunnel** | random `*.trycloudflare.com` | no | no | easy | address changes on restart |
64
+ | **Cloudflare Named Tunnel** ★ | your own domain | yes | yes | moderate | stable |
65
+ | **Tailscale Funnel** | `*.ts.net` (public) | yes | no | easy | stable |
66
+ | **Tailscale Serve** | tailnet only (not public) | yes | no | easy | stable |
67
+ | **Custom relay / proxy** | whatever you run (frp, ngrok, nginx…) | — | — | advanced | depends on you |
74
68
 
75
- 1. Go to [Cloudflare Zero Trust Dashboard](https://one.dash.cloudflare.com/)
76
- 2. Navigate to **Access > Applications > Add an application**
77
- 3. Set the application domain to `markus.yourdomain.com`
78
- 4. Add an authentication policy (e.g., email OTP, Google SSO, GitHub SSO)
69
+ ★ **Recommended for long-term use** — a named tunnel gives you a stable address.
79
70
 
80
- This adds a login page in front of your Markus instance — even before traffic reaches your server.
71
+ > **Mainland China:** Cloudflare and Tailscale free tiers can be unstable.
72
+ > A self-hosted **FRP** relay is usually the better choice there.
81
73
 
82
74
  ---
83
75
 
84
- ## Option 2: Tailscale (Best for Private Teams)
76
+ ## 3. Setup — path A: run it yourself
85
77
 
86
- Creates a WireGuard-based mesh VPN. Every device gets a stable IP. No ports exposed to the public internet at all.
78
+ Choose a method, then copy the commands for your platform (the wizard offers
79
+ macOS / Linux / Windows). When they are running, click **"I've run it"**.
87
80
 
88
- ### Setup
81
+ ### 3.1 Cloudflare Quick Tunnel (fastest to try)
89
82
 
90
83
  ```bash
91
- # 1. Install Tailscale on your server
92
- # macOS
93
- brew install tailscale
94
- # Linux
95
- curl -fsSL https://tailscale.com/install.sh | sh
96
-
97
- # 2. Start and authenticate
98
- sudo tailscale up
99
-
100
- # 3. Note your Tailscale IP
101
- tailscale ip -4
102
- # e.g., 100.64.x.x
103
-
104
- # 4. Start Markus normally
105
- pnpm dev
84
+ brew install cloudflared # macOS
85
+ # or: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/
86
+ cloudflared tunnel --url http://127.0.0.1:8056
106
87
  ```
107
88
 
108
- ### Access Markus
109
-
110
- Each team member installs Tailscale on their device and joins the same Tailnet. Then access:
89
+ `cloudflared` prints an `https://<random>.trycloudflare.com` URL. The wizard
90
+ picks it up, registers it, verifies it, and turns **Ready**.
111
91
 
112
- ```
113
- http://100.64.x.x:8056 # API
114
- http://100.64.x.x:8057 # Web UI (dev mode)
115
- ```
92
+ > The random hostname changes every restart — Markus detects the change and
93
+ > updates the registry automatically (the entry link stays the same).
116
94
 
117
- ### Enable HTTPS (Optional)
95
+ ### 3.2 Cloudflare Named Tunnel (stable, recommended)
118
96
 
119
97
  ```bash
120
- # Tailscale provides free HTTPS certificates for your machine name
121
- tailscale cert your-machine.tailnet-name.ts.net
122
-
123
- # Then access via:
124
- # https://your-machine.tailnet-name.ts.net:8056
98
+ cloudflared tunnel login
99
+ cloudflared tunnel create markus
100
+ cloudflared tunnel route dns markus markus.example.com
101
+ cloudflared tunnel run --url http://127.0.0.1:8056 markus
125
102
  ```
126
103
 
127
- ### Share with External Users (Tailscale Funnel)
104
+ You now have a **fixed** hostname on your own domain.
105
+
106
+ ### 3.3 Tailscale Funnel (public, stable)
128
107
 
129
108
  ```bash
130
- # Expose port 8056 to the public internet through Tailscale's infrastructure
109
+ tailscale up
131
110
  tailscale funnel 8056
111
+ # → https://<machine>.<tailnet>.ts.net
132
112
  ```
133
113
 
134
- This gives you a public URL like `https://your-machine.tailnet-name.ts.net/`.
114
+ ### 3.4 Tailscale Serve (private — tailnet only, no public exposure)
135
115
 
136
- ---
116
+ ```bash
117
+ tailscale serve 8056
118
+ ```
137
119
 
138
- ## Option 3: FRP (Best for China Mainland / Self-Hosted)
120
+ Nothing is published to the internet; only your own devices can reach it.
139
121
 
140
- If you have a VPS with a public IP (e.g., Alibaba Cloud, Tencent Cloud), FRP is a reliable and fast option.
122
+ ### 3.5 Custom relay (frp / ngrok / nginx)
141
123
 
142
- ### Server Side (VPS with public IP)
124
+ Run your own reverse proxy pointing at `http://127.0.0.1:8056`, then either let
125
+ the wizard discover it, or use **"Enter address manually"** in the failure state
126
+ and paste the public HTTPS URL. The Hub will verify it the same way.
143
127
 
144
- ```bash
145
- # Download frps
146
- wget https://github.com/fatedier/frp/releases/latest/download/frp_0.61.1_linux_amd64.tar.gz
147
- tar xzf frp_*.tar.gz
148
- cd frp_*
149
-
150
- # Create frps config
151
- cat > frps.toml << 'EOF'
152
- bindPort = 7000
153
- auth.token = "your-secret-token-change-me"
154
-
155
- # Dashboard (optional)
156
- webServer.addr = "0.0.0.0"
157
- webServer.port = 7500
158
- webServer.user = "admin"
159
- webServer.password = "admin"
160
-
161
- vhostHTTPPort = 80
162
- vhostHTTPSPort = 443
163
- EOF
164
-
165
- # Run
166
- ./frps -c frps.toml
167
- ```
128
+ ---
168
129
 
169
- ### Client Side (Your Machine Running Markus)
130
+ ## 4. Setup — path B: let an Agent do it
170
131
 
171
- ```bash
172
- # Download frpc
173
- # macOS: brew install frpc
174
- # Or download from https://github.com/fatedier/frp/releases
175
-
176
- cat > frpc.toml << 'EOF'
177
- serverAddr = "your-vps-ip"
178
- serverPort = 7000
179
- auth.token = "your-secret-token-change-me"
180
-
181
- [[proxies]]
182
- name = "markus-api"
183
- type = "tcp"
184
- localIP = "127.0.0.1"
185
- localPort = 8056
186
- remotePort = 8056
187
-
188
- [[proxies]]
189
- name = "markus-web"
190
- type = "tcp"
191
- localIP = "127.0.0.1"
192
- localPort = 8057
193
- remotePort = 8057
194
- EOF
195
-
196
- ./frpc -c frpc.toml
197
- ```
132
+ Choose the method, then **"Let an Agent do it"**. An Agent installs the binary,
133
+ starts the tunnel, and reports status back into the same wizard — you watch the
134
+ same six steps. (Agent runtime lands in T10; until then the panel tells you it is
135
+ unavailable and points you at path A.)
198
136
 
199
- ### Access Markus
137
+ ---
138
+
139
+ ## 5. The setup wizard (six steps)
200
140
 
201
141
  ```
202
- http://your-vps-ip:8056 # API
203
- http://your-vps-ip:8057 # Web UI
142
+ install → start → resolve address → register → verify → ready
204
143
  ```
205
144
 
206
- For HTTPS, add nginx with Let's Encrypt on your VPS as a reverse proxy.
207
-
208
- ---
145
+ | Step | What happens |
146
+ |---|---|
147
+ | **Install** | the binary is present (or you installed it) |
148
+ | **Start** | the tunnel process is running |
149
+ | **Resolve address** | the public URL is parsed from the tunnel's output |
150
+ | **Register** | the endpoint is written to the Hub registry |
151
+ | **Verify** | Hub proves ownership (challenge–response) and checks SSRF safety |
152
+ | **Ready** | you can share the link |
209
153
 
210
- ## Option 4: ngrok (Quick Testing)
154
+ Status arrives live over the WebSocket (`remote:status`), so the wizard advances
155
+ without a page refresh.
211
156
 
212
- Simplest setup for temporary access. Not recommended for production.
157
+ ---
213
158
 
214
- ```bash
215
- # Install
216
- brew install ngrok # macOS
217
- # or: snap install ngrok # Linux
159
+ ## 6. Ready panel
218
160
 
219
- # Authenticate (free account at ngrok.com)
220
- ngrok config add-authtoken <your-token>
161
+ Once ready, the panel shows two things — **they are different addresses**:
221
162
 
222
- # Expose Markus API
223
- ngrok http 8056
224
- ```
163
+ * **Share this entry** — `https://{user}.remote.markus.global`
164
+ Give **this** to people. It needs a Hub login and is protected by the auth
165
+ gate. Copy button + QR code included.
166
+ * **Actual tunnel address** — your real tunnel hostname (e.g. `*.trycloudflare.com`).
167
+ This is what the `302` redirects *to*. After login, your browser's address bar
168
+ will show **this** domain, not `remote.markus.global` — that is expected.
225
169
 
226
- ngrok gives you a random URL like `https://abc123.ngrok-free.app`. Share it for testing.
170
+ Liveness is shown as **● Online / Degraded / ({{ms}} ms latency)**, with three
171
+ actions: **[Restart] [Rotate address] [Turn off]**.
227
172
 
228
173
  ---
229
174
 
230
- ## Security Checklist
175
+ ## 7. Abnormal states
231
176
 
232
- Before exposing Markus to the internet, ensure:
177
+ The wizard never fails silently.
233
178
 
234
- - [ ] **Change the admin password** — complete the onboarding wizard to set your own credentials, or set `ADMIN_PASSWORD` in your `.env` or `markus.json` (initial default is `markus123`)
235
- - [ ] **Change the gateway secret** — set `GATEWAY_SECRET` in your `.env` (default is `markus-gateway-default-secret-change-me`)
236
- - [ ] **Use HTTPS** — Cloudflare Tunnel and Tailscale provide this automatically; for FRP, add nginx + Let's Encrypt
237
- - [ ] **Enable authentication layer** — Cloudflare Access (free), Tailscale ACLs, or nginx basic auth in front
238
- - [ ] **Review CORS** — current default allows all origins (`*`); for production, restrict to your domain
239
- - [ ] **Firewall** — do not expose ports 8056/8058 directly to `0.0.0.0`; always use a tunnel or reverse proxy
179
+ | Symptom | What you see | What to do |
180
+ |---|---|---|
181
+ | Tunnel dropped after being ready | **"Reconnecting…"** (auto-retry, page updates on recovery) | wait; or **Restart** |
182
+ | Verification failed | explicit reason + **Retry** + **Enter address manually** | retry, or paste the URL if discovery got it wrong |
183
+ | Address unreachable / blocked | reason `unreachable` + hint | your network may block it — **switch method** |
184
+ | Token mismatch | reason spelled out | the address may belong to someone else — re-run setup |
185
+ | `cloudflared`/`tailscale` missing | badge shows **not found**, commands warn | run the install command first |
240
186
 
241
- ### Recommended Architecture
242
-
243
- ```
244
- Internet
245
- │
246
- ▼
247
- ┌─────────────────────────┐
248
- │ Cloudflare / Tailscale │ ← TLS termination + auth
249
- │ (Zero-trust tunnel) │
250
- └────────────┬────────────┘
251
- │ (localhost only)
252
- ▼
253
- ┌─────────────────────────┐
254
- │ Markus API (:8056) │ ← HTTP + WebSocket
255
- │ Markus Web UI (:8057) │ ← Vite dev / static files
256
- │ Comm Adapter (:8058) │ ← Internal only
257
- └─────────────────────────┘
258
- ```
187
+ Verification failure reasons surface verbatim from the contract
188
+ (`verifyReasonUnreachable`, `non_https`, `blocked_target`, `too_many_redirects`,
189
+ `response_too_large`, `token_mismatch`, `malformed_response`).
259
190
 
260
191
  ---
261
192
 
262
- ## External Agent (OpenClaw) Gateway Access
193
+ ## 8. Security boundary — **read this**
263
194
 
264
- If you need external AI agents to connect to your Markus instance:
195
+ A tunnel exposes your local Markus **directly to the internet**. The entry gate
196
+ protects the *entry domain*; anyone who learns your **tunnel address** reaches
197
+ Markus directly. Treat it as a public server:
265
198
 
266
- 1. Expose only the API port (8056) via your chosen tunnel method
267
- 2. Set a strong `GATEWAY_SECRET` in your environment
268
- 3. External agents register via `POST /api/gateway/register` and authenticate via `POST /api/gateway/auth`
269
- 4. All gateway communication uses HMAC-SHA256 signed Bearer tokens with 24-hour expiry
270
- 5. See [API Reference](../api/api.md) for full gateway endpoint documentation
199
+ 1. **Always set a password** on your local Markus before exposing it.
200
+ 2. **Put an identity layer in front of the tunnel** — strongly recommended:
201
+ * **Cloudflare Access** (Zero Trust) for cloudflared tunnels, or
202
+ * **Tailscale ACLs**, or use **Tailscale Serve** (tailnet-only, not public).
203
+ 3. Keep `cloudflared` / `tailscale` updated; rotate the tunnel if you suspect a leak.
204
+ 4. The Hub stores only an **encrypted secret** (server-side) to verify you own the
205
+ endpoint — it never receives your traffic or your data.
271
206
 
272
207
  ---
273
208
 
274
- ## FAQ
275
-
276
- **Q: Can I run Markus on a cloud VPS directly?**
277
- A: Yes. Install with the official one-liner (`curl -fsSL https://markus.global/install.sh | bash`) or the desktop/CLI packages, then put nginx or Caddy in front for HTTPS. No tunnel needed since the VPS already has a public IP.
278
-
279
- **Q: Which option works best in China?**
280
- A: FRP with a domestic cloud VPS (Alibaba Cloud / Tencent Cloud). Cloudflare and Tailscale may have connectivity issues behind the GFW.
209
+ ## 9. Honest limits
281
210
 
282
- **Q: Can I combine Tailscale + Cloudflare?**
283
- A: Yes. Use Tailscale for daily team access (zero-config, fast), and Cloudflare Tunnel for public-facing endpoints (external agents, webhooks).
211
+ * **The address bar jumps to your tunnel domain** after login. The pretty entry
212
+ link is a front door, not the room.
213
+ * **Free tunnels are rate-limited** and are not meant for heavy traffic.
214
+ * **Quick tunnels change hostname on restart.** We auto-sync the registry, but
215
+ anyone you gave the *tunnel* address (not the entry link) will need the new one.
216
+ * **Mainland China:** Cloudflare/Tailscale free tiers may be unstable — use FRP.
217
+ * The legacy WebRTC relay path is retained only as a migration fallback for
218
+ existing installs; it is not offered for new setups.
284
219
 
285
- **Q: Do I need a domain name?**
286
- A: Only for Cloudflare Tunnel. Tailscale, FRP, and ngrok work without one.
@@ -0,0 +1,69 @@
1
+ # Approval tri-state — handoff & verification
2
+
3
+ **Branch:** `feat/approval-tri-state-e2e` (worktree `/Users/liuqian/mycode/markus-approval-e2e`)
4
+ **Commits:** `a780c09f` (T1 · single execution point) → `e3ad9ad9` (T2/T3 · re-initiation + three-state UI)
5
+ **Base:** `8bc8d4e2` (main). Not pushed, `main` untouched.
6
+
7
+ ## 1. What the gate semantics are
8
+
9
+ Every approval is resolved to one of three intents — `approve` / `request_changes` (打回) /
10
+ `reject` — by a **single parser** (`resolveApprovalIntent`, `hitl-service.ts`) from
11
+ `f(subType, selectedOption, approved)`. The boolean is only a legacy fallback for payloads
12
+ with no recognised option token. The intent is then applied by a **single execution point**
13
+ (`ApprovalApplier`, `approval-apply.ts`); no consumer transitions a target inline.
14
+
15
+ | Gate (`details.subType`) | Target | approve | 打回 (request_changes) | reject |
16
+ |---|---|---|---|---|
17
+ | `task` (建卡闸) | task `pending` | → `in_progress` | **stays `pending`** + reviewer comment | → `rejected` |
18
+ | `task_review` (验收闸) | task `review` | → `completed` | → `in_progress` (返工) | → `in_progress` (no terminal reject) |
19
+ | `requirement` / `requirement_resubmit` | requirement `pending` | → `in_progress` | **stays `pending`** + comment + creator notice | → `rejected` |
20
+
21
+ The 打回 loop has three segments and none is optional:
22
+ ① the target stays `pending` (zero transition) → ② the reviewer's feedback lands as a comment
23
+ → ③ the assignee revises and **re-initiates the approval**.
24
+
25
+ ## 2. What this branch adds (on top of T1)
26
+
27
+ - **Re-initiation entry (the missing segment ③).** A 打回 consumes the approval entity, so
28
+ the target has no live approval and drops out of `listApprovals('pending')` — an *orphan*
29
+ whose only exit used to be the admin approve endpoint. Now:
30
+ - `TaskService.requestTaskApproval(taskId, actorId?)` and
31
+ `RequirementService.requestRequirementApproval(reqId, actorId?)` re-open the gate.
32
+ - HTTP: `POST /api/tasks/:id/request-approval`, `POST /api/requirements/:id/request-approval`.
33
+ - Agent tool: `task_request_approval`.
34
+ - Guards are actionable errors, never silent no-ops: not-`pending`, already-active
35
+ approval, missing target.
36
+ - **SSOT extraction.** `createTask` and `requestTaskApproval` share one implementation
37
+ (`openCreationGateApproval`); `createRequirement` / `resubmitRequirement` /
38
+ `requestRequirementApproval` share `openRequirementApprovalGate`. No second copy of the
39
+ approval-发起逻辑 can drift.
40
+ - **Explicit three-state UI.** `NotificationBell.tsx` (both the mobile and desktop render
41
+ blocks) now send the canonical token, label `approve` / `request_changes` / `reject`
42
+ distinctly, and no longer fold 打回 into an approval or a rejection. `api.ts` gained the
43
+ `resolveApprovalDirection` closure mirror plus `tasks/requirements.requestApproval`.
44
+ `optionLabels` added for zh-CN / en / es.
45
+
46
+ ## 3. Verification (run in the worktree)
47
+
48
+ | Check | Result |
49
+ |---|---|
50
+ | `pnpm --filter @markus/{core,org-manager} build`, `pnpm --filter markus build` (cli) | exit 0 |
51
+ | `tsc --noEmit -p packages/web-ui/tsconfig.json` | clean |
52
+ | `vitest run --project node` | **6028 pass**, 1 fail — pre-existing network flake `commands-start-integration > auto-runs quickInit` (times out at 60 s in isolation too; unrelated to approvals) |
53
+ | `vitest run --project web-ui` | **1006 pass** (after registering `task_request_approval` in `toolCategories.ts`) |
54
+ | `approval-resubmit-entry.test.ts` (new) | 7/7 |
55
+
56
+ The new test locks: the orphan precondition, gate re-opening, re-send-back stays `pending`,
57
+ re-approve proceeds through the same single execution point, and every guardrail rejection.
58
+
59
+ ## 4. Residual / not done
60
+
61
+ - **Not merged.** Still on `feat/approval-tri-state-e2e`; the previous plan targeted
62
+ `feat/ui-optimize-1015` (a merge, not a fast-forward — my branch is based on `8bc8d4e2`).
63
+ - **UI resubmit button** for a human reviewer is not wired into a specific screen; the
64
+ re-initiation path today is the agent tool + the two HTTP endpoints. Suggested home: the
65
+ pending-task detail view in `Work.tsx` (show it when `status === 'pending'` and no active
66
+ approval exists).
67
+ - **CLI approval card** does not yet render a distinct `changes_requested` terminal state;
68
+ the decision still applies correctly, only the tapped-card wording is generic.
69
+ - `ToolApprovalModal` (tool execution approval) stays binary by design — not a gate.