portacode 2.2.29.dev0__tar.gz → 2.2.30__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.
- portacode-2.2.30/.github/workflows/platform-smoke.yml +15 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/PKG-INFO +22 -2
- {portacode-2.2.29.dev0 → portacode-2.2.30}/README.md +21 -1
- portacode-2.2.30/build_android.sh +9 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/_version.py +2 -2
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/cli.py +7 -7
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/codex_prepare.py +5 -2
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/codex_app_server.py +14 -3
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/WEBSOCKET_PROTOCOL.md +30 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/__init__.py +1 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/automation_v2_handlers.py +27 -19
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/codex_handlers.py +108 -27
- portacode-2.2.30/portacode/connection/handlers/codex_history.py +100 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/file_handlers.py +17 -19
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/file_transfer_handlers.py +6 -1
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/runtime_user.py +9 -1
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/session.py +2 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/system_handlers.py +4 -1
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/terminal.py +2 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/restart.py +5 -1
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/service.py +53 -64
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tests/test_codex_handlers.py +64 -4
- portacode-2.2.30/portacode/tests/test_codex_history.py +67 -0
- portacode-2.2.30/portacode/tests/test_file_read_handler.py +27 -0
- portacode-2.2.30/portacode/tests/test_windows_compatibility.py +110 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tunneling/cloudflared_login.py +61 -1
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/updater.py +1 -1
- portacode-2.2.30/portacode/utils/executable.py +19 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/utils/runtime_paths.py +11 -1
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode.egg-info/PKG-INFO +22 -2
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode.egg-info/SOURCES.txt +6 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode.egg-info/scm_file_list.json +6 -0
- portacode-2.2.29.dev0/build_android.sh +0 -142
- {portacode-2.2.29.dev0 → portacode-2.2.30}/.gitignore +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/LICENSE +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/MANIFEST.in +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/Makefile +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/connect.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/connect.sh +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/docs/cloudflare-access.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/docs/cloudflared-domain-connect-containers-audit.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/docs/creative-team-brief-portacode.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/docs/device-health-alerting-plan.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/docs/devops-messaging-ab-tests.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/docs/domain-dns.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/docs/guest-host-requests-plan.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/docs/homepage-dashboard-positioning-fixes.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/docs/template-guide.html +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/README.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/simple_device/Dockerfile +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/simple_device/README.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/simple_device/docker-compose.yaml +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/Dockerfile +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/README.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/docker-compose.yaml +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/initial_content/README.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/initial_content/galactic_bakeshop/__init__.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/initial_content/galactic_bakeshop/asgi.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/initial_content/galactic_bakeshop/settings.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/initial_content/galactic_bakeshop/urls.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/initial_content/galactic_bakeshop/wsgi.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/initial_content/manage.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/initial_content/requirements.txt +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/initial_content/templates/treats/home.html +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/initial_content/treats/__init__.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/initial_content/treats/admin.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/initial_content/treats/apps.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/initial_content/treats/menu.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/initial_content/treats/migrations/__init__.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/initial_content/treats/models.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/initial_content/treats/tests.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/initial_content/treats/urls.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/initial_content/treats/views.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/examples/workshop_fleet/instructions/WELCOME.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/README.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/__init__.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/__main__.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/assets/skills/portacode-github/SKILL.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/assets/skills/portacode-github/agents/openai.yaml +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/assets/skills/portacode-github/scripts/create_repository.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/assets/skills/portacode-image/SKILL.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/assets/skills/portacode-image/agents/openai.yaml +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/browser_cli.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/browser_prepare.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/browser_runtime.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/codex_loopback_proxy.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/codex_usage_limit.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/README.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/__init__.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/client.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/guest_host_protocol.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/README.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/base.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/browser_handlers.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/chunked_content.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/cloudflare_forwarding.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/cloudflare_tunnel.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/diff_handlers.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/domain_dns.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/git_handlers.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/project_aware_file_handlers.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/project_state/README.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/project_state/__init__.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/project_state/file_system_watcher.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/project_state/git_manager.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/project_state/handlers.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/project_state/manager.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/project_state/models.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/project_state/test_handlers.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/project_state/test_sync.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/project_state/utils.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/project_state_handlers.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/proxmox_infra.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/registry.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/resumable_transfer_handlers.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/tab_factory.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/terminal_handlers.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/test_browser_handlers.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/test_cloudflare_access.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/test_cloudflare_forwarding.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/test_domain_dns.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/test_file_move_copy.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/test_git_handlers.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/test_proxmox_infra.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/test_runtime_user.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/update_handler.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/multiplex.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/test_guest_host_protocol.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/test_guest_host_terminal.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/test_webmin_proxy_config.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/webmin_proxy_config.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/data.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/dns_cli.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/exit_codes.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/github_credential.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/image_cli.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/keypair.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/link_capture/__init__.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/link_capture/bin/elinks +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/link_capture/bin/gio-open +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/link_capture/bin/gnome-open +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/link_capture/bin/gvfs-open +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/link_capture/bin/kde-open +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/link_capture/bin/kfmclient +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/link_capture/bin/link_capture_exec.sh +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/link_capture/bin/link_capture_wrapper.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/link_capture/bin/links +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/link_capture/bin/links2 +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/link_capture/bin/lynx +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/link_capture/bin/mate-open +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/link_capture/bin/netsurf +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/link_capture/bin/sensible-browser +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/link_capture/bin/w3m +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/link_capture/bin/x-www-browser +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/link_capture/bin/xdg-open +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/logging_categories.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/pairing.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/provisioning_cache.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/singleton.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/static/js/test-ntp-clock.html +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/static/js/utils/ntp-clock.js +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/test_runtime_paths.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/test_service.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/test_singleton.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/test_terminal_exposed_services.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tests/test_automation_v2_inputs.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tests/test_browser_cli.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tests/test_browser_prepare.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tests/test_cli_service_logs.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tests/test_codex_app_server.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tests/test_codex_loopback_proxy.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tests/test_codex_prepare.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tests/test_codex_prepare_cli.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tests/test_github_credential.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tests/test_image_cli.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tests/test_image_read_handler.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tests/test_resumable_transfer_handlers.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tests/test_system_handlers.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tests/test_terminal_periodic_system_info.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tests/test_terminal_session_shell.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tunneling/__init__.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tunneling/access.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tunneling/dns.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tunneling/ensure_cloudflared.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tunneling/ensure_pyyaml.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tunneling/forwarding_state.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tunneling/get_domain.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tunneling/privileged.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tunneling/service_install.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/tunneling/state.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/utils/NTP_ARCHITECTURE.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/utils/__init__.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/utils/diff_apply.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/utils/diff_renderer.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/utils/ntp_clock.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode.egg-info/dependency_links.txt +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode.egg-info/entry_points.txt +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode.egg-info/requires.txt +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/portacode.egg-info/top_level.txt +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/pyproject.toml +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/run_tests.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/scripts/diagnose_codex_gateway.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/setup.cfg +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/setup.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/test.sh +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/test_modules/README.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/test_modules/__init__.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/test_modules/test_device_online.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/test_modules/test_file_operations.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/test_modules/test_git_status_ui.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/test_modules/test_login_flow.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/test_modules/test_navigate_testing_folder.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/test_modules/test_play_store_screenshots.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/test_modules/test_terminal_buffer_performance.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/test_modules/test_terminal_interaction.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/test_modules/test_terminal_loading_race_condition.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/test_modules/test_terminal_start.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/test_request_id.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/test_session_terminal_shutdown.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/testing_framework/.env.example +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/testing_framework/README.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/testing_framework/__init__.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/testing_framework/cli.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/testing_framework/core/__init__.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/testing_framework/core/base_test.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/testing_framework/core/cli_manager.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/testing_framework/core/hierarchical_runner.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/testing_framework/core/playwright_manager.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/testing_framework/core/runner.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/testing_framework/core/shared_cli_manager.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/testing_framework/core/test_discovery.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/testing_framework/requirements.txt +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/todo/UI_UX/opening_a_file_on_desktop_results_in_nothing.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/todo/UI_UX/server_occasionally_stops_communicating_with_all_devices.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/todo/agent_context_management.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/todo/django_server_time_sync.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/todo/issues/device_performance_degradation.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/todo/issues/git_data_not_captured_in_proxmox.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/todo/issues/indefinite_resource_loading.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/todo/issues/portacode_service_silently_down.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/todo/issues/premature_terminal_exit.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/todo/issues/project_cpu_hotspots.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/todo/issues/terminals_exit_upon_starting.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/todo/issues/websocket_client_silently_dead.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/todo/issues/wrong_item_classification_on_client_side.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/todo/smartphone_terminal_input_frustrations.md +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/tools/generate_play_store_assets.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/tools/pairing_tester.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/tools/run_screenshot_suite.sh +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/tools/test_python_ntp_clock.py +0 -0
- {portacode-2.2.29.dev0 → portacode-2.2.30}/validate.sh +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
name: Platform startup and history
|
|
2
|
+
on: [push, pull_request]
|
|
3
|
+
jobs:
|
|
4
|
+
smoke:
|
|
5
|
+
strategy:
|
|
6
|
+
matrix:
|
|
7
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
8
|
+
runs-on: ${{ matrix.os }}
|
|
9
|
+
steps:
|
|
10
|
+
- uses: actions/checkout@v4
|
|
11
|
+
- uses: actions/setup-python@v5
|
|
12
|
+
with:
|
|
13
|
+
python-version: '3.12'
|
|
14
|
+
- run: python -m pip install -e . pytest pytest-asyncio
|
|
15
|
+
- run: python -m pytest -q portacode/tests/test_windows_compatibility.py portacode/tests/test_codex_history.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: portacode
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.30
|
|
4
4
|
Summary: Device agent for the AI platform that builds, tests, deploys, and operates real software
|
|
5
5
|
Home-page: https://portacode.com/
|
|
6
6
|
Author: Meena Erian
|
|
@@ -116,7 +116,7 @@ The rest of this README documents the optional device agent for bringing an exis
|
|
|
116
116
|
|
|
117
117
|
Portacode's Python package is the device-side CLI and agent. It connects an existing Linux/Python-capable machine to your Portacode account so the web workspace can work with its projects and developer tools.
|
|
118
118
|
|
|
119
|
-
### Recommended Linux setup
|
|
119
|
+
### Recommended Linux and macOS setup
|
|
120
120
|
|
|
121
121
|
1. Sign in to [Portacode](https://portacode.com/) and select **Pair Device**.
|
|
122
122
|
2. Run the activation command shown there on the target machine. It installs Portacode in a dedicated virtual environment, pairs the device, and configures its persistent service.
|
|
@@ -131,6 +131,26 @@ curl -fsSL https://portacode.com/static/activate_portacode.sh \
|
|
|
131
131
|
|
|
132
132
|
Review the downloaded script before running it if that is required by your environment. See the [pairing guide](https://portacode.com/docs/pair-device/) for supported distributions, a fully manual installation, and Proxmox-specific setup.
|
|
133
133
|
|
|
134
|
+
On macOS, run this command in Terminal. Setup uses an existing Python or
|
|
135
|
+
Homebrew, and installs a per-user launchd login agent. If neither Python nor
|
|
136
|
+
Homebrew is available, it explains how to install Python before retrying.
|
|
137
|
+
|
|
138
|
+
### Windows setup
|
|
139
|
+
|
|
140
|
+
Select Windows in the dashboard pairing dialog and run its command in
|
|
141
|
+
PowerShell, using the current pairing code:
|
|
142
|
+
|
|
143
|
+
```powershell
|
|
144
|
+
& ([scriptblock]::Create((Invoke-RestMethod 'https://portacode.com/static/activate_portacode.ps1'))) -PairingCode 'YOUR_CODE'
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Setup installs Python with winget if needed, creates a virtual environment in
|
|
148
|
+
`%LOCALAPPDATA%\Portacode\venv`, pairs the device, and creates a Task Scheduler
|
|
149
|
+
task for your current account. The connection runs while you are signed in and
|
|
150
|
+
starts again at login. No administrator shell or execution-policy change is
|
|
151
|
+
required for the per-user task. Review the script and use your organization's
|
|
152
|
+
software-installation policy where applicable.
|
|
153
|
+
|
|
134
154
|
### Manual CLI setup
|
|
135
155
|
|
|
136
156
|
If you already have a suitable Python environment:
|
|
@@ -46,7 +46,7 @@ The rest of this README documents the optional device agent for bringing an exis
|
|
|
46
46
|
|
|
47
47
|
Portacode's Python package is the device-side CLI and agent. It connects an existing Linux/Python-capable machine to your Portacode account so the web workspace can work with its projects and developer tools.
|
|
48
48
|
|
|
49
|
-
### Recommended Linux setup
|
|
49
|
+
### Recommended Linux and macOS setup
|
|
50
50
|
|
|
51
51
|
1. Sign in to [Portacode](https://portacode.com/) and select **Pair Device**.
|
|
52
52
|
2. Run the activation command shown there on the target machine. It installs Portacode in a dedicated virtual environment, pairs the device, and configures its persistent service.
|
|
@@ -61,6 +61,26 @@ curl -fsSL https://portacode.com/static/activate_portacode.sh \
|
|
|
61
61
|
|
|
62
62
|
Review the downloaded script before running it if that is required by your environment. See the [pairing guide](https://portacode.com/docs/pair-device/) for supported distributions, a fully manual installation, and Proxmox-specific setup.
|
|
63
63
|
|
|
64
|
+
On macOS, run this command in Terminal. Setup uses an existing Python or
|
|
65
|
+
Homebrew, and installs a per-user launchd login agent. If neither Python nor
|
|
66
|
+
Homebrew is available, it explains how to install Python before retrying.
|
|
67
|
+
|
|
68
|
+
### Windows setup
|
|
69
|
+
|
|
70
|
+
Select Windows in the dashboard pairing dialog and run its command in
|
|
71
|
+
PowerShell, using the current pairing code:
|
|
72
|
+
|
|
73
|
+
```powershell
|
|
74
|
+
& ([scriptblock]::Create((Invoke-RestMethod 'https://portacode.com/static/activate_portacode.ps1'))) -PairingCode 'YOUR_CODE'
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Setup installs Python with winget if needed, creates a virtual environment in
|
|
78
|
+
`%LOCALAPPDATA%\Portacode\venv`, pairs the device, and creates a Task Scheduler
|
|
79
|
+
task for your current account. The connection runs while you are signed in and
|
|
80
|
+
starts again at login. No administrator shell or execution-policy change is
|
|
81
|
+
required for the per-user task. Review the script and use your organization's
|
|
82
|
+
software-installation policy where applicable.
|
|
83
|
+
|
|
64
84
|
### Manual CLI setup
|
|
65
85
|
|
|
66
86
|
If you already have a suitable Python environment:
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
4
|
+
BUILDER="$ROOT_DIR/server/portacode_django/mobile/build_android.py"
|
|
5
|
+
if [[ ! -f "$BUILDER" ]]; then
|
|
6
|
+
echo "error: Android builder requires the authorized private server submodule." >&2
|
|
7
|
+
exit 1
|
|
8
|
+
fi
|
|
9
|
+
exec python3 "$BUILDER" "$@"
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '2.2.
|
|
22
|
-
__version_tuple__ = version_tuple = (2, 2,
|
|
21
|
+
__version__ = version = '2.2.30'
|
|
22
|
+
__version_tuple__ = version_tuple = (2, 2, 30)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -770,9 +770,9 @@ def service_install() -> None: # noqa: D401
|
|
|
770
770
|
|
|
771
771
|
mgr = get_manager(system_mode=True)
|
|
772
772
|
is_macos = sys.platform == "darwin"
|
|
773
|
-
service_kind = "login agent" if is_macos else "system service"
|
|
773
|
+
service_kind = "login task" if sys.platform == "win32" else "login agent" if is_macos else "system service"
|
|
774
774
|
click.echo(f"Installing Portacode {service_kind}…")
|
|
775
|
-
if
|
|
775
|
+
if sys.platform.startswith("linux") and os.geteuid() != 0:
|
|
776
776
|
click.echo(click.style("[sudo] You may be prompted for your password to install the system service.", fg="yellow"))
|
|
777
777
|
click.echo(click.style("💡 For persistent connection, install system-wide: sudo pip install portacode --system", fg="bright_black"))
|
|
778
778
|
try:
|
|
@@ -976,10 +976,10 @@ def restart_command(method: str, verbose: bool) -> None:
|
|
|
976
976
|
"""Restart the installed Portacode system service."""
|
|
977
977
|
method = method.lower()
|
|
978
978
|
try:
|
|
979
|
-
from .restart import request_restart,
|
|
979
|
+
from .restart import request_restart, running_under_supervisor
|
|
980
980
|
from .service import get_manager
|
|
981
981
|
|
|
982
|
-
in_service =
|
|
982
|
+
in_service = running_under_supervisor() and not (sys.stdin.isatty() or sys.stdout.isatty())
|
|
983
983
|
click.echo("Restarting Portacode service…")
|
|
984
984
|
request_restart(method=method, in_service=in_service)
|
|
985
985
|
st = get_manager(system_mode=True).status()
|
|
@@ -1012,7 +1012,7 @@ def set_version_command(version: str) -> None:
|
|
|
1012
1012
|
display_version = "latest" if resolved_version is None else resolved_version
|
|
1013
1013
|
click.echo(f"Installing Portacode {display_version}…")
|
|
1014
1014
|
interactive_tty = sys.stdin.isatty() and sys.stdout.isatty()
|
|
1015
|
-
if interactive_tty and os.geteuid() != 0:
|
|
1015
|
+
if interactive_tty and os.name != "nt" and os.geteuid() != 0:
|
|
1016
1016
|
click.echo(
|
|
1017
1017
|
click.style(
|
|
1018
1018
|
"[sudo] If required, Portacode will attempt passwordless sudo first and then prompt for your password.",
|
|
@@ -1030,8 +1030,8 @@ def set_version_command(version: str) -> None:
|
|
|
1030
1030
|
f"Failed to install Portacode {display_version}: {error_msg}"
|
|
1031
1031
|
)
|
|
1032
1032
|
click.echo(click.style(f"✔ Portacode {display_version} installed", fg="green"))
|
|
1033
|
-
from .restart import request_restart,
|
|
1033
|
+
from .restart import request_restart, running_under_supervisor
|
|
1034
1034
|
|
|
1035
|
-
in_service =
|
|
1035
|
+
in_service = running_under_supervisor() and not (sys.stdin.isatty() or sys.stdout.isatty())
|
|
1036
1036
|
click.echo("Restarting Portacode service…")
|
|
1037
1037
|
request_restart(method="auto", in_service=in_service)
|
|
@@ -58,7 +58,9 @@ def _run(command: Iterable[str], *, ok_returncodes: tuple[int, ...] = (0,)) -> N
|
|
|
58
58
|
PyYAML, Proxmox infra): ``apt-get update`` often exits 100 on Proxmox hosts
|
|
59
59
|
without an enterprise subscription even when Debian mirrors are fine.
|
|
60
60
|
"""
|
|
61
|
-
|
|
61
|
+
from .utils.executable import executable_argv
|
|
62
|
+
command = list(command)
|
|
63
|
+
result = subprocess.run(executable_argv(*command), text=True, capture_output=True)
|
|
62
64
|
if result.returncode not in ok_returncodes:
|
|
63
65
|
output = "\n".join(part for part in (result.stdout, result.stderr) if part).strip()
|
|
64
66
|
detail = f"\n{output[-4000:]}" if output else ""
|
|
@@ -137,7 +139,8 @@ def _codex_path() -> str | None:
|
|
|
137
139
|
|
|
138
140
|
|
|
139
141
|
def _codex_works(path: str) -> bool:
|
|
140
|
-
|
|
142
|
+
from .utils.executable import executable_argv
|
|
143
|
+
result = subprocess.run(executable_argv(path, "--version"), text=True, capture_output=True)
|
|
141
144
|
return result.returncode == 0
|
|
142
145
|
|
|
143
146
|
|
|
@@ -11,6 +11,7 @@ import sys
|
|
|
11
11
|
import uuid
|
|
12
12
|
from pathlib import Path
|
|
13
13
|
from typing import Any, Awaitable, Callable, Dict, List, Optional
|
|
14
|
+
from portacode.utils.executable import executable_argv
|
|
14
15
|
|
|
15
16
|
LOGGER = logging.getLogger(__name__)
|
|
16
17
|
|
|
@@ -26,6 +27,11 @@ CODEX_STDIO_MESSAGE_LIMIT = 32 * 1024 * 1024
|
|
|
26
27
|
class CodexAppServerError(RuntimeError):
|
|
27
28
|
"""Raised when the Codex app-server cannot be started or is unhealthy."""
|
|
28
29
|
|
|
30
|
+
def __init__(self, message: str, *, code=None, data=None):
|
|
31
|
+
super().__init__(message)
|
|
32
|
+
self.code = code
|
|
33
|
+
self.data = data
|
|
34
|
+
|
|
29
35
|
|
|
30
36
|
class CodexAppServer:
|
|
31
37
|
"""Thin asyncio JSON-RPC 2.0 client for `codex app-server --listen stdio://`.
|
|
@@ -134,7 +140,7 @@ class CodexAppServer:
|
|
|
134
140
|
"no_proxy",
|
|
135
141
|
]
|
|
136
142
|
spawn_cmd = wrap_argv_for_user(
|
|
137
|
-
|
|
143
|
+
executable_argv(exe, *self.command[1:]),
|
|
138
144
|
runtime_user,
|
|
139
145
|
preserve_env_names=preserve,
|
|
140
146
|
login=False,
|
|
@@ -432,7 +438,8 @@ class CodexAppServer:
|
|
|
432
438
|
if "error" in response:
|
|
433
439
|
error = response["error"]
|
|
434
440
|
raise CodexAppServerError(
|
|
435
|
-
f"codex app-server error ({method}): {error.get('message', error)}"
|
|
441
|
+
f"codex app-server error ({method}): {error.get('message', error)}",
|
|
442
|
+
code=error.get("code"), data=error.get("data"),
|
|
436
443
|
)
|
|
437
444
|
return response.get("result", {})
|
|
438
445
|
|
|
@@ -481,6 +488,10 @@ class CodexAppServer:
|
|
|
481
488
|
home / ".local" / "bin" / command,
|
|
482
489
|
home / ".npm" / "bin" / command,
|
|
483
490
|
]
|
|
491
|
+
if sys.platform == "win32":
|
|
492
|
+
appdata = os.environ.get("APPDATA")
|
|
493
|
+
if appdata:
|
|
494
|
+
candidates.extend([Path(appdata) / "npm" / "codex.exe", Path(appdata) / "npm" / "codex.cmd"])
|
|
484
495
|
# launchd gives LaunchAgents a deliberately small default PATH that
|
|
485
496
|
# excludes Homebrew. A prepared Codex cask therefore exists and runs
|
|
486
497
|
# from Terminal.app while system_info incorrectly reports it missing.
|
|
@@ -519,7 +530,7 @@ class CodexAppServer:
|
|
|
519
530
|
env = dict(os.environ)
|
|
520
531
|
CodexAppServer._prepend_executable_directory(env, exe)
|
|
521
532
|
result = subprocess.run(
|
|
522
|
-
|
|
533
|
+
executable_argv(exe, "--version"), capture_output=True, text=True, timeout=10, env=env
|
|
523
534
|
)
|
|
524
535
|
return result.stdout.strip() or None
|
|
525
536
|
except Exception:
|
{portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/WEBSOCKET_PROTOCOL.md
RENAMED
|
@@ -2339,3 +2339,33 @@ Sent by the server to clients to provide initial device list snapshot.
|
|
|
2339
2339
|
**Event Fields:**
|
|
2340
2340
|
|
|
2341
2341
|
* `devices` (array, mandatory): Array of device objects with status information
|
|
2342
|
+
|
|
2343
|
+
## Codex IDE history pagination
|
|
2344
|
+
|
|
2345
|
+
`codex_status.features` advertises `history_pagination` and `read_only_history`.
|
|
2346
|
+
`codex_thread_resume` accepts `threadId`, `cwd`, `request_id`, and optional
|
|
2347
|
+
`readOnly: true` (read history without resuming/editing the thread). Its
|
|
2348
|
+
`codex_thread_resumed` event includes the latest small page, plus:
|
|
2349
|
+
|
|
2350
|
+
- `history`: `hasMore`, opaque `nextCursor`, `truncated`, and `complete`.
|
|
2351
|
+
`complete: true` means the beginning of the available history was reached.
|
|
2352
|
+
`liveIncomplete: true` means the bounded live snapshot omitted output; reload
|
|
2353
|
+
durable history after turn completion before claiming the full history.
|
|
2354
|
+
- `historyOrder`: item IDs in chronological order for this page.
|
|
2355
|
+
- `historyFragments`: oversized items' exact ASCII JSON in fragments containing
|
|
2356
|
+
`id`, character `offset`, `total`, `json`, and a lightweight `preview`.
|
|
2357
|
+
Reassemble by offset, parse only when complete, and replace the preview by ID.
|
|
2358
|
+
|
|
2359
|
+
Send `codex_thread_history` with the same thread/project/browser session and
|
|
2360
|
+
the returned `cursor` to request older items. The response event has the same
|
|
2361
|
+
name and page fields. Prepend without duplicating IDs or moving the user's
|
|
2362
|
+
visible reading position. Pages target 128 KiB before routing metadata and
|
|
2363
|
+
initial reads request eight turns. Even single oversized items are fragmented.
|
|
2364
|
+
|
|
2365
|
+
Cursors expire after 15 minutes and are held in a bounded device cache. An
|
|
2366
|
+
expired/evicted or mismatched cursor returns an explicit error; reopen the
|
|
2367
|
+
thread rather than claiming its history has ended. Errors preserve
|
|
2368
|
+
`request_id`; resume conflicts return `errorCode: thread_in_use` when identified.
|
|
2369
|
+
Offer retry, read-only viewing where supported, and a new chat; never terminate
|
|
2370
|
+
another Codex session automatically. Older CLIs without these capabilities
|
|
2371
|
+
cannot promise complete paginated history and should show an update hint.
|
{portacode-2.2.29.dev0 → portacode-2.2.30}/portacode/connection/handlers/automation_v2_handlers.py
RENAMED
|
@@ -19,7 +19,10 @@ import mimetypes
|
|
|
19
19
|
import json
|
|
20
20
|
import logging
|
|
21
21
|
import os
|
|
22
|
-
|
|
22
|
+
try:
|
|
23
|
+
import pwd
|
|
24
|
+
except ImportError:
|
|
25
|
+
pwd = None
|
|
23
26
|
import re
|
|
24
27
|
import shutil
|
|
25
28
|
import ssl
|
|
@@ -38,7 +41,7 @@ logger = logging.getLogger(__name__)
|
|
|
38
41
|
DEFAULT_STEP_TIMEOUT_SECONDS = 7200.0
|
|
39
42
|
MAX_STDIO_CHARS = 8000
|
|
40
43
|
OUTPUT_FLUSH_INTERVAL_S = 1.0
|
|
41
|
-
STATE_FILE_PATH = Path("
|
|
44
|
+
STATE_FILE_PATH = Path(tempfile.gettempdir()) / "portacode_automation_v2_state.json"
|
|
42
45
|
SYSTEM_ENV_PATH = Path("/etc/environment")
|
|
43
46
|
EXPOSED_SERVICES_FILE_PATH = Path("/etc/portacode/exposed_services.json")
|
|
44
47
|
EXPOSED_SERVICES_ENV_KEY = "PORTACODE_EXPOSED_SERVICES_JSON"
|
|
@@ -46,7 +49,7 @@ WAIT_FOR_PLACEHOLDER_RE = re.compile(r"\[exposed:(\d{1,5})\]", flags=re.IGNORECA
|
|
|
46
49
|
WAIT_FOR_STEP_INTERVAL_SECONDS = 3.0
|
|
47
50
|
WAIT_FOR_REQUEST_TIMEOUT_SECONDS = 5.0
|
|
48
51
|
WAIT_FOR_DEFAULT_TIMEOUT_SECONDS = 600.0
|
|
49
|
-
RUNTIME_INPUT_ROOT = Path("
|
|
52
|
+
RUNTIME_INPUT_ROOT = Path(tempfile.gettempdir()) / "portacode-template-inputs"
|
|
50
53
|
MAX_RUNTIME_INPUT_FILE_BYTES = 25 * 1024 * 1024
|
|
51
54
|
MIME_EXTENSIONS = {
|
|
52
55
|
"image/jpeg": ".jpg", "image/png": ".png", "image/gif": ".gif",
|
|
@@ -76,12 +79,12 @@ def _direct_destination(definition: dict[str, Any], input_id: str, source_name:
|
|
|
76
79
|
raw_destination = str(definition.get("destination") or "").strip()
|
|
77
80
|
if not raw_destination:
|
|
78
81
|
return None
|
|
79
|
-
if "\x00" in raw_destination or not raw_destination.
|
|
82
|
+
if "\x00" in raw_destination or not Path(raw_destination).is_absolute():
|
|
80
83
|
raise ValueError(f"file input '{input_id}' destination must be absolute")
|
|
81
84
|
if any(part == ".." for part in Path(raw_destination).parts):
|
|
82
85
|
raise ValueError(f"file input '{input_id}' destination cannot contain '..'")
|
|
83
86
|
try:
|
|
84
|
-
home = Path(pwd.getpwnam(owner_user).pw_dir) if owner_user else Path.home()
|
|
87
|
+
home = Path(pwd.getpwnam(owner_user).pw_dir) if owner_user and pwd else Path.home()
|
|
85
88
|
except KeyError:
|
|
86
89
|
home = Path.home()
|
|
87
90
|
destination = Path(raw_destination)
|
|
@@ -89,11 +92,12 @@ def _direct_destination(definition: dict[str, Any], input_id: str, source_name:
|
|
|
89
92
|
destination.relative_to(home)
|
|
90
93
|
allowed_root = home
|
|
91
94
|
except ValueError:
|
|
95
|
+
temp_root = Path(tempfile.gettempdir()) if os.name == "nt" else Path("/tmp")
|
|
92
96
|
try:
|
|
93
|
-
destination.relative_to(
|
|
94
|
-
allowed_root =
|
|
97
|
+
destination.relative_to(temp_root)
|
|
98
|
+
allowed_root = temp_root
|
|
95
99
|
except ValueError as exc:
|
|
96
|
-
raise ValueError(f"file input '{input_id}' destination must be under the runtime user's home or
|
|
100
|
+
raise ValueError(f"file input '{input_id}' destination must be under the runtime user's home or {temp_root}") from exc
|
|
97
101
|
try:
|
|
98
102
|
destination.parent.resolve(strict=True).relative_to(allowed_root.resolve(strict=True))
|
|
99
103
|
except (FileNotFoundError, ValueError) as exc:
|
|
@@ -104,7 +108,7 @@ def _direct_destination(definition: dict[str, Any], input_id: str, source_name:
|
|
|
104
108
|
suffix = MIME_EXTENSIONS.get(mime, mimetypes.guess_extension(mime) or "")
|
|
105
109
|
elif extension not in {"", "preserve"}:
|
|
106
110
|
suffix = "." + extension.lstrip(".")
|
|
107
|
-
if raw_destination.endswith(
|
|
111
|
+
if raw_destination.endswith(tuple(separator for separator in (os.sep, os.altsep) if separator)):
|
|
108
112
|
destination = destination / Path(source_name).name
|
|
109
113
|
if suffix:
|
|
110
114
|
destination = destination.with_suffix(suffix)
|
|
@@ -160,11 +164,7 @@ def _materialize_runtime_file(
|
|
|
160
164
|
os.chmod(temp_path, 0o600)
|
|
161
165
|
if owner_user:
|
|
162
166
|
chown_path_if_possible(temp_path, owner_user)
|
|
163
|
-
|
|
164
|
-
owner_uid = pwd.getpwnam(owner_user).pw_uid if owner_user else os.geteuid()
|
|
165
|
-
except KeyError:
|
|
166
|
-
owner_uid = os.geteuid()
|
|
167
|
-
if os.stat(temp_path).st_uid != owner_uid:
|
|
167
|
+
if not _owned_by_runtime_user(temp_path, owner_user):
|
|
168
168
|
temp_path.unlink(missing_ok=True)
|
|
169
169
|
raise ValueError(f"file input '{input_id}' could not be assigned to the runtime user")
|
|
170
170
|
temp_path.replace(direct_destination)
|
|
@@ -183,16 +183,24 @@ def _materialize_runtime_file(
|
|
|
183
183
|
os.chmod(destination, 0o600)
|
|
184
184
|
if owner_user:
|
|
185
185
|
chown_path_if_possible(destination, owner_user)
|
|
186
|
-
|
|
187
|
-
owner_uid = pwd.getpwnam(owner_user).pw_uid if owner_user else os.geteuid()
|
|
188
|
-
except KeyError:
|
|
189
|
-
owner_uid = os.geteuid()
|
|
190
|
-
if os.stat(directory).st_uid != owner_uid or os.stat(destination).st_uid != owner_uid:
|
|
186
|
+
if not all(_owned_by_runtime_user(path, owner_user) for path in (directory, destination)):
|
|
191
187
|
destination.unlink(missing_ok=True)
|
|
192
188
|
raise ValueError(f"file input '{input_id}' could not be assigned to the runtime user")
|
|
193
189
|
return str(destination)
|
|
194
190
|
|
|
195
191
|
|
|
192
|
+
def _owned_by_runtime_user(path: Path, owner_user: str) -> bool:
|
|
193
|
+
if pwd is None:
|
|
194
|
+
# Windows files inherit the current user's directory ACLs; POSIX uid
|
|
195
|
+
# ownership is unavailable and must not be inferred from st_uid=0.
|
|
196
|
+
return True
|
|
197
|
+
try:
|
|
198
|
+
uid = pwd.getpwnam(owner_user).pw_uid if owner_user else os.geteuid()
|
|
199
|
+
except KeyError:
|
|
200
|
+
uid = os.geteuid()
|
|
201
|
+
return path.stat().st_uid == uid
|
|
202
|
+
|
|
203
|
+
|
|
196
204
|
def _normalize_runtime_inputs(
|
|
197
205
|
raw_inputs: Any, *, task_id: str = "task", owner_user: str = ""
|
|
198
206
|
) -> dict[str, dict[str, Any]]:
|