Documentation
¶
Overview ¶
Package agentplugins validates and indexes local Agent Plugin ZIP bundles and stores their marketplace files. A plugin version is one bundle, stored at <name>/<version>/<name>-<version>.zip, that carries at least one harness manifest (.claude-plugin/plugin.json, .cursor-plugin/plugin.json or .codex-plugin/plugin.json) or a root plugin.json of the Agent Plugins Standard 1.0.0; the path, not the manifest, names the plugin and its version. The marketplace files list each plugin's newest version and are stored at the repository root as queued work rebuilds them (decision 0033), so AQL, the storage API and the folder listings show them as they show any other file.
Role ¶
artifacts module, ecosystem layer: the Agent Plugins bundle admission, manifest index and marketplace files of the Agent Plugins slice. Its Handler plugs into the item service through the format hooks (decision 0032). Its http subpackage, agentpluginshttp (artifacts/ecosystem/agentplugins/http), serves the stored marketplace files.
Inputs ¶
- Driving: the format registry (artifacts/ecosystem), which hands the item service's hooks for agentplugins repositories to Handler; the work queue, which runs every format's reindex and the agentplugins.marketplace work through it; the item service's downloads, which ask Handler which work a marketplace file owes (Owed) and seed it for a repository that has none yet (Resolve); and agentpluginshttp, which serves the stored files at /artifactory/api/agentplugins/{repoKey}/{marketplace} and, through the item routes, at the repository root (IsMarketplace).
- Driven: the format hooks' environment (format.Env): its blobs hold the bundles, its store holds the items, their properties and the package index (artifacts/core/pkgindex), which the marketplace work lists, and its Derive stores each marketplace file and its Enqueue queues the work. The generic blackout and include and exclude checks (artifacts/ecosystem/generic) run after the format's own.
- Settings: none.
Outputs ¶
- Handler: the hooks that read a bundle once before its transaction (Inspect), admit only a bundle with a harness manifest or a conforming root plugin.json at a canonical path and keep uploads off the marketplace names (Admit), index a version, set its properties and queue the marketplace work once its bundle is stored (Deployed), queue it again when a bundle or a marketplace file is deleted (Deleting) and rebuild the index from the stored bundles (Reindex). The item service prunes a version whose bundle is gone.
- The agentplugins.marketplace work (KindMarketplace), keyed by the repository (Work): it stores claude-marketplace.json, codex-marketplace.json, cursor-marketplace.json, marketplace.json and vscode-marketplace.json at the repository root, created by _system_, and leaves a file whose content has not changed as it is. Owed makes a marketplace file's download wait for that work, Resolve queues it for a repository that holds no file and no work yet, and Classify classes the files as derived, so replication skips them.
- The package index: a package per plugin name, with a version per stored bundle, whose metadata is the bundle's Metadata as JSON: its harnesses and their manifests, its conforming root plugin.json, its path and its checksums.
- The agentplugins.name, agentplugins.version, agentplugins.type (the harnesses, and generic, vscode and cursor for the standard layout), agentplugins.sha256 and agentplugins.sha1 item properties on each bundle.
- The path and bundle rules: ValidName, ValidVersion, Path, ParsePath, ReadArchive, Metadata, StandardSchema, ErrArchive, IsMarketplace and the bundle bounds.
Invariants ¶
- A bundle is read to its end, every member's CRC and size included, within fixed bounds (64 MiB stored and inflated, 512 entries and a 1 MiB manifest), with no link and no duplicate, absolute or traversing path.
- The path names the plugin and its version, even when a manifest says otherwise.
- A bundle is indexed by its harness manifests and by a root plugin.json that conforms to the Agent Plugins Standard 1.0.0, which self-managed 7.173.8 added. A root plugin.json that does not conform indexes nothing, so a harness bundle carrying one keeps its harness-only listing, and a bundle with no other manifest is refused.
- vscode-marketplace.json lists the standard layout only, and cursor-marketplace.json adds it to the Cursor manifests; an entry takes its fields from the harness's own manifest first.
- A marketplace file is one stored file per repository that lists, for each plugin, its newest version, as 7.x keeps the files at the repository root (issue 1292). Every caller who may read the file's own path reads the same bytes; the permission check is the file's, as for any other file, so a grant that leaves the root out shows no marketplace file. A version whose ZIP the repository's patterns reject stays listed, and only the ZIP's download refuses. The unified file advertises ZIP sources, and Claude's file URL sources.
- All five files are kept, empty or not, so each answers once the repository holds a plugin or a download has asked for it. A folder at a file's name is left in place and that file is not stored.
- The property names are stored, so they stay byte-identical.
References ¶
- Decision 0032: docs/research/decisions/0032-package-format-handlers.md (the format hooks); decision 0033: docs/research/decisions/0033-persistent-work-queue.md (the queued marketplace work).
- docs/research/33-package-formats.md, "Agent Plugins" (the contract, the marketplace files and the 7.173.8 version boundary), and docs/testing/phase9b-signoff.md (the qualification ledger).
- JFrog Agent Plugins repositories: https://docs.jfrog.com/artifactory/docs/agent-plugins-repositories.
- The Agent Plugins Standard 1.0.0 and its manifest schema: https://github.com/agentplugins/agent-plugins-spec (spec/1.0.0.md and schemas/1.0.0/plugin.schema.json).
- Target layout: docs/research/architecture-options/5-modular-monolith.md, line 232 (ecosystem/agentplugins), line 379 (the slice row), line 405 (the root agentplugins.go, now in ecosystem/agentplugins/http) and line 997 (the mapping row).
- Plan: docs/implementation/plan.md#p9b-newly-identified-artifactory-formats and #p9d-modular-monolith-migration, epic ECO (https://github.com/weaveplatform/artifactweave/issues/943).
- https://github.com/weaveplatform/artifactweave/issues/690, https://github.com/weaveplatform/artifactweave/issues/691, https://github.com/weaveplatform/artifactweave/issues/1046, https://github.com/weaveplatform/artifactweave/issues/1255 and https://github.com/weaveplatform/artifactweave/issues/1292
Status ¶
Implemented P9b (newly identified Artifactory formats). Moved here in P9d. The Agent Plugins Standard and vscode-marketplace.json added by issue 1255. The marketplace files stored rather than rendered for each reader by issue 1292.
Testing ¶
- archive_test.go: bundle reading and paths, invalid bundles, and the bounds and integrity checks.
- standard_test.go: which root plugin.json conforms to the standard, the layouts a bundle is indexed by and its agentplugins.type values, and the files and fields each layout is listed with.
- handler_test.go: invalid bundles and repository policies at admission, a missing blob, and a reindex fault.
- marketplace_test.go: each plugin's newest version in each file, and the store faults the files fail on.
- work_test.go: the stored files, an unchanged file left as it is, a folder at a file's name, the repositories that owe no work, store faults, Owed, Resolve, Classify and the hooks that queue the work.
Index ¶
- Constants
- Variables
- func IsMarketplace(name string) bool
- func ParsePath(p string) (name, version string, ok bool)
- func Path(name, version string) string
- func Serves(t repo.PackageType) bool
- func ValidName(v string) bool
- func ValidVersion(v string) bool
- type Handler
- func (Handler) Admit(_ context.Context, env format.Env, c repo.Config, w format.Write) (format.Write, error)
- func (Handler) Classify(_ repo.Config, path string) format.Class
- func (Handler) Deleted(context.Context, format.Env, repo.Config, []model.Item) error
- func (Handler) Deleting(ctx context.Context, env format.Env, c repo.Config, it model.Item) error
- func (Handler) Deployed(ctx context.Context, env format.Env, c repo.Config, it model.Item) error
- func (Handler) Inspect(ctx context.Context, env format.Env, _ repo.Config, w format.Write) (any, error)
- func (Handler) Owed(c repo.Config, cached bool, path string) []format.WorkRef
- func (Handler) Reindex(ctx context.Context, env format.Env, c repo.Config) error
- func (Handler) Resolve(ctx context.Context, env format.Env, c repo.Config, d format.Download) (string, error)
- func (Handler) Work(ctx context.Context, env format.Env, it work.WorkItem) error
- func (Handler) WorkKinds() []string
- type Metadata
Constants ¶
const ( // MaxArchiveBytes bounds a plugin bundle, and the total its files // inflate to, at 64 MiB. MaxArchiveBytes = 64 << 20 // MaxManifestBytes bounds each harness manifest and a root plugin.json // at 1 MiB. MaxManifestBytes = 1 << 20 // MaxFiles bounds a bundle at 512 ZIP entries, folders included. MaxFiles = 512 )
const KindMarketplace = "agentplugins.marketplace"
KindMarketplace is the work kind that rebuilds a repository's marketplace files, keyed by the repository. The persistent work queue stores it with each item, so it never changes.
const StandardSchema = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json"
StandardSchema is the $schema a root plugin.json sets to declare the Agent Plugins Standard 1.0.0, the only version 7.173.8 indexes.
Variables ¶
var ( // ErrArchive is what ReadArchive returns for every bundle it refuses; // Deployed and Reindex wrap it for a stored bundle that has neither a // harness manifest nor a conforming root plugin.json. ErrArchive = errors.New("agentplugins: invalid agent plugin bundle") )
Functions ¶
func IsMarketplace ¶
IsMarketplace reports whether name is one of the marketplace files a local Agent Plugins repository keeps at its root: marketplace.json, which lists every plugin; claude-marketplace.json and codex-marketplace.json, which list the plugins carrying that harness's manifest; cursor-marketplace.json, which lists those with a Cursor manifest or a conforming root plugin.json; and vscode-marketplace.json, which lists those with a conforming root plugin.json only (the Agent Plugins Repositories docs' "Marketplace Files and Indexing" table, 7.173.8).
func ParsePath ¶
ParsePath splits a canonical bundle path into the plugin name and version, and reports ok only when p is exactly Path(name, version) with a valid name and version.
func Path ¶
Path is the canonical item path of the bundle of plugin name at version, <name>/<version>/<name>-<version>.zip, where jf agent plugins publish uploads it.
func Serves ¶
func Serves(t repo.PackageType) bool
Serves reports whether t is the Agent Plugins package type.
func ValidName ¶
ValidName reports whether v is a plugin name the registry accepts: a letter or digit followed by up to 127 letters, digits, dots, underscores and hyphens.
func ValidVersion ¶
ValidVersion reports whether v is a full semantic version of at most 128 bytes, major.minor.patch with an optional pre-release and build, written without a leading v.
Types ¶
type Handler ¶
Handler is the Agent Plugins format's hooks: it admits a plugin bundle at its canonical path only when it carries a harness manifest or a root plugin.json of the Agent Plugins Standard 1.0.0, keeps the package index and the agentplugins.* properties in step with the stored bundles, and keeps uploads off the marketplace file names. It embeds the generic hooks, so every path is classed as generic content is.
func (Handler) Admit ¶
func (Handler) Admit( _ context.Context, env format.Env, c repo.Config, w format.Write, ) (format.Write, error)
Admit refuses a write, other than a checksum deploy or a remote's cached content, to a marketplace file name (409), since the format alone writes those files (Work), and a .zip that is not at a canonical bundle path or whose bundle Inspect found invalid or with neither a harness manifest nor a conforming root plugin.json (409). It then applies the generic blackout and include and exclude checks, keeping their refusals as they are.
func (Handler) Classify ¶
Classify classes the marketplace files as derived, so replication skips them and each repository builds its own, and every other path as unique content.
func (Handler) Deleted ¶
Deleted does nothing: a version is one bundle, so the item service's pruning of versions left without files is all a delete needs.
func (Handler) Deleting ¶
Deleting queues the marketplace work when a bundle at a canonical path or a marketplace file of the repository's own tree is about to be deleted, so the files stop listing a version once its bundle is gone and a deleted file is stored again. The item service drops a removed bundle's version link with it. Folders, cached items and other files change nothing.
func (Handler) Deployed ¶
Deployed indexes a stored bundle at a canonical path of the repository's own tree, and queues the marketplace work. It sets the agentplugins.* properties, dropping agentplugins.sha1 when the item has no SHA-1, creates the plugin's package when it is new, and links the version to the bundle, with its Metadata, named and versioned by the path, as the version's metadata. A bundle with neither a harness manifest nor a conforming root plugin.json fails with ErrArchive. A file stored at a marketplace name, which only a restore from the trash can bring back, queues the work too, so the file is rebuilt over what was restored; folders, cached items and other files change nothing.
func (Handler) Inspect ¶
func (Handler) Inspect( ctx context.Context, env format.Env, _ repo.Config, w format.Write, ) (any, error)
Inspect reads the stored bundle of a write to a .zip path before the write's transaction, and keeps what it read, or why the bundle is invalid, for Admit and Deployed, so a bundle is read once per write. A write without a SHA-256 and any other file inspect nothing; a bundle that cannot be opened fails the write.
func (Handler) Owed ¶
Owed names the marketplace work that a download of a marketplace file of a local repository must see done first, so a client never reads a file that lags a completed write; other downloads owe nothing.
func (Handler) Reindex ¶
Reindex rebuilds repository c's package index from the bundles at canonical paths of its own tree, setting each bundle's properties as Deployed does, then queues the marketplace work. It fails with ErrArchive on the first bundle that cannot be read or has neither a harness manifest nor a conforming root plugin.json.
func (Handler) Resolve ¶
func (Handler) Resolve( ctx context.Context, env format.Env, c repo.Config, d format.Download, ) (string, error)
Resolve leaves every path as it is. When a download asks for a marketplace file of a local repository that holds neither the file nor queued marketplace work, such as a repository no plugin has reached yet, it queues the work, which Owed then makes the download wait for, so the file is stored and served. A store or work queue fault fails the download.
func (Handler) Work ¶
Work rebuilds the marketplace files of one repository from its package index and stores each at the repository root, as 7.x does after an upload ("rebuilds marketplace JSON at the repository root", the Agent Plugins Repositories docs). 7.x builds them after the upload has answered, which JFrog CLI's own Agent Plugins tests wait for, so this runs from the persistent work queue too (decision 0033). Every file is kept, so each answers whether or not a plugin is listed in it [I]. A file whose content has not changed is left as it is, so its dates and checksums change only with what it lists. A folder at a file's name is left in place, and that file is not stored. A removed repository no longer owes this work.
type Metadata ¶
type Metadata struct {
Name string `json:"name"`
Version string `json:"version"`
Path string `json:"path"`
SHA256 string `json:"sha256"`
SHA1 string `json:"sha1,omitempty"`
Harnesses []string `json:"harnesses"`
Manifests map[string]json.RawMessage `json:"manifests"`
// Root is set for any root plugin.json with a name, Standard only for
// one that conforms to the Agent Plugins Standard 1.0.0. A harness
// bundle may carry a root plugin.json of its own that predates the
// standard; 7.x discovers the standard layout only from a conforming
// one, so that bundle keeps its harness-only listing.
Root bool `json:"root"`
Standard json.RawMessage `json:"standard,omitempty"`
}
Metadata records only bounded manifest data. Path identity replaces any conflicting manifest name or version before it enters the package index.
func ReadArchive ¶
ReadArchive checks every ZIP member, including CRC and total decompressed size, and reads the harness manifests and the root plugin.json. Each must be a JSON object with a name, or the bundle is refused; the root one is kept as Standard only when it conforms to the Agent Plugins Standard 1.0.0 (self-managed 7.173.8). A bundle with neither kind of manifest is refused.
func (Metadata) Indexed ¶
Indexed reports whether the bundle has a layout 7.x indexes: a harness manifest or a conforming root plugin.json.
func (Metadata) Types ¶
Types is the multi-valued agentplugins.type property: the harnesses whose manifests the bundle carries and, for a conforming root plugin.json, generic, vscode and cursor, the values the Agent Plugins Repositories docs give for the standard layout. A bundle with both layouts takes the union [I]; the values are sorted, as the harnesses always were.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package agentpluginshttp serves the agent plugin marketplace files of a local Agent Plugins repository over the item kit: at /artifactory/api/agentplugins/{repoKey}/{marketplace}, and at the repository root through the item routes.
|
Package agentpluginshttp serves the agent plugin marketplace files of a local Agent Plugins repository over the item kit: at /artifactory/api/agentplugins/{repoKey}/{marketplace}, and at the repository root through the item routes. |