Strip server-specific types and constants from pika-cloud
Intent: Remove types, constants, and test code from the shared `pika-cloud` crate that are only consumed by `pika-server`. This includes the entire agent control protocol (command/status/result/error envelopes), runtime lifecycle phases, backup status records, VM backup schema constants, and the `AuthContext` struct. The crate retains only truly shared contracts: `ProviderKind`, `AgentStartupPhase`, `IncusProvisionParams`, `ManagedVmProvisionParams`, `AgentProvisionRequest`, `IncusGuestRunRequest`, and the `INCUS_GUEST_RUN_REQUEST_SCHEMA_VERSION` constant.
Affected files: crates/pika-cloud/src/lib.rs
@@ -27,17 +27,7 @@ pub use spec::{
};
use serde::{Deserialize, Serialize};
-use serde_json::Value;
-pub const CONTROL_CMD_KIND: u16 = 24_910;
-pub const CONTROL_STATUS_KIND: u16 = 24_911;
-pub const CONTROL_RESULT_KIND: u16 = 24_912;
-pub const CONTROL_ERROR_KIND: u16 = 24_913;
-
-pub const CMD_SCHEMA_V1: &str = "agent.control.cmd.v1";
-pub const STATUS_SCHEMA_V1: &str = "agent.control.status.v1";
-pub const RESULT_SCHEMA_V1: &str = "agent.control.result.v1";
-pub const ERROR_SCHEMA_V1: &str = "agent.control.error.v1";
@@ -46,31 +36,6 @@ pub enum ProviderKind {
Incus,
}
-#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
-#[serde(rename_all = "snake_case")]
-pub enum ProtocolKind {
- Acp,
-}
-
-#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
-#[serde(rename_all = "snake_case")]
-pub enum RuntimeLifecyclePhase {
@@ -83,12 +48,6 @@ pub enum AgentStartupPhase {
Failed,
}
-#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize, Default)]
-pub struct AuthContext {
- #[serde(skip_serializing_if = "Option::is_none")]
- pub acting_as_pubkey: Option<String>,
-}
@@ -133,424 +91,17 @@ impl AgentProvisionRequest {
}
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
-pub struct ManagedRuntimeStatus {
... (removed ~400 lines of envelopes, descriptors, and test code)
The bulk of this change is a large deletion from crates/pika-cloud/src/lib.rs. Every type that existed solely to support the server's managed-runtime orchestration layer is removed:
- Constants:
CONTROL_CMD_KIND,CONTROL_STATUS_KIND,CONTROL_RESULT_KIND,CONTROL_ERROR_KIND,CMD_SCHEMA_V1,STATUS_SCHEMA_V1,RESULT_SCHEMA_V1,ERROR_SCHEMA_V1,VM_BACKUP_STATUS_SCHEMA_V1. - Enums:
ProtocolKind,RuntimeLifecyclePhase,VmBackupFreshness,VmBackupUnitKind,VmRecoveryPointKind. - Structs:
AuthContext,ManagedRuntimeStatus,VmBackupStatusRecord,ManagedRuntimeBackupStatus,ManagedOpenClawLaunchAuth,ProvisionCommand,ProcessWelcomeCommand,TeardownCommand,GetRuntimeCommand,ListRuntimesCommand,RuntimeDescriptor, and all fourAgentControl*Envelopetypes. - Tests: Every round-trip test for the removed types is deleted (command envelope, status envelope, result envelope, error envelope, lifecycle phase variants, provision command minimal fields, backup records, etc.).
The IncusGuestRunRequest struct is kept but gains #[serde(deny_unknown_fields)] for stricter deserialization. The serde_json::Value import is dropped since no remaining type uses arbitrary JSON fields.
What stays in pika-cloud is the minimal surface shared by multiple crates: ProviderKind, AgentStartupPhase, IncusProvisionParams, ManagedVmProvisionParams, AgentProvisionRequest, IncusGuestRunRequest, and the Incus guest schema version constant.