actioncontracts

package
v1.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package actioncontracts builds portable, report-only proposed Action Contract envelopes from a completed saved Wrkr scan. It does not rescan, score, invoke a network service, or change saved state.

Index

Constants

View Source
const (
	SchemaID      = "https://wrkr.dev/schemas/v1/proposed-action-contract-artifact.schema.json"
	SchemaVersion = "1"
	Producer      = "wrkr"
)

Variables

This section is empty.

Functions

func BuildPacket

func BuildPacket(snapshot state.Snapshot, options BuildOptions) (report.ActionContractPacket, error)

BuildPacket builds the buyer projection from the exact normalized portable artifact selected for export. Packet rendering never rebuilds or rescans the proposed contract independently from the artifact path.

func Filename

func Filename(artifact Artifact) string

func VerifyArtifact

func VerifyArtifact(artifact Artifact) error

VerifyArtifact validates the portable identity and embedded immutable contract before cross-product consumers receive the bytes.

func Write

func Write(collection Collection, outputDir string) ([]string, error)

Write writes new artifact files and a collection manifest atomically. It never overwrites an existing target and rejects a symlink output directory.

Types

type Artifact

type Artifact struct {
	SchemaID               string                      `json:"schema_id"`
	SchemaVersion          string                      `json:"schema_version"`
	ArtifactID             string                      `json:"artifact_id"`
	ContractID             string                      `json:"contract_id"`
	ContractFamilyID       string                      `json:"contract_family_id"`
	Revision               int                         `json:"revision"`
	Producer               ProducerMetadata            `json:"producer"`
	SourceScanRefs         []string                    `json:"source_scan_refs"`
	CompositionRefs        []string                    `json:"composition_refs"`
	ResolutionKey          string                      `json:"resolution_key,omitempty"`
	CreationEvidence       []string                    `json:"creation_evidence"`
	CanonicalContentDigest string                      `json:"canonical_content_digest"`
	Variant                VariantMetadata             `json:"variant"`
	ReportOnly             bool                        `json:"report_only"`
	Contract               risk.ProposedActionContract `json:"contract"`
}

Artifact deliberately has no creation timestamp. Presentation time belongs in the CLI manifest, never in the JCS content identity.

type BuildOptions

type BuildOptions struct {
	ShareProfile report.ShareProfile
	ContractID   string
}

type Collection

type Collection struct {
	SchemaID      string         `json:"schema_id"`
	SchemaVersion string         `json:"schema_version"`
	ShareProfile  string         `json:"share_profile"`
	Artifacts     []Artifact     `json:"artifacts"`
	Manifest      []ManifestItem `json:"manifest"`
}

func Build

func Build(snapshot state.Snapshot, options BuildOptions) (Collection, error)

type ManifestItem

type ManifestItem struct {
	ArtifactID             string `json:"artifact_id"`
	ContractID             string `json:"contract_id"`
	CanonicalContentDigest string `json:"canonical_content_digest"`
	Filename               string `json:"filename"`
}

type ProducerMetadata

type ProducerMetadata struct {
	Name                  string `json:"name"`
	ArtifactSchemaVersion string `json:"artifact_schema_version"`
	ContractSchemaVersion string `json:"contract_schema_version"`
}

type VariantMetadata

type VariantMetadata struct {
	ShareProfile string `json:"share_profile"`
	Redacted     bool   `json:"redacted"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL