@0xmaxma/claude-gateway 1.2.15 → 1.2.17

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.
@@ -51,10 +51,25 @@ export class BrowserModule implements ToolModule {
51
51
  let filePath: string;
52
52
  if (mediaDir) {
53
53
  fs.mkdirSync(mediaDir, { recursive: true });
54
- filePath = path.join(mediaDir, `browser_shot_${sid}_${Date.now()}.${ext}`);
55
- } else {
56
- filePath = path.join('/tmp', `browser_shot_${sid}.${ext}`);
54
+ const filename = `browser_shot_${sid}_${Date.now()}.${ext}`;
55
+ filePath = path.join(mediaDir, filename);
56
+ fs.writeFileSync(filePath, Buffer.from(b64, 'base64'));
57
+ const apiUrl = process.env.GATEWAY_API_URL;
58
+ const agentId = process.env.GATEWAY_AGENT_ID;
59
+ if (apiUrl && agentId) {
60
+ // mediaDir is <agentBase>/media/<subdir>; parent is the agent's media root
61
+ const agentMediaRoot = path.dirname(mediaDir);
62
+ const relPath = path.relative(agentMediaRoot, filePath)
63
+ .split(path.sep)
64
+ .map(encodeURIComponent)
65
+ .join('/');
66
+ return {
67
+ content: [{ type: 'text', text: `${apiUrl}/v1/agents/${encodeURIComponent(agentId)}/media/${relPath}` }],
68
+ };
69
+ }
70
+ return { content: [{ type: 'text', text: filePath }] };
57
71
  }
72
+ filePath = path.join('/tmp', `browser_shot_${sid}.${ext}`);
58
73
  fs.writeFileSync(filePath, Buffer.from(b64, 'base64'));
59
74
  return { content: [{ type: 'text', text: filePath }] };
60
75
  }
@@ -53,9 +53,16 @@ If `browser_navigate` or `browser_navigate_tab` returns error like `tab "t99" no
53
53
 
54
54
  ### Step 5 — Screenshot and confirm
55
55
 
56
- Call `mcp__gateway__browser_screenshot` result is absolute file path.
56
+ Call `mcp__gateway__browser_screenshot` `result` is either an HTTP URL or an absolute file path.
57
57
 
58
- Send to Telegram with the screenshot attached.
58
+ Detect channel: `api_reply` tool available = API session; `telegram_reply` tool available = Telegram session.
59
+
60
+ | Channel | Condition | Action |
61
+ |---------|-----------|--------|
62
+ | API | result starts with `http` | `api_reply(text=result)` |
63
+ | API | result is a file path | `api_reply(attachments=[result])` |
64
+ | Telegram | — | `telegram_reply(files=[result])` |
65
+ | Other | — | include path in text response |
59
66
 
60
67
  ## Multi-tab Management
61
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmaxma/claude-gateway",
3
- "version": "1.2.15",
3
+ "version": "1.2.17",
4
4
  "description": "Multi-agent gateway for Claude",
5
5
  "repository": {
6
6
  "type": "git",