@neoline/hostbridge 1.4.1 → 1.4.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neoline/hostbridge",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "HostBridge MCP server for persistent allowlisted SSH and shell sessions.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hostbridge"
7
- version = "1.4.1"
7
+ version = "1.4.3"
8
8
  description = "HostBridge MCP server for persistent allowlisted SSH and shell sessions."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -19,6 +19,7 @@ from pathlib import Path
19
19
  import pexpect
20
20
 
21
21
  from .hosts import DEFAULT_HOSTS_FILE, HOST_ID_PATTERN, LEGACY_HOSTS_FILE, load_hosts
22
+ from .manager import DEFAULT_MAX_TRANSFER_BYTES
22
23
  from .secrets import decrypt_secret, encrypt_secret
23
24
 
24
25
  DEFAULT_VERIFY_TIMEOUT = 30
@@ -1174,7 +1175,7 @@ def main(argv: list[str] | None = None) -> int:
1174
1175
  mock_ssh_parser.add_argument("--remove", action="store_true", help="Remove the managed SSH config block and exit")
1175
1176
  mock_ssh_parser.add_argument("--connect-timeout", type=int, default=60)
1176
1177
  mock_ssh_parser.add_argument("--command-timeout", type=int, default=DEFAULT_VERIFY_TIMEOUT)
1177
- mock_ssh_parser.add_argument("--output-limit", type=int, default=120000)
1178
+ mock_ssh_parser.add_argument("--output-limit", type=int, default=DEFAULT_MAX_TRANSFER_BYTES)
1178
1179
 
1179
1180
  remove_parser = subparsers.add_parser("remove", parents=[config_parent], help="Remove a configured host")
1180
1181
  remove_parser.add_argument("host_id")
@@ -13,7 +13,7 @@ from pathlib import Path
13
13
  import asyncssh
14
14
 
15
15
  from .daemon import build_manager
16
- from .manager import DEFAULT_COMMAND_TIMEOUT, RemoteCommandError, SessionManager, _new_token
16
+ from .manager import DEFAULT_COMMAND_TIMEOUT, DEFAULT_MAX_TRANSFER_BYTES, RemoteCommandError, SessionManager, _new_token
17
17
 
18
18
  DEFAULT_PORT_RANGE = range(2222, 2300)
19
19
 
@@ -255,12 +255,14 @@ class HostBridgeSFTPServer(asyncssh.SFTPServer):
255
255
  self._checked_run(f"mv -- {shlex.quote(self._path(oldpath))} {shlex.quote(self._path(newpath))}")
256
256
 
257
257
  def realpath(self, path: bytes) -> bytes:
258
- command = (
259
- "python3 -c "
260
- + shlex.quote("import os,sys; print(os.path.realpath(sys.argv[1]))")
261
- + " "
262
- + shlex.quote(self._path(path))
258
+ script = (
259
+ "import os,sys; "
260
+ "path=sys.argv[1]; "
261
+ "parent=os.path.dirname(path) or '/'; "
262
+ "base=os.path.basename(path); "
263
+ "print(os.path.join(os.path.realpath(parent), base) if not os.path.exists(path) else os.path.realpath(path))"
263
264
  )
265
+ command = "python3 -c " + shlex.quote(script) + " " + shlex.quote(self._path(path))
264
266
  result = self._checked_run(command)
265
267
  return (result.output.strip() or self._path(path)).encode("utf-8")
266
268
 
@@ -591,7 +593,7 @@ async def serve_mock_ssh(
591
593
  install_ssh_config: bool = True,
592
594
  connect_timeout: int = 60,
593
595
  command_timeout: int = DEFAULT_COMMAND_TIMEOUT,
594
- output_limit: int = 120000,
596
+ output_limit: int = DEFAULT_MAX_TRANSFER_BYTES,
595
597
  ) -> int:
596
598
  key_dir = key_dir or default_key_dir(host_id)
597
599
  ssh_host_alias = ssh_host_alias or default_ssh_host_alias(host_id)