Skip to main content

pycodex-ws

Browser conversations, a live HTML Canvas, read-only file/diff viewers and optional Feishu integration for python-codex. Requires Python 3.7+ and installs the matching core version.

For recent changes, see the 0.7.6 release notes.

Quick start

python3 -m pip install --upgrade pycodex-ws
pycodex-ws

Open http://127.0.0.1:6007 and click Create workspace (this creates and saves ./workspaces.json automatically). Model configuration is automatically inherited from ~/.codex/config.toml and ~/.codex/.env. Use python3 -m workspace_server if pycodex-ws is not on PATH.

Keep stdin open while the server runs; EOF initiates graceful shutdown. On Windows you can leave the console idle and press Ctrl+Z followed by Enter to send EOF, or close the stdin pipe if using a launcher.

To pre-configure workspaces or customize the bind address, create workspaces.json and pass --listen / --workspace-config:

{
  "workspaces": [
    {"id": "demo", "work_dir": ".", "state_path": "demo", "enable_board": true}
  ]
}
pycodex-ws --listen 127.0.0.1:6007 --workspace-config workspaces.json

Start the router with pycodex-router --password and enter the browser login password at the hidden prompt. With redirected stdin, the router reads one line. pycodex-router --password VALUE also accepts the password as a command-line argument.

With pycodex-ws --listen-to KEY@router:6000, the OS assigns a free local loopback port. The CLI prints the local URL and registers that port with the router. Add --listen 127.0.0.1:6007 to use a fixed port.

New devices appear as Unverified in the router directory. Sign in and choose Verify and unfold on the device group (or Verify in Online devices) to verify the device in place and enable workspace forwarding and peer access. The router remembers the full node ID across reconnects, workspace reloads and router restarts. Devices first seen before upgrading also need this one-time verification.

Conversations and views

The session sidebar starts collapsed. Hover to preview it, click to keep it open, and click the toggle or empty space again to close it. Expansion narrows the conversation while keeping the board fixed. On phones, use the header buttons to switch between chat and board.

Use the expanded sidebar to create, rename or close sessions. Click ×, then choose Close in the same row. Cancel or Escape dismisses the confirmation. The last session stays open. Status dots show running sessions and unread replies. /cd <directory> changes the current session's working directory while idle; /model, /resume, /compact and other core session commands are also available.

Use New session for the default profile, or its + button to choose one. When connected to a router (--listen-to), the chooser first selects a Node (This device or another verified online device on the same router) and then selects a Profile from that node. Choosing a peer node runs the Agent, tools, files, Canvas and rollout recording locally while proxying upstream provider HTTP requests through the router (/api/peer-proxy) using the selected peer node's profile; API keys and upstream endpoints stay on the peer node and reload on each request. Profiles reload when you open the chooser or create a session, so config changes apply to new sessions without restarting the server. Existing sessions keep their configuration.

Administrators can use Settings → Reload PyCodex and choose Reboot or Update & reboot to restart on updated code without restarting the process. Idle sessions close at once and running turns finish first (no new turns start meanwhile); background exec processes are terminated, clock periods resume, and sessions are restored from disk. Logins and share passwords are cleared; refresh the page afterwards. The endpoint POST api/reload accepts {"upgrade": true} or {"upgrade": "VERSION"}, which runs pip install --upgrade pycodex-ws with the server's Python first. The router connection (--listen-to) stays up.

Consecutive model reconnection diagnostics share one collapsed Model retries row per sequence. The summary shows the number of recorded retries, the latest attempt and its HTTP status when available. Expand it to read the original errors in a scrollable log. New retries update the same row and preserve its open state; refreshing starts collapsed. Other model diagnostics and final errors stay visible.

Click Markdown links to open files and comparisons, for example [source](app.py:42) or [changes](diff:HEAD:app.py). A Markdown link such as [source](file:///data/project/app.py#L42-L48) opens the workspace file at line 42. In a local Markdown preview, ![Screenshot](preview.png) displays the image beside the Markdown file. Clicking an .svg file opens the image. A link such as diagram.svg#L5 opens its source at line 5. Assistant replies can embed a local plot by absolute path, such as ![Plot](/data/results/plot.png). In a code or diff view, select text and choose Insert into chat to add editable context to the draft. Click a context block to edit or remove it before sending. See view links and supported formats.

With embedded VS Code enabled, clicking a file or diff link opens it in the current browser tab's workbench. You can open the same folder in several tabs and use each editor independently. Git comparisons display symbolic links as their target paths. VS Code handles large files using its own editor limits.

When using a router, its directory groups workspaces by device and lists unread workspaces at the top. Device handles reorder the list; pencil buttons edit device names.

When messaging another workspace Agent, set name to your username (by default, your session title), put the recipient's ID in session_id, and start prompt with the message itself. Plain messages steer active work at the next safe boundary. Use /queue for an independent task that should wait.

The workspace displays the author above the message and retains name in session history across resume. Omitting name uses the default "user" for ordinary input. See the message API contract.

Customize the interface

Choose Settings → Customize Agent from the conversation header to open a conversation and the optional feature catalog, with a Customize Agent banner at the top of the chat for reopening the catalog, switching to ?builtin=1, copying the frontend directory or opening WORKSPACE_API.md. Browse the feature descriptions, then send a feature name, ID or your own interface request in chat. The Agent starts with that message. Custom files live in the server user's ~/.pycodex/frontend/:

  • custom.css and custom.js: optional styles and an ES module, loaded automatically.
  • workspace.html: optional full-page override; otherwise the packaged page is used.
  • Other files: available at workspace-relative frontend/<path> URLs.

The frontend build embeds the page styles and JavaScript in the packaged workspace.html. Once the updated files are on the server, refresh the browser to load the new interface.

Refresh to apply changes and keep the selected conversation. Open the workspace with ?builtin=1 to bypass all customizations; click “Re-enable customizations” to return. Changes apply to all workspaces for that OS user. See the customization contract. For custom interfaces, the resource API exposes state, model catalogs, asynchronous command results, paginated history, event replay and sub-agent/background-work inventories. A mount(host) export in custom.js can access the built-in page's session, draft, banner (host.setBanner) and view controls, and host wrappers can embed <script type="application/json" data-pycodex-banner> banners.

Backend module ownership and the preserved session interfaces are documented in the runtime guide. File/Git source resolution and view storage retain their existing public classes; see content views.

The Agent adapts the selected feature's source into your frontend. To share a local change, ask it to publish a feature PR on GitHub; the contribution guide specifies the source, documentation, validation and PR format.

Share a workspace

Start the workspace server with an administrator password (--password), then choose Settings → Share in a workspace. Set a different share password and send the displayed workspace link and password to the recipient.

The existing login page accepts either the administrator password or the share password for the workspace being opened. Visitors can use all its conversations, Canvas, files, APIs and WebSocket connections, but cannot access workspace management, another workspace or sharing settings. The settings button and management navigation are hidden for visitors.

Passwords, verification values and visitor tokens are kept only in process memory. Changing the password or stopping sharing invalidates existing visitor logins and disconnects their WebSockets. Restarting the process clears all shares. Already accepted Agent work continues.

This restricts web access; Agent tools retain their existing file and execution permissions. An unprotected server must configure its administrator password before enabling sharing. Router authentication is unchanged: a link through a router still requires its normal login.

External Call

Open Settings → External Call, pick a profile and click Create session. The workspace selects the new conversation and pins an External Call banner at the top of the chat with Copy Bash, Copy PowerShell and expandable Details for the full commands and endpoint URL. Copy the command for your client machine and run it in a terminal.

Send the task from the Web conversation. External Call sessions inject contextual guidance distinguishing the host workspace machine (exec_command and other standard tools, <environment_context>, AGENTS.md, skills) from the connected client machine (client_exec_command). The terminal prints each command and its output, and returns the output and exit status to the conversation. The Bash and PowerShell commands are client examples over the session's b/<code> HTTP endpoint; custom scripts or executables (such as Python or cmd) can pull commands with GET and return results with POST or GET.

Each new session gets its own connection code. Closing its tab invalidates that code, releases pending requests and stops the terminal loop. After a server restart, create a new session to reconnect a terminal. Previous conversations retain their recorded history.

Storage

Paths in workspaces.json resolve from the configuration directory. state_path is a unique filename prefix: the example saves sessions in demo.pycodex-ws.json, file views in demo.pycodex-views.json, and Canvas in demo.html. Suffixes are appended to the complete prefix, including any dots. When creating a workspace from the browser without specifying a state prefix, it defaults to ~/.pycodex/workspaces/pcws-<id>.

Set enable_board to false to disable Canvas while retaining conversations and file views. Session directories and history survive server restarts; changing a session's directory does not move Canvas or workspace state files. Configuration and restoration details are in the runtime guide.

Feishu

Install the optional SDK in the workspace's Python environment, then authorize:

python3 -m pip install lark-oapi
python3 -m pycodex_ws.feishu_oauth

Authorization reads app credentials from ~/.codex/.env and stores the refresh token in ~/.codex/.feishu_refresh_token. In a workspace session, use /link <feishu-email|open_id|chat_id> to connect a card and /unlink to disconnect. Other workspace features work without the SDK.

The adapter separates card rendering, refresh-token storage and SDK connections. PycodexCard and PycodexRuntimeLink keep their existing imports and interfaces; see connection lifecycle and event presentation.

Development

From the repository root:

uv sync --dev
uv run pycodex-ws --help
uv run --dev pytest packages/pycodex-ws/tests
uv build packages/pycodex-ws

Python integrations construct a runtime through AgentsManager.create_root_runtime() and call pycodex_ws.register_feishu_commands(runtime) to include /link and /unlink. The context indicator shows tokens against the auto-compaction limit; its expandable Agent tree shows each task's status and latest assistant text. See runtime contracts and test documentation.

Metadata

Release files for pycodex-ws 0.7.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycodex-ws 0.7.6
File Size Uploaded Provenance Actions
pycodex_ws-0.7.6.tar.gz 2.3 MB With provenance Details for pycodex_ws-0.7.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pycodex-ws 0.7.6
File Interpreter ABI Platform Actions
pycodex_ws-0.7.6-py3-none-any.whl Python 3 none any Details for pycodex_ws-0.7.6-py3-none-any.whl

Total release size: 4.5 MB

Release files / pycodex_ws-0.7.6.tar.gz

Download URL pycodex_ws-0.7.6.tar.gz
Size 2.3 MB
Tags Source
SHA-256 checksum
How to use checksums
069dc4a24bbbdfeb81678c13b876c6036936ef48dce9cfacf50f4da544f18efa
BLAKE2b-256 checksum
How to use checksums
895119073542da47b17ecb555d7a098b797c352122c3064b6deef25ae0c0fcfd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / pycodex_ws-0.7.6-py3-none-any.whl

Download URL pycodex_ws-0.7.6-py3-none-any.whl
Size 2.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
60ca4be77a20301f9da15f957ed5a9ad4c1c58a5a0b8150776cbdb0569d94c04
BLAKE2b-256 checksum
How to use checksums
62c102732c7c7bf988ab75eb1e7582316af41d7d3a2b994e645ffe02b2713da8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for pycodex-ws 0.7.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pycodex_ws-0.7.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.7.6 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page