#MoonLib Pack SDK

    The Pack SDK is MoonSuite’s policy-free contract for installable runtime extensions, domain packs, and app-tool bundles.

    Packages:

    • vectie/moonlib/pack: manifest, disk codec, path rules, and validation;
    • vectie/moonlib/pack/registry: caller-supplied in-memory catalog;
    • vectie/moonlib/pack/installer: native staged installation, receipts, integrity verification, activation, rollback, and deactivation;
    • vectie/moonlib/pack/host: generic host activation/deactivation projections.

    Dependency direction is strict: domain products may import the SDK; the SDK must never import or name a domain product. Run pack/check-boundaries.sh to enforce this rule.

    Installation grants no runtime dependency or authority by default. A host must provide an explicit HostProfile, and it must still enforce each tool’s schema, review requirement, evidence output, and effect authorization at invocation.

    The native installer uses per-pack file locks, immutable version directories, SHA-256 receipts, and atomic same-filesystem pointer replacement. Deactivation removes only the active pointer; installed artifacts and user evidence remain available for audit and rollback.

    See ROADMAP.md for the remaining runtime, trust, migration, and operations work required before unattended or third-party deployment.

    AppEntrypoint

    pub(all) struct AppEntrypoint {
    id : String
    path : String
    audience : String
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    AuthorityClass

    pub(all) enum AuthorityClass {
    Observe
    CognitiveMaintenance
    SandboxExecution
    WorkspaceMutation
    ExternalEffect
    PhysicalEffect
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    ContractRef

    pub(all) struct ContractRef {
    id : String
    version : String
    path : String
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    MoonPackManifest

    pub(all) struct MoonPackManifest {
    id : String
    version : String
    display_name : String
    product_id : String
    kind : PackKind
    required_runtime_extensions : Array[String]
    book_templates : Array[ContractRef]
    schemas : Array[ContractRef]
    tools : Array[ToolDeclaration]
    workflows : Array[ContractRef]
    skills : Array[ContractRef]
    policies : Array[ContractRef]
    provider_ports : Array[ContractRef]
    schedules : Array[ScheduleDeclaration]
    app_entrypoints : Array[AppEntrypoint]
    migrations : Array[ContractRef]
    evaluations : Array[ContractRef]
    uninstall_contract : ContractRef?
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    PackKind

    pub(all) enum PackKind {
    DomainPack
    RuntimeExtension
    AppToolBundle
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    ScheduleDeclaration

    pub(all) struct ScheduleDeclaration {
    id : String
    cadence : String
    timezone : String
    workflow_id : String
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    ToolDeclaration

    pub(all) struct ToolDeclaration {
    id : String
    owner_product : String
    input_schema_id : String
    output_schema_id : String
    authority : AuthorityClass
    idempotent : Bool
    evidence_outputs : Array[String]
    review_required : Bool
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    ValidationIssue

    pub(all) struct ValidationIssue {
    path : String
    message : String
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    ValidationReport

    pub(all) struct ValidationReport {
    ok : Bool
    issues : Array[ValidationIssue]
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    app_entrypoint

    fn app_entrypoint(id : String, path : String, audience : String) -> AppEntrypoint

    artifact_contracts

    fn artifact_contracts(manifest : MoonPackManifest) -> Array[ContractRef]

    contract_ref

    fn contract_ref(id : String, version : String, path : String) -> ContractRef

    decode_manifest

    fn decode_manifest(text : String) -> MoonPackManifest raise

    encode_manifest

    fn encode_manifest(manifest : MoonPackManifest) -> String

    has_authority

    fn has_authority(manifest : MoonPackManifest, authority : AuthorityClass) -> Bool

    safe_artifact_path

    fn safe_artifact_path(value : String) -> Bool

    safe_identifier

    fn safe_identifier(value : String) -> Bool

    schedule_declaration

    fn schedule_declaration(id : String, cadence : String, timezone : String, workflow_id : String) -> ScheduleDeclaration

    tool_declaration

    fn tool_declaration(id : String, owner_product : String, input_schema_id : String, output_schema_id : String, authority : AuthorityClass, idempotent? : Bool, evidence_outputs? : Array[String], review_required? : Bool) -> ToolDeclaration

    validate_manifest

    fn validate_manifest(manifest : MoonPackManifest) -> ValidationReport