surfagent 1.0.8 → 1.0.9

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.
@@ -179,6 +179,14 @@ const server = http.createServer(async (req, res) => {
179
179
  json(res, 500, { error: message });
180
180
  }
181
181
  });
182
+ server.on('error', (err) => {
183
+ if (err.code === 'EADDRINUSE') {
184
+ console.error(`[surfagent] Port ${PORT} is already in use. API may already be running.`);
185
+ console.error(`[surfagent] Check with: curl localhost:${PORT}/health`);
186
+ process.exit(1);
187
+ }
188
+ throw err;
189
+ });
182
190
  server.listen(PORT, () => {
183
191
  console.log(`Browser Recon API running on http://localhost:${PORT}`);
184
192
  console.log(`CDP target: ${CDP_HOST}:${CDP_PORT}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "surfagent",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Browser automation API for AI agents — structured page recon, form filling, clicking, and navigation via Chrome CDP",
5
5
  "keywords": [
6
6
  "ai-agent",
package/src/api/server.ts CHANGED
@@ -207,6 +207,15 @@ const server = http.createServer(async (req, res) => {
207
207
  }
208
208
  });
209
209
 
210
+ server.on('error', (err: NodeJS.ErrnoException) => {
211
+ if (err.code === 'EADDRINUSE') {
212
+ console.error(`[surfagent] Port ${PORT} is already in use. API may already be running.`);
213
+ console.error(`[surfagent] Check with: curl localhost:${PORT}/health`);
214
+ process.exit(1);
215
+ }
216
+ throw err;
217
+ });
218
+
210
219
  server.listen(PORT, () => {
211
220
  console.log(`Browser Recon API running on http://localhost:${PORT}`);
212
221
  console.log(`CDP target: ${CDP_HOST}:${CDP_PORT}`);