opencode-bridge 0.1.3__py3-none-any.whl → 0.1.5__py3-none-any.whl
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.
- opencode_bridge/server.py +17 -2
- {opencode_bridge-0.1.3.dist-info → opencode_bridge-0.1.5.dist-info}/METADATA +1 -1
- opencode_bridge-0.1.5.dist-info/RECORD +7 -0
- opencode_bridge-0.1.3.dist-info/RECORD +0 -7
- {opencode_bridge-0.1.3.dist-info → opencode_bridge-0.1.5.dist-info}/WHEEL +0 -0
- {opencode_bridge-0.1.3.dist-info → opencode_bridge-0.1.5.dist-info}/entry_points.txt +0 -0
opencode_bridge/server.py
CHANGED
|
@@ -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,15 @@ Set via:
|
|
|
302
303
|
session = self.sessions[sid]
|
|
303
304
|
session.add_message("user", message)
|
|
304
305
|
|
|
305
|
-
#
|
|
306
|
-
|
|
306
|
+
# Always write message to temp file to avoid shell escaping issues
|
|
307
|
+
temp_file = tempfile.NamedTemporaryFile(
|
|
308
|
+
mode='w', suffix='.md', delete=False, prefix='opencode_msg_'
|
|
309
|
+
)
|
|
310
|
+
temp_file.write(message)
|
|
311
|
+
temp_file.close()
|
|
312
|
+
args = ["run", "Respond to the request in the attached message file."]
|
|
313
|
+
files = (files or []) + [temp_file.name]
|
|
314
|
+
|
|
307
315
|
args.extend(["--model", session.model])
|
|
308
316
|
args.extend(["--agent", session.agent])
|
|
309
317
|
|
|
@@ -325,6 +333,13 @@ Set via:
|
|
|
325
333
|
|
|
326
334
|
output, code = await self._run_opencode(*args)
|
|
327
335
|
|
|
336
|
+
# Cleanup temp file
|
|
337
|
+
if temp_file:
|
|
338
|
+
try:
|
|
339
|
+
os.unlink(temp_file.name)
|
|
340
|
+
except OSError:
|
|
341
|
+
pass
|
|
342
|
+
|
|
328
343
|
if code != 0:
|
|
329
344
|
return f"Error: {output}"
|
|
330
345
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
opencode_bridge/__init__.py,sha256=SkXVg907MuInd7UEYOjHjiiIIT46y4S2l20hE9cShKo,92
|
|
2
|
+
opencode_bridge/install.py,sha256=VOJNYUPxq88g0XizkHSQ9noM3Qcd3AfZxPUZInEKErk,1796
|
|
3
|
+
opencode_bridge/server.py,sha256=wPaHkfWvi_LtIIrOOO20x2Eg8vM19eXrS03N2RZZDtc,28933
|
|
4
|
+
opencode_bridge-0.1.5.dist-info/METADATA,sha256=fTj3RGmp8dn_Ra1XZBmQFVDm9UcwR1zvc-5jLrCun3I,3924
|
|
5
|
+
opencode_bridge-0.1.5.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
6
|
+
opencode_bridge-0.1.5.dist-info/entry_points.txt,sha256=8elAgeI-Sk7EPoV7kUr3CCgQyIAW2VfDj5ZXQ_9slCc,184
|
|
7
|
+
opencode_bridge-0.1.5.dist-info/RECORD,,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
opencode_bridge/__init__.py,sha256=SkXVg907MuInd7UEYOjHjiiIIT46y4S2l20hE9cShKo,92
|
|
2
|
-
opencode_bridge/install.py,sha256=VOJNYUPxq88g0XizkHSQ9noM3Qcd3AfZxPUZInEKErk,1796
|
|
3
|
-
opencode_bridge/server.py,sha256=iQ2SHPy9rRp8K3hpRxOGgXcw7VdT9JX0amjUS87A6Fk,28475
|
|
4
|
-
opencode_bridge-0.1.3.dist-info/METADATA,sha256=Y6YMgJvGUT2k-Jr-wz1Npr_VUugcgkKy6gceHr8ND_0,3924
|
|
5
|
-
opencode_bridge-0.1.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
6
|
-
opencode_bridge-0.1.3.dist-info/entry_points.txt,sha256=8elAgeI-Sk7EPoV7kUr3CCgQyIAW2VfDj5ZXQ_9slCc,184
|
|
7
|
-
opencode_bridge-0.1.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|