Remove shell-escaped file mutation from the stable workspace flow by adding explicit file and patch tools across the CLI, SDK, and MCP surfaces. This adds workspace file list/read/write plus unified text patch application, backed by new guest and manager file primitives that stay scoped to started workspaces and /workspace only. Patch application is preflighted on the host, file writes stay text-only and bounded, and the existing diff/export/reset semantics remain intact. The milestone also updates the 3.2.0 roadmap, public contract, docs, examples, and versioning, and includes focused coverage for the new helper module and dispatch paths. Validation: - uv lock - UV_CACHE_DIR=.uv-cache make check - UV_CACHE_DIR=.uv-cache make dist-check - real guest-backed smoke for workspace file read, patch apply, exec, export, and delete
190 lines
5.2 KiB
Python
190 lines
5.2 KiB
Python
"""Public contract constants for the CLI, SDK, and MCP server."""
|
|
|
|
from __future__ import annotations
|
|
|
|
PUBLIC_CLI_COMMANDS = ("demo", "doctor", "env", "mcp", "run", "workspace")
|
|
PUBLIC_CLI_DEMO_SUBCOMMANDS = ("ollama",)
|
|
PUBLIC_CLI_ENV_SUBCOMMANDS = ("inspect", "list", "pull", "prune")
|
|
PUBLIC_CLI_WORKSPACE_SUBCOMMANDS = (
|
|
"create",
|
|
"delete",
|
|
"disk",
|
|
"diff",
|
|
"exec",
|
|
"export",
|
|
"file",
|
|
"logs",
|
|
"patch",
|
|
"reset",
|
|
"service",
|
|
"shell",
|
|
"snapshot",
|
|
"start",
|
|
"status",
|
|
"stop",
|
|
"sync",
|
|
)
|
|
PUBLIC_CLI_WORKSPACE_DISK_SUBCOMMANDS = ("export", "list", "read")
|
|
PUBLIC_CLI_WORKSPACE_FILE_SUBCOMMANDS = ("list", "read", "write")
|
|
PUBLIC_CLI_WORKSPACE_PATCH_SUBCOMMANDS = ("apply",)
|
|
PUBLIC_CLI_WORKSPACE_SERVICE_SUBCOMMANDS = ("list", "logs", "start", "status", "stop")
|
|
PUBLIC_CLI_WORKSPACE_SHELL_SUBCOMMANDS = ("close", "open", "read", "signal", "write")
|
|
PUBLIC_CLI_WORKSPACE_SNAPSHOT_SUBCOMMANDS = ("create", "delete", "list")
|
|
PUBLIC_CLI_WORKSPACE_SYNC_SUBCOMMANDS = ("push",)
|
|
PUBLIC_CLI_WORKSPACE_CREATE_FLAGS = (
|
|
"--vcpu-count",
|
|
"--mem-mib",
|
|
"--ttl-seconds",
|
|
"--network-policy",
|
|
"--allow-host-compat",
|
|
"--seed-path",
|
|
"--secret",
|
|
"--secret-file",
|
|
"--json",
|
|
)
|
|
PUBLIC_CLI_WORKSPACE_DISK_EXPORT_FLAGS = ("--output", "--json")
|
|
PUBLIC_CLI_WORKSPACE_DISK_LIST_FLAGS = ("--recursive", "--json")
|
|
PUBLIC_CLI_WORKSPACE_DISK_READ_FLAGS = ("--max-bytes", "--json")
|
|
PUBLIC_CLI_WORKSPACE_EXEC_FLAGS = ("--timeout-seconds", "--secret-env", "--json")
|
|
PUBLIC_CLI_WORKSPACE_DIFF_FLAGS = ("--json",)
|
|
PUBLIC_CLI_WORKSPACE_EXPORT_FLAGS = ("--output", "--json")
|
|
PUBLIC_CLI_WORKSPACE_FILE_LIST_FLAGS = ("--recursive", "--json")
|
|
PUBLIC_CLI_WORKSPACE_FILE_READ_FLAGS = ("--max-bytes", "--json")
|
|
PUBLIC_CLI_WORKSPACE_FILE_WRITE_FLAGS = ("--text", "--json")
|
|
PUBLIC_CLI_WORKSPACE_PATCH_APPLY_FLAGS = ("--patch", "--json")
|
|
PUBLIC_CLI_WORKSPACE_RESET_FLAGS = ("--snapshot", "--json")
|
|
PUBLIC_CLI_WORKSPACE_SERVICE_LIST_FLAGS = ("--json",)
|
|
PUBLIC_CLI_WORKSPACE_SERVICE_LOGS_FLAGS = ("--tail-lines", "--all", "--json")
|
|
PUBLIC_CLI_WORKSPACE_SERVICE_START_FLAGS = (
|
|
"--cwd",
|
|
"--ready-file",
|
|
"--ready-tcp",
|
|
"--ready-http",
|
|
"--ready-command",
|
|
"--ready-timeout-seconds",
|
|
"--ready-interval-ms",
|
|
"--secret-env",
|
|
"--publish",
|
|
"--json",
|
|
)
|
|
PUBLIC_CLI_WORKSPACE_SERVICE_STATUS_FLAGS = ("--json",)
|
|
PUBLIC_CLI_WORKSPACE_SERVICE_STOP_FLAGS = ("--json",)
|
|
PUBLIC_CLI_WORKSPACE_SHELL_OPEN_FLAGS = (
|
|
"--cwd",
|
|
"--cols",
|
|
"--rows",
|
|
"--secret-env",
|
|
"--json",
|
|
)
|
|
PUBLIC_CLI_WORKSPACE_SHELL_READ_FLAGS = ("--cursor", "--max-chars", "--json")
|
|
PUBLIC_CLI_WORKSPACE_SHELL_WRITE_FLAGS = ("--input", "--no-newline", "--json")
|
|
PUBLIC_CLI_WORKSPACE_SHELL_SIGNAL_FLAGS = ("--signal", "--json")
|
|
PUBLIC_CLI_WORKSPACE_SHELL_CLOSE_FLAGS = ("--json",)
|
|
PUBLIC_CLI_WORKSPACE_SNAPSHOT_CREATE_FLAGS = ("--json",)
|
|
PUBLIC_CLI_WORKSPACE_SNAPSHOT_DELETE_FLAGS = ("--json",)
|
|
PUBLIC_CLI_WORKSPACE_SNAPSHOT_LIST_FLAGS = ("--json",)
|
|
PUBLIC_CLI_WORKSPACE_START_FLAGS = ("--json",)
|
|
PUBLIC_CLI_WORKSPACE_STATUS_FLAGS = ("--json",)
|
|
PUBLIC_CLI_WORKSPACE_STOP_FLAGS = ("--json",)
|
|
PUBLIC_CLI_WORKSPACE_SYNC_PUSH_FLAGS = ("--dest", "--json")
|
|
PUBLIC_CLI_RUN_FLAGS = (
|
|
"--vcpu-count",
|
|
"--mem-mib",
|
|
"--timeout-seconds",
|
|
"--ttl-seconds",
|
|
"--network",
|
|
"--allow-host-compat",
|
|
"--json",
|
|
)
|
|
|
|
PUBLIC_SDK_METHODS = (
|
|
"apply_workspace_patch",
|
|
"close_shell",
|
|
"create_server",
|
|
"create_snapshot",
|
|
"create_vm",
|
|
"create_workspace",
|
|
"delete_snapshot",
|
|
"delete_vm",
|
|
"delete_workspace",
|
|
"diff_workspace",
|
|
"exec_vm",
|
|
"exec_workspace",
|
|
"export_workspace",
|
|
"export_workspace_disk",
|
|
"inspect_environment",
|
|
"list_environments",
|
|
"list_services",
|
|
"list_snapshots",
|
|
"list_workspace_disk",
|
|
"list_workspace_files",
|
|
"logs_service",
|
|
"logs_workspace",
|
|
"network_info_vm",
|
|
"open_shell",
|
|
"prune_environments",
|
|
"pull_environment",
|
|
"push_workspace_sync",
|
|
"read_shell",
|
|
"read_workspace_disk",
|
|
"read_workspace_file",
|
|
"reap_expired",
|
|
"reset_workspace",
|
|
"run_in_vm",
|
|
"signal_shell",
|
|
"start_service",
|
|
"start_vm",
|
|
"start_workspace",
|
|
"status_service",
|
|
"status_vm",
|
|
"status_workspace",
|
|
"stop_service",
|
|
"stop_vm",
|
|
"stop_workspace",
|
|
"write_shell",
|
|
"write_workspace_file",
|
|
)
|
|
|
|
PUBLIC_MCP_TOOLS = (
|
|
"service_list",
|
|
"service_logs",
|
|
"service_start",
|
|
"service_status",
|
|
"service_stop",
|
|
"shell_close",
|
|
"shell_open",
|
|
"shell_read",
|
|
"shell_signal",
|
|
"shell_write",
|
|
"snapshot_create",
|
|
"snapshot_delete",
|
|
"snapshot_list",
|
|
"vm_create",
|
|
"vm_delete",
|
|
"vm_exec",
|
|
"vm_list_environments",
|
|
"vm_network_info",
|
|
"vm_reap_expired",
|
|
"vm_run",
|
|
"vm_start",
|
|
"vm_status",
|
|
"vm_stop",
|
|
"workspace_create",
|
|
"workspace_delete",
|
|
"workspace_disk_export",
|
|
"workspace_disk_list",
|
|
"workspace_disk_read",
|
|
"workspace_diff",
|
|
"workspace_exec",
|
|
"workspace_export",
|
|
"workspace_file_list",
|
|
"workspace_file_read",
|
|
"workspace_file_write",
|
|
"workspace_logs",
|
|
"workspace_patch_apply",
|
|
"workspace_reset",
|
|
"workspace_start",
|
|
"workspace_status",
|
|
"workspace_stop",
|
|
"workspace_sync_push",
|
|
)
|