Forces unlimited chat mode by blocking agent mode and credit usage
Size
8.4 KB
Version
1.1.1
Created
Nov 25, 2025
Updated
18 days ago
1// ==UserScript==
2// @name Manus.im Unlimited Chat Mode
3// @description Forces unlimited chat mode by blocking agent mode and credit usage
4// @version 1.1.1
5// @match https://*.manus.im/*
6// @icon https://manus.im/favicon.ico
7// ==/UserScript==
8(function() {
9 'use strict';
10
11 console.log('Manus.im Unlimited Chat Mode - Extension loaded');
12
13 // Intercept fetch requests to modify agent mode and credits
14 const originalFetch = unsafeWindow.fetch;
15 unsafeWindow.fetch = async function(...args) {
16 const [url, options] = args;
17
18 // Log all requests for debugging
19 console.log('Fetch intercepted:', url);
20
21 try {
22 // Intercept requests that might contain agent mode settings
23 if (typeof url === 'string' && url.includes('manus.im')) {
24
25 // Modify request body if it contains agent mode settings
26 if (options && options.body) {
27 let body = options.body;
28
29 // Parse JSON body if it's a string
30 if (typeof body === 'string') {
31 try {
32 let bodyObj = JSON.parse(body);
33
34 // Force agent mode to standard (not agent)
35 if (bodyObj.agentTaskMode) {
36 console.log('Blocking agent mode - Original:', bodyObj.agentTaskMode);
37 bodyObj.agentTaskMode = 'AGENT_TASK_MODE_STANDARD';
38 console.log('Forced to:', bodyObj.agentTaskMode);
39 }
40
41 // Block scheduled tasks
42 if (bodyObj.scheduledTask !== undefined) {
43 console.log('Blocking scheduled task');
44 bodyObj.scheduledTask = false;
45 }
46
47 // Set credits to 0 or remove credit fields
48 if (bodyObj.credits !== undefined) {
49 console.log('Setting credits to 0');
50 bodyObj.credits = 0;
51 }
52
53 if (bodyObj.useCredits !== undefined) {
54 console.log('Disabling credit usage');
55 bodyObj.useCredits = false;
56 }
57
58 // Update the request body
59 options.body = JSON.stringify(bodyObj);
60 console.log('Modified request body:', bodyObj);
61 } catch {
62 console.log('Could not parse request body as JSON');
63 }
64 }
65 }
66 }
67
68 // Make the actual request
69 const response = await originalFetch.apply(this, args);
70
71 // Intercept and modify responses
72 if (typeof url === 'string' && url.includes('manus.im')) {
73 const clonedResponse = response.clone();
74
75 try {
76 const responseData = await clonedResponse.json();
77
78 // Modify response data to force unlimited mode
79 if (responseData) {
80 let modified = false;
81
82 // Force agent mode to standard in responses
83 if (responseData.agentTaskMode) {
84 console.log('Response agent mode detected - forcing to standard');
85 responseData.agentTaskMode = 'AGENT_TASK_MODE_STANDARD';
86 modified = true;
87 }
88
89 // Set unlimited credits in user data
90 if (responseData.credits !== undefined) {
91 console.log('Setting response credits to unlimited');
92 responseData.credits = 999999;
93 modified = true;
94 }
95
96 // Disable credit requirements
97 if (responseData.requiresCredits !== undefined) {
98 responseData.requiresCredits = false;
99 modified = true;
100 }
101
102 if (modified) {
103 console.log('Modified response data:', responseData);
104 // Return modified response
105 return new Response(JSON.stringify(responseData), {
106 status: response.status,
107 statusText: response.statusText,
108 headers: response.headers
109 });
110 }
111 }
112 } catch {
113 // Not JSON or couldn't parse, return original response
114 console.log('Response not JSON or parse error');
115 }
116 }
117
118 return response;
119 } catch (error) {
120 console.error('Error in fetch interceptor:', error);
121 return originalFetch.apply(this, args);
122 }
123 };
124
125 // Intercept XMLHttpRequest as well
126 const originalXHROpen = unsafeWindow.XMLHttpRequest.prototype.open;
127 const originalXHRSend = unsafeWindow.XMLHttpRequest.prototype.send;
128
129 unsafeWindow.XMLHttpRequest.prototype.open = function(method, url, ...rest) {
130 this._url = url;
131 this._method = method;
132 return originalXHROpen.apply(this, [method, url, ...rest]);
133 };
134
135 unsafeWindow.XMLHttpRequest.prototype.send = function(body) {
136 console.log('XHR intercepted:', this._method, this._url);
137
138 if (body && typeof body === 'string' && this._url && this._url.includes('manus.im')) {
139 try {
140 let bodyObj = JSON.parse(body);
141
142 // Force agent mode to standard
143 if (bodyObj.agentTaskMode) {
144 console.log('XHR: Blocking agent mode');
145 bodyObj.agentTaskMode = 'AGENT_TASK_MODE_STANDARD';
146 }
147
148 // Block scheduled tasks
149 if (bodyObj.scheduledTask !== undefined) {
150 bodyObj.scheduledTask = false;
151 }
152
153 // Disable credits
154 if (bodyObj.credits !== undefined) {
155 bodyObj.credits = 0;
156 }
157
158 if (bodyObj.useCredits !== undefined) {
159 bodyObj.useCredits = false;
160 }
161
162 body = JSON.stringify(bodyObj);
163 console.log('XHR: Modified request body');
164 } catch {
165 console.log('XHR: Could not parse body as JSON');
166 }
167 }
168
169 return originalXHRSend.apply(this, [body]);
170 };
171
172 // Monitor and modify any agent mode settings in the page
173 function blockAgentModeInDOM() {
174 // Look for any UI elements or data attributes related to agent mode
175 const agentModeElements = document.querySelectorAll('[data-agent-mode], [data-task-mode]');
176 agentModeElements.forEach(el => {
177 console.log('Found agent mode element, modifying:', el);
178 el.setAttribute('data-agent-mode', 'standard');
179 el.setAttribute('data-task-mode', 'standard');
180 });
181 }
182
183 // Run on page load and periodically check
184 if (document.readyState === 'loading') {
185 document.addEventListener('DOMContentLoaded', blockAgentModeInDOM);
186 } else {
187 blockAgentModeInDOM();
188 }
189
190 // Check periodically for new elements
191 setInterval(blockAgentModeInDOM, 2000);
192
193 // Use MutationObserver to catch dynamic changes
194 const observer = new MutationObserver(() => {
195 blockAgentModeInDOM();
196 });
197
198 observer.observe(document.documentElement, {
199 childList: true,
200 subtree: true,
201 attributes: true,
202 attributeFilter: ['data-agent-mode', 'data-task-mode']
203 });
204
205 console.log('Manus.im Unlimited Chat Mode - All interceptors active');
206})();