swiftgate-cli 1.0.5__tar.gz → 1.0.6__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: swiftgate-cli
3
- Version: 1.0.5
3
+ Version: 1.0.6
4
4
  Summary: SwiftGate CLI — autonomous bidirectional agent bridge for SwiftGate OS
5
5
  Project-URL: Homepage, https://swiftgate.ai
6
6
  Project-URL: Repository, https://github.com/thetaroot/swiftgate
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "swiftgate-cli"
7
- version = "1.0.5"
7
+ version = "1.0.6"
8
8
  description = "SwiftGate CLI — autonomous bidirectional agent bridge for SwiftGate OS"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -159,6 +159,7 @@ class AgentBridge:
159
159
  """Forward stdin → agent pty, agent pty → stdout.
160
160
 
161
161
  Runs in the asyncio event loop. Blocks until agent exits.
162
+ Monitors terminal size every 250ms and propagates to the pty.
162
163
  """
163
164
  if not self._running or self._master_fd is None:
164
165
  return
@@ -179,23 +180,26 @@ class AgentBridge:
179
180
  except (termios.error, OSError):
180
181
  pass
181
182
 
182
- # SIGWINCH handler: propagate terminal resize to pty
183
- old_winch = signal.SIG_DFL
184
-
185
- def _resize_pty(_sig: int, _frame) -> None:
186
- try:
187
- cols, rows = os.get_terminal_size()
188
- winsize = struct.pack("HHHH", rows, cols, 0, 0)
189
- fcntl.ioctl(master_fd, termios.TIOCSWINSZ, winsize)
190
- os.environ["COLUMNS"] = str(cols)
191
- os.environ["LINES"] = str(rows)
192
- except OSError:
193
- pass
194
-
195
- try:
196
- old_winch = signal.signal(signal.SIGWINCH, _resize_pty)
197
- except OSError:
198
- pass
183
+ # Periodic terminal resize poller — robust across ttyd/container envs
184
+ _last_cols = 0
185
+ _last_rows = 0
186
+
187
+ async def _resize_poller():
188
+ nonlocal _last_cols, _last_rows
189
+ while self._running:
190
+ await asyncio.sleep(0.25)
191
+ try:
192
+ term_size = os.get_terminal_size()
193
+ if (term_size.columns, term_size.lines) != (_last_cols, _last_rows):
194
+ winsize = struct.pack("HHHH", term_size.lines, term_size.columns, 0, 0)
195
+ fcntl.ioctl(master_fd, termios.TIOCSWINSZ, winsize)
196
+ os.environ["COLUMNS"] = str(term_size.columns)
197
+ os.environ["LINES"] = str(term_size.lines)
198
+ _last_cols, _last_rows = term_size.columns, term_size.lines
199
+ except OSError:
200
+ pass
201
+
202
+ resize_task = asyncio.create_task(_resize_poller())
199
203
 
200
204
  stop_event = asyncio.Event()
201
205
 
@@ -240,6 +244,13 @@ class AgentBridge:
240
244
  except Exception:
241
245
  pass
242
246
 
247
+ # Cleanup resize poller
248
+ resize_task.cancel()
249
+ try:
250
+ await resize_task
251
+ except (asyncio.CancelledError, Exception):
252
+ pass
253
+
243
254
  # Restore terminal
244
255
  if old_tc:
245
256
  try:
@@ -247,13 +258,6 @@ class AgentBridge:
247
258
  except (termios.error, OSError):
248
259
  pass
249
260
 
250
- # Restore SIGWINCH handler
251
- if old_winch != signal.SIG_DFL:
252
- try:
253
- signal.signal(signal.SIGWINCH, old_winch)
254
- except OSError:
255
- pass
256
-
257
261
  # ── Lifecycle ────────────────────────────────────────────────────────────
258
262
 
259
263
  async def wait(self) -> int:
@@ -39,7 +39,7 @@ logger = logging.getLogger("swiftgate")
39
39
 
40
40
 
41
41
  @click.group()
42
- @click.version_option(version="1.0.5", prog_name="swiftgate-cli")
42
+ @click.version_option(version="1.0.6", prog_name="swiftgate-cli")
43
43
  def cli():
44
44
  """swiftgate-cli — Autonomous bidirectional agent bridge for SwiftGate OS.
45
45
 
File without changes
File without changes
File without changes