artifactadapter

package
v0.2.19 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DiagnosticCodeArtifactInvalid           = "workspace.artifact.invalid"
	DiagnosticCodeContextInvalidContent     = "workspace.context.invalid-content"
	DiagnosticCodeContextInvalidUTF8        = "workspace.context.invalid-utf8"
	DiagnosticCodeDefinitionInvalid         = "workspace.definition.invalid"
	DiagnosticCodeArtifactSchemaUnsupported = "workspace.artifact.schema-unsupported"
	DiagnosticCodeArtifactKindMismatch      = "workspace.artifact.kind-mismatch"
	DiagnosticCodeProjectionInvalid         = "workspace.projection.invalid"
	DiagnosticCodeArtifactUnavailable       = "workspace.artifact.unavailable"
	DiagnosticCodeArtifactUnresolved        = "workspace.artifact.unresolved"
	DiagnosticCodeRuntimeDenied             = "workspace.runtime.denied"
	DiagnosticCodeRuntimeUnavailable        = "workspace.runtime.unavailable"
	DiagnosticCodeCatalogStale              = "workspace.catalog.stale"
	DiagnosticCodeCatalogDecoderStale       = "workspace.catalog.decoder-stale"
	DiagnosticCodeCatalogPolicyStale        = "workspace.catalog.policy-stale"
	DiagnosticCodeSkillInvalid              = "workspace.skill.invalid"
)

Variables

This section is empty.

Functions

func ArtifactRuntimeDisabled

func ArtifactRuntimeDisabled(value artifact.Artifact) (bool, error)

func DecodeArtifactData

func DecodeArtifactData(
	raw json.RawMessage,
) (spec.ArtifactData, error)

func EncodeArtifactData

func EncodeArtifactData(
	value spec.ArtifactData,
) (json.RawMessage, error)

func RuntimeDecisionDiagnostic

func RuntimeDecisionDiagnostic(
	decision RuntimeDecision,
	value artifact.Artifact,
) diagnostic.Diagnostic

func WorkspaceArtifactDiagnostics

func WorkspaceArtifactDiagnostics(
	locator basespec.Locator,
	code string,
	message string,
) []diagnostic.Diagnostic

func WorkspaceArtifactErrorDiagnostics

func WorkspaceArtifactErrorDiagnostics(
	locator basespec.Locator,
	err error,
) []diagnostic.Diagnostic

Types

type ArtifactPolicy

type ArtifactPolicy struct {
	// contains filtered or unexported fields
}

func NewArtifactPolicy

func NewArtifactPolicy(
	ids artifact.ArtifactIDProvider,
	supports ...spec.ArtifactSupport,
) (*ArtifactPolicy, error)

func (*ArtifactPolicy) Derive

func (*ArtifactPolicy) Supports

func (p *ArtifactPolicy) Supports(
	kind basespec.ArtifactKind,
) bool

type ArtifactRuntimePolicy

type ArtifactRuntimePolicy struct{}

ArtifactRuntimePolicy is the default local Workspace trust boundary.

Discovery and management remain available. Runtime use is enabled by default unless the Artifact-local RuntimeDisabled flag explicitly disables it.

func NewArtifactRuntimePolicy

func NewArtifactRuntimePolicy() *ArtifactRuntimePolicy

func (*ArtifactRuntimePolicy) Decide

type QueryService

type QueryService struct {
	// contains filtered or unexported fields
}

func NewQueryService

func NewQueryService(
	workspaces *Service,
	catalogs catalogSnapshotReader,
	artifacts artifactLookup,
	decoderFingerprint func() (cryptoutil.Digest, error),
	discoveryPolicyRevision string,
	supports ...spec.ArtifactSupport,
) (*QueryService, error)

func (*QueryService) Catalog

func (q *QueryService) Catalog(
	ctx context.Context,
	workspace collection.CollectionRef,
) (spec.CatalogView, error)

func (*QueryService) ComposeLoadPlan

func (q *QueryService) ComposeLoadPlan(
	ctx context.Context,
	workspace collection.CollectionRef,
	artifactRefs []artifact.ArtifactRef,
) (spec.LoadPlan, error)

func (*QueryService) GetWorkspace

func (q *QueryService) GetWorkspace(
	ctx context.Context,
	workspace collection.CollectionRef,
) (spec.Workspace, error)

func (*QueryService) Resolve

func (q *QueryService) Resolve(
	ctx context.Context,
	workspace collection.CollectionRef,
	reference spec.Reference,
) (spec.Resource, error)

func (*QueryService) ResolveArtifact

func (q *QueryService) ResolveArtifact(
	ctx context.Context,
	ref artifact.ArtifactRef,
) (spec.Workspace, spec.Resource, error)

type RuntimeDecision

type RuntimeDecision struct {
	Disposition RuntimeDisposition
	Code        string
	Message     string
}

func (RuntimeDecision) Validate

func (d RuntimeDecision) Validate() error

type RuntimeDisposition

type RuntimeDisposition string
const (
	RuntimeAllowed     RuntimeDisposition = "allowed"
	RuntimeDenied      RuntimeDisposition = "denied"
	RuntimeUnavailable RuntimeDisposition = "unavailable"
)

type RuntimePolicyRequest

type RuntimePolicyRequest struct {
	Use              RuntimeUse
	Workspace        spec.Workspace
	Artifact         artifact.Artifact
	DefinitionDigest cryptoutil.Digest
	SourceID         basespec.SourceID
}

type RuntimeUse

type RuntimeUse string
const (
	RuntimeUseContextPrompt RuntimeUse = "context-prompt"
	RuntimeUseSkill         RuntimeUse = "skill"
)

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(
	collections workspaceCollectionStore,
	sources sourceSummaryLookup,
	discoveryPolicyRevision string,
	workspaceRootID basespec.RootID,
	rootPolicy protection.RootPolicy,
) (*Service, error)

func (*Service) Attach

func (s *Service) Attach(
	ctx context.Context,
	request spec.AttachRequest,
) (spec.Workspace, error)

func (*Service) CreateEmpty

func (s *Service) CreateEmpty(
	ctx context.Context,
	request spec.EmptyWorkspaceRequest,
) (spec.Workspace, error)

func (*Service) CreateFilesystem

func (s *Service) CreateFilesystem(
	ctx context.Context,
	request spec.FilesystemWorkspaceRequest,
) (spec.Workspace, error)

func (*Service) Detach

func (s *Service) Detach(
	ctx context.Context,
	ref collection.CollectionRef,
	sourceID basespec.SourceID,
	expectedCollectionRevision uint64,
	expectedAttachmentRevision uint64,
) (spec.Workspace, error)

func (*Service) Get

func (*Service) List

func (s *Service) List(
	ctx context.Context,
	rootID basespec.RootID,
) ([]spec.Workspace, error)

func (*Service) PrepareRefresh

func (s *Service) PrepareRefresh(
	ctx context.Context,
	ref collection.CollectionRef,
) (spec.Workspace, error)

PrepareRefresh converges the local policy revision before planning a publication. A policy revision is local metadata, so a user-triggered refresh is the appropriate point to persist an implementation upgrade.

func (*Service) Purge

func (s *Service) Purge(
	ctx context.Context,
	ref collection.CollectionRef,
	expectedRevision uint64,
) error

Purge destructively removes a retired Workspace Collection and its Collection-scoped metadata. It deliberately verifies the persisted kind before delegating to generic Collection persistence, so Workspace APIs cannot purge another domain's retired Collection.

func (*Service) ReplacePrimary

func (s *Service) ReplacePrimary(
	ctx context.Context,
	request spec.ReplacePrimaryRequest,
) (spec.Workspace, error)

func (*Service) Retire

func (s *Service) Retire(
	ctx context.Context,
	ref collection.CollectionRef,
	expectedRevision uint64,
) (collection.Collection, error)

func (*Service) SetPrimary

func (s *Service) SetPrimary(
	ctx context.Context,
	request spec.SetPrimaryRequest,
) (spec.Workspace, error)

SetPrimary explicitly transitions a Workspace between empty and filesystem modes, or replaces its existing primary Source. Generic attachment APIs intentionally cannot mutate the primary relationship.

func (*Service) Update

func (s *Service) Update(
	ctx context.Context,
	request spec.UpdateRequest,
) (spec.Workspace, error)

func (*Service) UpdateAttachment

func (s *Service) UpdateAttachment(
	ctx context.Context,
	request spec.UpdateAttachmentRequest,
) (spec.Workspace, error)

func (*Service) ValidateFilesystemCreate added in v0.2.14

func (s *Service) ValidateFilesystemCreate(
	request spec.FilesystemWorkspaceRequest,
) error

ValidateFilesystemCreate validates all Workspace-owned creation inputs that can be checked before provisioning a filesystem Source.

type SourceUsePolicy

type SourceUsePolicy interface {
	Decide(
		ctx context.Context,
		request RuntimePolicyRequest,
	) RuntimeDecision
}

Jump to

Keyboard shortcuts

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