opencode-bridge 0.1.3__tar.gz → 0.1.4__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opencode-bridge
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: MCP server for continuous OpenCode discussion sessions
5
5
  Project-URL: Repository, https://github.com/genomewalker/opencode-bridge
6
6
  Author: Antonio Fernandez-Guerra
@@ -19,6 +19,7 @@ import os
19
19
  import json
20
20
  import asyncio
21
21
  import shutil
22
+ import tempfile
22
23
  from datetime import datetime
23
24
  from pathlib import Path
24
25
  from typing import Optional
@@ -302,8 +303,19 @@ Set via:
302
303
  session = self.sessions[sid]
303
304
  session.add_message("user", message)
304
305
 
305
- # Build command - message must come right after "run" as positional arg
306
- args = ["run", message]
306
+ # For long messages, write to temp file to avoid shell escaping issues
307
+ temp_file = None
308
+ if len(message) > 500:
309
+ temp_file = tempfile.NamedTemporaryFile(
310
+ mode='w', suffix='.txt', delete=False, prefix='opencode_msg_'
311
+ )
312
+ temp_file.write(message)
313
+ temp_file.close()
314
+ args = ["run", "Respond to the message in the attached file."]
315
+ files = (files or []) + [temp_file.name]
316
+ else:
317
+ args = ["run", message]
318
+
307
319
  args.extend(["--model", session.model])
308
320
  args.extend(["--agent", session.agent])
309
321
 
@@ -325,6 +337,13 @@ Set via:
325
337
 
326
338
  output, code = await self._run_opencode(*args)
327
339
 
340
+ # Cleanup temp file
341
+ if temp_file:
342
+ try:
343
+ os.unlink(temp_file.name)
344
+ except OSError:
345
+ pass
346
+
328
347
  if code != 0:
329
348
  return f"Error: {output}"
330
349
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "opencode-bridge"
7
- version = "0.1.3"
7
+ version = "0.1.4"
8
8
  description = "MCP server for continuous OpenCode discussion sessions"
9
9
  readme = "README.md"
10
10
  license = "MIT"
File without changes