use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use crate::{AppId, ScriptId, ScriptSandbox}; /// A user-uploaded Rhai script and its execution configuration. /// /// This is the canonical representation that flows between manager (storage), /// orchestrator (dispatch), and executor (run). It must stay serializable /// because in cluster mode it crosses process boundaries on every invocation. #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Script { pub id: ScriptId, /// Owning app. Set on create, immutable thereafter — a "move to /// another app" is a copy+delete, not an in-place edit (snapshot /// semantics — see blueprint §11.5). pub app_id: AppId, pub name: String, pub description: Option, pub version: i32, pub source: String, pub timeout_seconds: u32, /// Per-script overrides for Rhai sandbox limits. Empty = platform /// defaults. Values are admin-ceiling-clamped at write time. #[serde(default)] pub sandbox: ScriptSandbox, /// **v1.3+ advisory only.** Real heap limits require OS-level /// isolation (cgroups, process limits) which lands with cluster-mode /// executor sandboxing. The field stays in the schema so we don't /// have to add it back when that's built. pub memory_limit_mb: u32, pub created_at: DateTime, pub updated_at: DateTime, }