Skip to main content

vulcan_luaskills/skill/
source.rs

1use serde::{Deserialize, Serialize};
2
3/// Supported managed install source types recorded by LuaSkills.
4/// LuaSkills 记录的受管安装来源类型。
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
6#[serde(rename_all = "snake_case")]
7pub enum SkillInstallSourceType {
8    /// GitHub Release source tracked by repository and release tag.
9    /// 通过仓库与发布标签追踪的 GitHub Release 来源。
10    #[default]
11    Github,
12    /// Remote source YAML URL that describes one skill package.
13    /// 描述单个技能包的远程 source YAML 地址。
14    Url,
15}
16
17/// Stable source descriptor persisted for one managed skill installation.
18/// 为单个受管技能安装持久化的稳定来源描述。
19#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
20pub struct InstalledSkillSourceRecord {
21    /// Stable source type used for future update checks.
22    /// 用于后续更新检查的稳定来源类型。
23    pub source_type: SkillInstallSourceType,
24    /// Stable source locator such as `owner/repo` or one source YAML URL.
25    /// 稳定来源定位值,例如 `owner/repo` 或某个 source YAML 地址。
26    pub locator: String,
27    /// Optional resolved release tag recorded during installation.
28    /// 安装时记录的可选已解析发布标签。
29    #[serde(default)]
30    pub tag: Option<String>,
31}
32
33/// Persistent install record written only for managed skill installations.
34/// 仅为受管技能安装写入的持久化安装记录。
35#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
36pub struct InstalledSkillRecord {
37    /// Stable skill identifier currently managed by the install record.
38    /// 当前安装记录所管理的稳定技能标识符。
39    pub skill_id: String,
40    /// Installed semantic version tracked for update checks.
41    /// 用于更新检查的已安装语义化版本。
42    pub version: String,
43    /// Whether the current skill is managed by the install workflow.
44    /// 当前技能是否由安装流程受管。
45    pub managed: bool,
46    /// Structured source descriptor of the current managed installation.
47    /// 当前受管安装的结构化来源描述。
48    pub source: InstalledSkillSourceRecord,
49    /// Unix timestamp in milliseconds when the install record was written.
50    /// 当前安装记录写入时的 Unix 毫秒时间戳。
51    pub installed_at_unix_ms: u128,
52}