Documentation
¶
Index ¶
- Constants
- Variables
- func DecodeYAML(ctx context.Context, content []byte) (json.RawMessage, error)
- type ArtifactStore
- type AttachSourceRequest
- type AttachedPackagePreferences
- type AttachmentData
- type Catalog
- type CatalogResource
- type CollectionData
- type DiscoveryInput
- type DiscoveryPlanner
- type DiscoveryPreferences
- type DiscoveryRoot
- type DisplayPreferences
- type EmbeddedSourceAttachmentRequest
- type EmptyWorkspaceRequest
- type FilesystemSelectionRequest
- type KindDescriptor
- type LoadPlan
- type LoadPlanItem
- type Option
- func WithArtifactFrontend(frontend artifactstoreSpec.ArtifactFrontend) Option
- func WithDiscoveryPlanner(planner DiscoveryPlanner) Option
- func WithKindDescriptor(descriptor KindDescriptor) Option
- func WithResourceProjector(projector ResourceProjector) Option
- func WithYAMLDecoder(decoder YAMLDecoder) Option
- type ProjectedDocument
- type ProjectedSkill
- type ProjectedSkillArgument
- type ProjectedStructuredDefinition
- type ProjectedWorkspaceDefinition
- type Projection
- type ProjectionDiagnosticError
- type ProjectionInput
- type Reference
- type RefreshResult
- type ResourceProjector
- type RootData
- type RootMode
- type Service
- func (s *Service) AttachSource(ctx context.Context, request AttachSourceRequest) (Workspace, error)
- func (s *Service) Catalog(ctx context.Context, rootID artifactstoreSpec.RootID) (Catalog, error)
- func (s *Service) ComposeLoadPlan(ctx context.Context, rootID artifactstoreSpec.RootID, ...) (LoadPlan, error)
- func (s *Service) CreateEmptyWorkspace(ctx context.Context, request EmptyWorkspaceRequest) (Workspace, error)
- func (s *Service) DetachSource(ctx context.Context, rootID artifactstoreSpec.RootID, ...) (Workspace, error)
- func (s *Service) GetWorkspace(ctx context.Context, rootID artifactstoreSpec.RootID) (Workspace, error)
- func (s *Service) ListWorkspaces(ctx context.Context) ([]Workspace, error)
- func (s *Service) MountEmbeddedSource(ctx context.Context, request EmbeddedSourceAttachmentRequest) (Workspace, error)
- func (s *Service) Project(ctx context.Context, recordID artifactstoreSpec.RecordID) (Projection, error)
- func (s *Service) Refresh(ctx context.Context, rootID artifactstoreSpec.RootID) (RefreshResult, error)
- func (s *Service) ResolveReference(ctx context.Context, rootID artifactstoreSpec.RootID, reference Reference) (CatalogResource, error)
- func (s *Service) SelectFilesystemRoot(ctx context.Context, request FilesystemSelectionRequest) (Workspace, error)
- type Workspace
- type YAMLDecoder
Constants ¶
const ( RootKind artifactstoreSpec.RootKind = "workspace.root" RootDataSchemaID artifactstoreSpec.SchemaID = "workspace.root-data.v1" AttachmentDataSchemaID artifactstoreSpec.SchemaID = "workspace.attachment-data.v1" CollectionKind artifactstoreSpec.CollectionKind = "workspace.collection" CollectionDataSchemaID artifactstoreSpec.SchemaID = "workspace.collection-data.v1" NativeFrontendID artifactstoreSpec.FrontendID = "workspace.native" CapabilityProfileVersion = "1" )
const ( KindWorkspaceDefinition artifactstoreSpec.ArtifactKind = "workspace.definition" KindAgentDefinition artifactstoreSpec.ArtifactKind = "agent.definition" KindSkillDefinition artifactstoreSpec.ArtifactKind = "skill.definition" KindModelDefinition artifactstoreSpec.ArtifactKind = "model.definition" KindMCPServerDefinition artifactstoreSpec.ArtifactKind = "mcp.server.definition" KindToolDefinition artifactstoreSpec.ArtifactKind = "tool.definition" KindInstructionDocument artifactstoreSpec.ArtifactKind = "instruction.document" KindContextDocument artifactstoreSpec.ArtifactKind = "context.document" )
const ( RolePrimary artifactstoreSpec.AttachmentRole = "primary" RoleAttachedPackage artifactstoreSpec.AttachmentRole = "attached-package" RoleBuiltIn artifactstoreSpec.AttachmentRole = "built-in" RoleAppLibrary artifactstoreSpec.AttachmentRole = "app-library" RoleOverlay artifactstoreSpec.AttachmentRole = "overlay" )
Variables ¶
var ( ErrInvalidWorkspace = errors.New("workspace: invalid workspace") ErrNotWorkspace = errors.New("workspace: root is not a workspace") ErrAmbiguousWorkspaceDefinition = errors.New("workspace: multiple workspace definitions") ErrReferenceUnresolved = errors.New("workspace: reference unresolved") )
Functions ¶
func DecodeYAML ¶
DecodeYAML converts the restricted Workspace YAML profile to canonical JSON. Workspace source files are data documents, not executable YAML. Anchors, aliases, tags, and multiple documents are rejected before YAML decoding.
Types ¶
type ArtifactStore ¶
type ArtifactStore interface {
RegisterArtifactFrontend(frontend artifactstoreSpec.ArtifactFrontend) error
RegisterRootKindHook(hook artifactstoreSpec.RootKindHook) error
RegisterCollectionKindHook(hook artifactstoreSpec.CollectionKindHook) error
CreateRoot(ctx context.Context, draft artifactstoreSpec.RootDraft) (artifactstoreSpec.ArtifactRoot, error)
GetRoot(ctx context.Context, rootID artifactstoreSpec.RootID) (artifactstoreSpec.ArtifactRoot, error)
ListRoots(ctx context.Context, includeSoftDeleted bool) ([]artifactstoreSpec.ArtifactRoot, error)
DeleteRoot(
ctx context.Context,
rootID artifactstoreSpec.RootID,
expectedModifiedAt time.Time,
) (artifactstoreSpec.ArtifactRoot, error)
CreateSource(ctx context.Context, draft artifactstoreSpec.SourceDraft) (artifactstoreSpec.ArtifactSource, error)
DeleteSource(
ctx context.Context,
sourceID artifactstoreSpec.SourceID,
expectedModifiedAt time.Time,
) error
AttachSource(
ctx context.Context,
draft artifactstore.RootSourceAttachmentDraft,
) (artifactstoreSpec.RootSourceAttachment, error)
GetRootSourceAttachment(
ctx context.Context,
rootID artifactstoreSpec.RootID,
sourceID artifactstoreSpec.SourceID,
) (artifactstoreSpec.RootSourceAttachment, error)
ListRootSources(
ctx context.Context,
rootID artifactstoreSpec.RootID,
) ([]artifactstoreSpec.RootSourceAttachment, error)
DetachSource(
ctx context.Context,
rootID artifactstoreSpec.RootID,
sourceID artifactstoreSpec.SourceID,
expectedModifiedAt time.Time,
) error
ScanRoot(
ctx context.Context,
rootID artifactstoreSpec.RootID,
plan artifactstoreSpec.ScanPlan,
) (artifactstoreSpec.ScanResult, error)
GetRootCatalogGeneration(
ctx context.Context,
rootID artifactstoreSpec.RootID,
) (artifactstoreSpec.RootCatalogGeneration, error)
ListCatalogResourcesForRoot(
ctx context.Context,
rootID artifactstoreSpec.RootID,
) ([]artifactstoreSpec.CatalogResource, error)
GetDefinitionByDigest(
ctx context.Context,
digest artifactstoreSpec.Digest,
) (artifactstoreSpec.CanonicalDefinition, error)
EnsureBaseCollection(
ctx context.Context,
draft artifactstoreSpec.CollectionDraft,
) (artifactstoreSpec.ArtifactCollection, error)
ListCollections(
ctx context.Context,
rootID artifactstoreSpec.RootID,
includeSoftDeleted bool,
) ([]artifactstoreSpec.ArtifactCollection, error)
ListRecords(
ctx context.Context,
rootID artifactstoreSpec.RootID,
) ([]artifactstoreSpec.ArtifactRecord, error)
GetRecord(
ctx context.Context,
recordID artifactstoreSpec.RecordID,
) (artifactstoreSpec.ArtifactRecord, error)
SyncRecords(
ctx context.Context,
rootID artifactstoreSpec.RootID,
policy artifactstoreSpec.RecordSyncPolicy,
) (artifactstoreSpec.RecordSyncResult, error)
FindCandidates(
ctx context.Context,
rootID artifactstoreSpec.RootID,
selector artifactstoreSpec.ArtifactSelector,
) ([]artifactstoreSpec.DependencyCandidate, error)
BuildDependencyGraph(
ctx context.Context,
recordID artifactstoreSpec.RecordID,
) (artifactstoreSpec.DependencyGraph, error)
}
type AttachSourceRequest ¶
type AttachSourceRequest struct {
RootID artifactstoreSpec.RootID
SourceID artifactstoreSpec.SourceID
Role artifactstoreSpec.AttachmentRole
Priority int
AttachmentData AttachmentData
DiscoverImmediately bool
}
AttachSourceRequest attaches an existing Artifact Store source to a Workspace. Source lifecycle remains owned by Artifact Store.
type AttachedPackagePreferences ¶
type AttachedPackagePreferences struct {
DiscoverRecursively bool `json:"discoverRecursively,omitempty"`
}
type AttachmentData ¶
type Catalog ¶
type Catalog struct {
Workspace Workspace
Generation artifactstoreSpec.RootCatalogGeneration
Resources []CatalogResource
Unrecorded []artifactstoreSpec.CatalogResource
}
type CatalogResource ¶
type CatalogResource struct {
Record artifactstoreSpec.ArtifactRecord
Definition artifactstoreSpec.CanonicalDefinition
Collection *artifactstoreSpec.ArtifactCollection
Occurrence *artifactstoreSpec.CatalogResource
CatalogCurrent bool
}
type CollectionData ¶
type CollectionData struct {
ArtifactKind artifactstoreSpec.ArtifactKind `json:"artifactKind"`
}
type DiscoveryInput ¶
type DiscoveryInput struct {
Workspace Workspace
DefinitionPreferences DiscoveryPreferences
FrontendIDs []artifactstoreSpec.FrontendID
}
type DiscoveryPlanner ¶
type DiscoveryPlanner interface {
BuildBootstrapPlan(ctx context.Context, input DiscoveryInput) (artifactstoreSpec.ScanPlan, error)
BuildExpandedPlan(ctx context.Context, input DiscoveryInput) (artifactstoreSpec.ScanPlan, error)
}
type DiscoveryPreferences ¶
type DiscoveryPreferences struct {
AdditionalLocators []artifactstoreSpec.SourceLocator `json:"additionalLocators,omitempty"`
AdditionalRoots []DiscoveryRoot `json:"additionalRoots,omitempty"`
IncludeReadme bool `json:"includeReadme,omitempty"`
}
type DiscoveryRoot ¶
type DiscoveryRoot struct {
Root artifactstoreSpec.SourceLocator `json:"root"`
Recursive bool `json:"recursive"`
IncludePatterns []string `json:"includePatterns,omitempty"`
}
type DisplayPreferences ¶
type DisplayPreferences struct {
DefaultCategory string `json:"defaultCategory,omitempty"`
}
type EmbeddedSourceAttachmentRequest ¶
type EmbeddedSourceAttachmentRequest struct {
RootID artifactstoreSpec.RootID
DisplayName string
ProviderKey string
RootLocator artifactstoreSpec.SourceLocator
Role artifactstoreSpec.AttachmentRole
Priority int
AttachmentData AttachmentData
DiscoverImmediately bool
}
EmbeddedSourceAttachmentRequest creates an app-local embedded filesystem source and attaches it to an existing Workspace.
type EmptyWorkspaceRequest ¶
type EmptyWorkspaceRequest struct {
DisplayName string
Description string
TrustReference string
Discovery DiscoveryPreferences
DiscoverImmediately bool
}
type KindDescriptor ¶
type KindDescriptor struct {
Kind artifactstoreSpec.ArtifactKind
DefinitionSchemaID artifactstoreSpec.SchemaID
CollectionSlug artifactstoreSpec.CollectionSlug
CollectionDisplayName string
}
type LoadPlan ¶
type LoadPlan struct {
RootID artifactstoreSpec.RootID
Generation artifactstoreSpec.RootCatalogGeneration
Items []LoadPlanItem
Diagnostics []artifactstoreSpec.Diagnostic
}
type LoadPlanItem ¶
type LoadPlanItem struct {
Resource CatalogResource
Projection Projection
Dependency artifactstoreSpec.DependencyGraph
}
type Option ¶
type Option func(*serviceConfig) error
func WithArtifactFrontend ¶
func WithArtifactFrontend(frontend artifactstoreSpec.ArtifactFrontend) Option
func WithDiscoveryPlanner ¶
func WithDiscoveryPlanner(planner DiscoveryPlanner) Option
func WithKindDescriptor ¶
func WithKindDescriptor(descriptor KindDescriptor) Option
func WithResourceProjector ¶
func WithResourceProjector(projector ResourceProjector) Option
func WithYAMLDecoder ¶
func WithYAMLDecoder(decoder YAMLDecoder) Option
type ProjectedDocument ¶
type ProjectedDocument struct {
RecordID artifactstoreSpec.RecordID
DefinitionDigest artifactstoreSpec.Digest
Kind artifactstoreSpec.ArtifactKind
SourceID artifactstoreSpec.SourceID
Locator artifactstoreSpec.SourceLocator
Name string
Markdown string
}
type ProjectedSkill ¶
type ProjectedSkill struct {
RecordID artifactstoreSpec.RecordID
DefinitionDigest artifactstoreSpec.Digest
SourceID artifactstoreSpec.SourceID
Locator artifactstoreSpec.SourceLocator
Name string
DisplayName string
Description string
Insert string
Arguments []ProjectedSkillArgument
Markdown string
Frontmatter json.RawMessage
}
type ProjectedSkillArgument ¶
type ProjectedStructuredDefinition ¶
type ProjectedStructuredDefinition struct {
RecordID artifactstoreSpec.RecordID
DefinitionDigest artifactstoreSpec.Digest
Kind artifactstoreSpec.ArtifactKind
SourceID artifactstoreSpec.SourceID
Locator artifactstoreSpec.SourceLocator
Name string
Definition json.RawMessage
}
ProjectedStructuredDefinition is the default projection for native Workspace artifact kinds whose external domain adapter has not been installed. The original canonical JSON remains available without coupling Workspace to a legacy persistence model.
type ProjectedWorkspaceDefinition ¶
type ProjectedWorkspaceDefinition struct {
RecordID artifactstoreSpec.RecordID
Discovery DiscoveryPreferences
Definition json.RawMessage
}
type Projection ¶
type Projection struct {
Kind artifactstoreSpec.ArtifactKind
RecordID artifactstoreSpec.RecordID
Value any
Diagnostics []artifactstoreSpec.Diagnostic
}
type ProjectionDiagnosticError ¶
type ProjectionDiagnosticError struct {
Kind artifactstoreSpec.ArtifactKind
Diagnostics []artifactstoreSpec.Diagnostic
}
func (*ProjectionDiagnosticError) Error ¶
func (e *ProjectionDiagnosticError) Error() string
func (*ProjectionDiagnosticError) Unwrap ¶
func (e *ProjectionDiagnosticError) Unwrap() error
type ProjectionInput ¶
type ProjectionInput struct {
Workspace Workspace
Record artifactstoreSpec.ArtifactRecord
Definition artifactstoreSpec.CanonicalDefinition
}
type Reference ¶
type Reference struct {
RecordID *artifactstoreSpec.RecordID
Selector *artifactstoreSpec.ArtifactSelector
}
type RefreshResult ¶
type RefreshResult struct {
Workspace Workspace
Bootstrap *artifactstoreSpec.ScanResult
Published artifactstoreSpec.ScanResult
Sync artifactstoreSpec.RecordSyncResult
Catalog Catalog
Diagnostics []artifactstoreSpec.Diagnostic
}
type ResourceProjector ¶
type ResourceProjector interface {
Kind() artifactstoreSpec.ArtifactKind
Project(ctx context.Context, input ProjectionInput) (any, []artifactstoreSpec.Diagnostic)
}
type RootData ¶
type RootData struct {
Mode RootMode `json:"mode"`
PrimarySourceID artifactstoreSpec.SourceID `json:"primarySourceID,omitempty"`
RootTrustReference string `json:"rootTrustReference,omitempty"`
DiscoveryPreferences DiscoveryPreferences `json:"discoveryPreferences"`
AttachedPackagePreferences AttachedPackagePreferences `json:"attachedPackagePreferences"`
CapabilityProfileVersion string `json:"capabilityProfileVersion"`
DisplayPreferences DisplayPreferences `json:"displayPreferences"`
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(store ArtifactStore, options ...Option) (*Service, error)
func (*Service) AttachSource ¶
func (s *Service) AttachSource( ctx context.Context, request AttachSourceRequest, ) (Workspace, error)
AttachSource attaches an existing Artifact Store source to a Workspace. Source configuration and source-kind validation remain Artifact Store responsibilities. Workspace owns only the typed attachment role and data.
func (*Service) ComposeLoadPlan ¶
func (s *Service) ComposeLoadPlan( ctx context.Context, rootID artifactstoreSpec.RootID, recordIDs []artifactstoreSpec.RecordID, ) (LoadPlan, error)
func (*Service) CreateEmptyWorkspace ¶
func (*Service) DetachSource ¶
func (s *Service) DetachSource( ctx context.Context, rootID artifactstoreSpec.RootID, sourceID artifactstoreSpec.SourceID, discoverImmediately bool, ) (Workspace, error)
DetachSource removes only the Workspace root/source relationship. It does not delete the source registration, source catalog, records, or definitions.
func (*Service) GetWorkspace ¶
func (*Service) ListWorkspaces ¶
func (*Service) MountEmbeddedSource ¶
func (s *Service) MountEmbeddedSource( ctx context.Context, request EmbeddedSourceAttachmentRequest, ) (Workspace, error)
MountEmbeddedSource creates an embedded-fs-directory source and attaches it to a Workspace. The provider must already have been registered while the Artifact Store composition was being built.
func (*Service) Project ¶
func (s *Service) Project( ctx context.Context, recordID artifactstoreSpec.RecordID, ) (Projection, error)
func (*Service) Refresh ¶
func (s *Service) Refresh( ctx context.Context, rootID artifactstoreSpec.RootID, ) (RefreshResult, error)
func (*Service) ResolveReference ¶
func (s *Service) ResolveReference( ctx context.Context, rootID artifactstoreSpec.RootID, reference Reference, ) (CatalogResource, error)
func (*Service) SelectFilesystemRoot ¶
type Workspace ¶
type Workspace struct {
Root artifactstoreSpec.ArtifactRoot
Data RootData
Attachments []artifactstoreSpec.RootSourceAttachment
}