Skip to main content

PAI PM - API Specification

Version: v1.0.0 | Status: Active | Last Updated: March 2026

1. Overview​

The pai_pm module wraps the PAI Project Manager Bun/TypeScript server as a Python module with MCP tools. Provides lifecycle management for the PM server and Python client bindings.

2. Prerequisites​

  • Bun runtime: https://bun.sh
  • Install: cd src/codomyrmex/pai_pm/server && bun install

3. Core Components​

3.1 Classes​

ClassDescription
PaiPmServerManagerLifecycle manager (start, stop, health check) for the Bun PM server
PaiPmConfigConfiguration dataclass (host, port, timeout)

3.2 Functions​

FunctionSignatureDescription
get_config() -> PaiPmConfigLoad/return the current PM configuration
get_bun_version() -> strReturn installed Bun version string

3.3 Exceptions​

ExceptionDescription
PaiPmErrorBase exception
PaiPmNotInstalledErrorBun runtime not found
PaiPmConnectionErrorCannot connect to PM server
PaiPmServerErrorServer returned an error
PaiPmTimeoutErrorServer operation timed out

3.4 Constants​

NameTypeDescription
HAS_BUNboolTrue when bun binary is available in PATH

4. Usage Example​

from codomyrmex.pai_pm import PaiPmServerManager, get_config, HAS_BUN

if HAS_BUN:
config = get_config()
manager = PaiPmServerManager(config)
manager.start()
# Server running on config.host:config.port

5. Navigation​