superbased 2.0.2 → 2.0.6

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.
@@ -243,6 +243,48 @@ function nextStepsForDictate(cleanup, hadText) {
243
243
  * Shared between stdio transport (CLI) and HTTP transport (API server).
244
244
  */
245
245
  function registerMcpTools(server, client, projectDir) {
246
+ // Compatibility shim for MCP clients that reject `{ type: 'image' }` content
247
+ // blocks despite the MCP spec accepting them. Observed concrete failure:
248
+ // OpenCode's MCP client validates each block with a Zod schema that only
249
+ // permits `type: 'text'`, surfacing as `-32602 Invalid params: expected
250
+ // "text"` on every tool that returns a screenshot (workspace_sync, ui_dump,
251
+ // capture_image, scroll_capture, …).
252
+ // When SUPERBASED_MCP_TEXT_ONLY=1 is set on the bridge process (configurable
253
+ // per-client in the MCP server's `env` block), we transparently filter image
254
+ // content blocks out of every tool response before they reach the transport.
255
+ // The text block is kept — agents still see the metadata + base64 byte count;
256
+ // they just lose direct vision-model handoff. Non-strict clients (Claude
257
+ // Code, Cursor, Windsurf, Codex) leave the var unset and keep getting the
258
+ // image blocks they asked for.
259
+ const stripImageBlocks = process.env.SUPERBASED_MCP_TEXT_ONLY === '1';
260
+ if (stripImageBlocks) {
261
+ const origTool = server.tool.bind(server);
262
+ server.tool = (...toolArgs) => {
263
+ // server.tool's last positional arg is always the handler callback.
264
+ const handler = toolArgs[toolArgs.length - 1];
265
+ if (typeof handler === 'function') {
266
+ const wrapped = async (...handlerArgs) => {
267
+ const result = await handler(...handlerArgs);
268
+ if (result && typeof result === 'object' && 'content' in result) {
269
+ const r = result;
270
+ if (Array.isArray(r.content)) {
271
+ r.content = r.content.filter((b) => {
272
+ return !(b && typeof b === 'object' && b.type === 'image');
273
+ });
274
+ // MCP spec allows empty content, but some clients reject zero-
275
+ // length arrays. Guarantee at least one block.
276
+ if (r.content.length === 0) {
277
+ r.content.push({ type: 'text', text: '(image content stripped — SUPERBASED_MCP_TEXT_ONLY=1)' });
278
+ }
279
+ }
280
+ }
281
+ return result;
282
+ };
283
+ toolArgs[toolArgs.length - 1] = wrapped;
284
+ }
285
+ return origTool(...toolArgs);
286
+ };
287
+ }
246
288
  // Monitor alert poller state
247
289
  let monitorPoller = null;
248
290
  let monitorSessionId = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superbased",
3
- "version": "2.0.2",
3
+ "version": "2.0.6",
4
4
  "main": "dist/electron/main.js",
5
5
  "bin": {
6
6
  "superbased": "./dist/headless/headless/cli.js"
@@ -142,10 +142,10 @@
142
142
  },
143
143
  "optionalDependencies": {
144
144
  "sherpa-onnx-node": "^1.10.0",
145
- "@superbased/macos-speech": "^0.1.0",
146
- "@superbased/winrt-speech": "^0.1.0",
147
- "@superbased/macos-ax": "^0.1.0",
148
- "@superbased/win-uia": "^0.1.0"
145
+ "@superbased/macos-speech": "0.1.0",
146
+ "@superbased/winrt-speech": "0.1.0",
147
+ "@superbased/macos-ax": "0.1.0",
148
+ "@superbased/win-uia": "0.1.0"
149
149
  },
150
150
  "overrides": {
151
151
  "tar": ">=7.5.11"