read_last_port (utils/port.py)

QwenPaw · src/qwenpaw/utils/port.py · python · Apache-2.0
infra, tag:knn-classified

Module exposing: read_last_port, write_port_file, try_bind_port, find_free_port, get_stable_port

# Source: https://github.com/agentscope-ai/QwenPaw | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
# -*- coding: utf-8 -*-
"""Port persistence utilities for desktop backends.

Provides helpers to persist and reuse the backend port across restarts
so that the browser origin (http://127.0.0.1:{port}) stays stable and
localStorage data (selected agent, plugin flags, etc.) survives.

Supports user-configured fixed ports via the
QWENPAW_DESKTOP_PORT environment variable.
"""

from __future__ import annotations

import logging
import secrets
import socket
import sys
from pathlib import Path

from ..constant import QWENPAW_DESKTOP_PORT

logger = logging.getLogger(__name__)


def read_last

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key