LockedResource

Struct LockedResource 

Source
pub struct LockedResource {
Show 13 fields pub name: String, pub source: Option<String>, pub url: Option<String>, pub path: String, pub version: Option<String>, pub resolved_commit: Option<String>, pub checksum: String, pub installed_at: String, pub dependencies: Vec<String>, pub resource_type: ResourceType, pub tool: Option<String>, pub manifest_alias: Option<String>, pub applied_patches: HashMap<String, Value>,
}
Expand description

A locked resource (agent or snippet) with resolved version and integrity information.

Represents a specific resource file that has been resolved from either a source repository or local filesystem. Contains all information needed to verify the exact version and integrity of the installed resource.

§Local vs Remote Resources

Remote resources (from Git repositories) include:

  • source: Source repository name
  • url: Repository URL
  • version: Original version constraint
  • resolved_commit: Exact commit containing the resource

Local resources (from filesystem) omit these fields since they don’t involve Git repositories.

§Integrity Verification

All resources include a SHA-256 checksum for integrity verification. The checksum is calculated from the file content after installation and can be used to detect corruption or tampering.

§Examples

Remote resource in TOML format:

[[agents]]
name = "example-agent"
source = "community"
url = "https://github.com/example/repo.git"
path = "agents/example.md"
version = "^1.0"
resolved_commit = "a1b2c3d4e5f6..."
checksum = "sha256:abcdef123456..."
installed_at = "agents/example-agent.md"

Local resource in TOML format:

[[agents]]
name = "local-helper"
path = "../local/helper.md"
checksum = "sha256:fedcba654321..."
installed_at = "agents/local-helper.md"

Fields§

§name: String

Resource name from the manifest.

This corresponds to keys in the [agents] or [snippets] sections of the manifest. Resources are uniquely identified by the combination of (name, source), allowing multiple sources to provide resources with the same name.

§source: Option<String>

Source repository name for remote resources.

References a source defined in the [sources] section of the manifest. This field is None for local resources that don’t come from Git repositories.

Omitted from TOML serialization when None.

§url: Option<String>

Source repository URL for remote resources.

The full Git repository URL where this resource originates. This field is None for local resources.

Omitted from TOML serialization when None.

§path: String

Path to the resource file.

For remote resources, this is the relative path within the source repository. For local resources, this is the filesystem path (may be relative or absolute).

§version: Option<String>

Original version constraint from the manifest.

This preserves the version constraint specified in agpm.toml (e.g., “^1.0”, “v2.1.0”). For local resources or resources without version constraints, this field is None.

Omitted from TOML serialization when None.

§resolved_commit: Option<String>

Resolved Git commit hash for remote resources.

The exact 40-character SHA-1 commit hash where this resource was found. This ensures reproducible installations even if the version constraint could match multiple commits. For local resources, this field is None.

Omitted from TOML serialization when None.

§checksum: String

SHA-256 checksum of the installed file content.

Used for integrity verification to detect file corruption or tampering. The format is “sha256:” followed by the hexadecimal hash.

Example: “sha256:a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3”

§installed_at: String

Installation path relative to the project root.

Where the resource file is installed within the project directory. This path is always relative to the project root and uses forward slashes as separators for cross-platform compatibility.

Examples: “agents/example-agent.md”, “snippets/util-snippet.md”

§dependencies: Vec<String>

Dependencies of this resource.

Lists the direct dependencies that this resource requires, including both manifest dependencies and transitive dependencies discovered from the resource file itself. Each dependency is identified by its resource type and name (e.g., “agents/helper-agent”, “snippets/utils”).

This field enables dependency graph analysis and ensures all required resources are installed. It follows the same model as Cargo.lock where each package lists its dependencies.

Always included in TOML serialization, even when empty, to match Cargo.lock format.

§resource_type: ResourceType

Resource type (agent, snippet, command, etc.)

This field is populated during deserialization based on which TOML section the resource came from ([[agents]], [[snippets]], etc.) and is used internally for determining the correct lockfile section when adding/updating entries.

It is never serialized to the lockfile - the section header provides this information.

§tool: Option<String>

Tool type for multi-tool support (claude-code, opencode, agpm, custom).

Specifies which target AI coding assistant tool this resource is for. This determines where the resource is installed and how it’s configured.

When None during deserialization, will be set based on resource type’s default (e.g., snippets default to “agpm”, others to “claude-code”).

Always serialized (even if Some) to avoid ambiguity.

§manifest_alias: Option<String>

Original manifest alias for pattern-expanded dependencies.

When a pattern dependency (e.g., agents/helpers/*.md with alias “all-helpers”) expands to multiple files, each file gets its own lockfile entry with a unique name (e.g., “helper-alpha”, “helper-beta”). The manifest_alias field preserves the original pattern alias so patches defined under that alias can be correctly applied to all matched files.

For non-pattern dependencies, this field is None since name already represents the manifest alias.

Example lockfile entry for pattern-expanded resource:

[[agents]]
name = "helper-alpha"                    # Individual file name
manifest_alias = "all-helpers"           # Original pattern alias
path = "agents/helpers/helper-alpha.md"
...

This enables pattern patching: all files matched by “all-helpers” pattern can have patches applied via [patch.agents.all-helpers] in the manifest.

Omitted from TOML serialization when None (for non-pattern dependencies).

§applied_patches: HashMap<String, Value>

Applied patches from manifest configuration.

Contains the key-value pairs that were applied to this resource’s metadata via [patch.<resource-type>.<alias>] sections in agpm.toml or agpm.private.toml.

This enables reproducible installations and provides visibility into which resources have been patched.

Omitted from TOML serialization when empty.

Trait Implementations§

Source§

impl Clone for LockedResource

Source§

fn clone(&self) -> LockedResource

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LockedResource

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for LockedResource

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for LockedResource

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,