Documentation
¶
Overview ¶
Package ship lays a knowledge pack into a QuickAgent's package so the release carries it: the pack's files under knowledge/<name>/ with the manifest.json the registry holds a shipped pack to, the entry in the package's knowledge.ships and the patterns of publish.include that put it in the archive, and the sidecar that records where the pack was laid down from.
A shipped pack is part of the release. Everyone who can download the release can read it, so the commands that ship one ask the publisher to confirm it, and the confirmation names each pack with the origin laid down here (Entry.Origin) for the registry to check against its own records.
Index ¶
- Constants
- Variables
- func Check(p *knowledge.Pack) error
- func Covers(include []string, name string) bool
- func Dir(agentDir, name string) string
- func DirSize(agentDir, name string) (bytes int64, files int, err error)
- func Names(packs []Pack) []string
- func Remove(agentDir, name string) error
- func Ships(agentYAML []byte) ([]string, error)
- func WriteRecord(agentDir string, r Record) error
- type Edit
- type Entry
- type Laid
- type Origin
- type Pack
- type Record
Constants ¶
const ( MaxPacks = manifest.MaxShippedPacks MaxPackBytes = manifest.MaxKnowledgePackBytes MaxPackFiles = manifest.MaxKnowledgePackFiles )
The most a release ships: packs, and the size and files of each, as the registry holds them.
const ( KindOwn = "own" KindOrg = "org" )
The kinds of store a shipped pack is laid down from.
const IncludeAll = manifest.KnowledgeDir + "/**"
IncludeAll is the publish.include pattern that puts every shipped pack in the archive.
const RecordFile = ".agentry/knowledge-ships.json"
RecordFile is the sidecar, relative to the package, that remembers where each shipped pack was laid down from. It is not part of the manifest and not part of the release: publish.include never names it.
const RecordSchema = "knowledge-ships/v1"
RecordSchema is the sidecar's format.
Variables ¶
var ErrPastCap = errors.New("knowledge pack is past what a release ships")
ErrPastCap is a pack past what a release may ship.
Functions ¶
func Check ¶
Check holds a pack to what a release may ship, before anything is written: at most 10 MB with its manifest.json and 2,000 files.
func Covers ¶
Covers says whether the include patterns put a pack's files in the archive: its manifest.json and its index.
func DirSize ¶
DirSize is the bytes and files of everything under a shipped pack's folder, as the archive will carry it.
func Remove ¶
Remove takes the pack's folder out of the package. A pack that is not there is not an error.
func WriteRecord ¶
WriteRecord writes the sidecar, or removes it when no pack is left.
Types ¶
type Edit ¶
Edit is a change to a package's agent.yaml and what it did, one plain sentence each.
type Entry ¶
type Entry struct {
Name string `json:"name"`
// SHA256 is the tree digest that was laid down. The origin is claimed
// only while the pack's manifest.json still says it.
SHA256 string `json:"sha256"`
// Registry is the registry the origin's pack id belongs to.
Registry string `json:"registry,omitempty"`
Origin *Origin `json:"origin,omitempty"`
}
Entry is the sidecar's record of one shipped pack.
type Laid ¶
type Laid struct {
Name string
Pages int
// Bytes is every file of the pack, its manifest.json included, as the
// registry counts it against the 10 MB a pack may be.
Bytes int64
// Files is the files of the pack's tree, as the registry counts them
// against the 2,000 a pack may hold.
Files int
// SHA256 is the tree's digest, the one in the pack's manifest.json.
SHA256 string
}
Laid is a pack as it now stands under knowledge/<name>/.
type Origin ¶
type Origin struct {
Kind string `json:"kind"`
Org string `json:"org,omitempty"`
PackID string `json:"packId"`
}
Origin is the stored pack in a registry that a shipped pack was laid down from: the claim the publish confirmation carries, which the registry checks (the pack exists and is ready, it is the publisher's own or the organization's, and its digest is the shipped pack's).
func OriginOf ¶
OriginOf is the origin to claim for the shipped pack of that name when the package is published to the registry at reg, or why none is claimed: it belongs to another registry, or the pack's manifest.json is no longer the one that was laid down (the pack was replaced or edited by hand). A pack with no origin is sent as the publisher's own files, and the reason is empty when the sidecar never recorded one.
type Pack ¶
Pack is one shipped pack as the publish confirmation names it: its name and, when it was laid down from a stored pack, the origin. A pack with no origin is the publisher's own files.