artifactbuiltin

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: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MCPHostName    = "FlexiGPT"
	MCPHostVersion = "dev"

	BundleKind basespec.CollectionKind = "mcp.bundle"
	ServerKind basespec.ArtifactKind   = "mcp.server"
	PolicyKind basespec.ArtifactKind   = "mcp.policy"

	BundleSchemaID basespec.SchemaID = "mcp.bundle.v1"
	ServerSchemaID basespec.SchemaID = "mcp.server.v1"
	PolicySchemaID basespec.SchemaID = "mcp.policy.v1"

	MCPBuiltInInstallerName = "mcp.bundle"

	MCPBundleHydrationFingerprintSchemaVersion = "mcp.builtin-hydration/v1"

	MCPSchemaVersion = "v1"

	BundleSchemaURL = "https://schemas.flexigpt.dev/mcp/bundle/v1.json"
	ServerSchemaURL = "https://schemas.flexigpt.dev/mcp/server/v1.json"
	PolicySchemaURL = "https://schemas.flexigpt.dev/mcp/policy/v1.json"

	MCPServerSubresourceDirectory basespec.SubresourceLocator = "mcpServers"
	MCPPolicySubresourceDirectory basespec.SubresourceLocator = "policies"

	DecoderRevision                    = "mcp.bundle.discovery.v1"
	DecoderID       basespec.DecoderID = "mcp.bundle-json"
)
View Source
const (
	SkillCollectionV1Kind          basespec.CollectionKind = "skill.bundle"
	SkillCollectionV1SchemaID      basespec.SchemaID       = "skill.bundle.v1"
	SkillCollectionV1SchemaVersion                         = "v1"
	SkillCollectionV1MemberFormat                          = "agent.skill-entrypoint/v1"
	SkillCollectionV1MemberRole                            = "agent.skill"
)
View Source
const (
	ApplicationDataDirectoryName = "flexigpt"

	SettingsDirectoryName         = "settings_v1"
	ConversationsDirectoryName    = "conversations_v1"
	ModelPresetsDirectoryName     = "model_presets_v1"
	ToolsDirectoryName            = "tools_v1"
	AssistantPresetsDirectoryName = "assistant_presets_v1"
	ArtifactStoreDirectoryName    = "artifacts_v1"

	ApplicationDirectoryMode = 0o700

	ArtifactStoreManifestFileName      = "store.json"
	ArtifactStoreMetadataFileName      = "app.sqlite"
	ArtifactStoreContentDirectoryName  = "content"
	ArtifactStoreStagingDirectoryName  = "staging"
	ArtifactStoreManifestTemporaryName = "store.json.tmp-"

	ArtifactStoreFormat        = "flexigpt-artifactstore/v1"
	ArtifactStoreContentLayout = "semantic-packages/v1"

	ArtifactStoreDirectoryMode = 0o750
	ArtifactStoreManifestMode  = 0o600

	ManagedDirectorySourceKind basespec.SourceKind = "managed-directory"

	ManagedPackageTemporaryPrefix = "package-"
	ManagedPackagePreviousPrefix  = "previous-package-"
	ManagedPackageRemovalPrefix   = "remove-"

	UnversionedPackageVersion basespec.LogicalVersion = "unversioned"

	AgentSkillPackageKind  basespec.PackageKind = "agent.skill"
	SkillBundlePackageKind basespec.PackageKind = "skill.bundle"
	MCPBundlePackageKind   basespec.PackageKind = "mcp.bundle"

	AgentSkillDefinitionFileName basespec.Locator = "SKILL.md"
	SkillCollectionFileName      basespec.Locator = "collection.json"
	MCPBundleDocumentFileName    basespec.Locator = "mcps.json"

	RepositoryRootLocator       basespec.Locator = "."
	WorkspaceDescriptorFileName basespec.Locator = "workspace.json"
	WorkspaceSkillRootLocator   basespec.Locator = "skills"
	WorkspaceMarkdownPattern                     = "*.md"

	WorkspaceAgentsFileName basespec.Locator = "AGENTS.md"
	WorkspaceClaudeFileName basespec.Locator = "CLAUDE.md"
	WorkspaceReadmeFileName basespec.Locator = "README.md"

	EmbeddedSkillRegistryFileName                  = "skill-registry.json"
	EmbeddedMCPRegistryFileName                    = "mcp_artifact_registry.json"
	EmbeddedSkillDataRoot         basespec.Locator = "skills"
	EmbeddedMCPDataRoot           basespec.Locator = "mcps"
	EmbeddedSkillRegistryLocator  basespec.Locator = "skills/skill-registry.json"
	EmbeddedMCPRegistryLocator    basespec.Locator = "mcps/mcp_artifact_registry.json"

	ExternalGitMetadataDirectoryName = ".git"
)
View Source
const (
	BuiltinRootID          basespec.RootID     = "0192c4c0-0000-7000-8000-000000000001"
	BuiltinRootStorageKey  basespec.StorageKey = "builtins"
	BuiltinRootDisplayName                     = "Application Built-ins"
	BuiltinRootDescription                     = "Protected application-provided portable artifact packages."

	BuiltinSourceID          basespec.SourceID   = "0192c4c0-0001-7000-8000-000000000001"
	BuiltinSourceStorageKey  basespec.StorageKey = "catalog"
	BuiltinSourceDisplayName                     = "Application Built-in Packages"

	WorkspaceRootID          basespec.RootID     = "0198f097-0d5b-7000-8000-000000000001"
	WorkspaceRootStorageKey  basespec.StorageKey = "workspaces"
	WorkspaceRootDisplayName                     = "FlexiGPT Workspaces"
	WorkspaceRootDescription                     = "Local namespace for user Workspace collections."

	MCPUserRootID          basespec.RootID     = "0198f097-0d5b-7000-8000-000000000002"
	MCPUserRootStorageKey  basespec.StorageKey = "mcp"
	MCPUserRootDisplayName                     = "FlexiGPT MCP Bundles"
	MCPUserRootDescription                     = "Local namespace for user-managed MCP Bundles."

	DefaultMCPBundleCollectionID basespec.CollectionID = "0198f097-0d5b-7000-8000-000000000020"
	DefaultMCPBundleSourceID     basespec.SourceID     = "0198f097-0d5b-7000-8000-000000000021"
	DefaultMCPBundleSourceKey    basespec.StorageKey   = "base"
	DefaultMCPBundleLogicalName                        = "base"
	DefaultMCPBundleDisplayName                        = "Base MCP Servers"
	DefaultMCPBundleDescription                        = "Editable starter bundle for user-managed MCP server definitions."
)
View Source
const (
	ManagedAttachmentRole basespec.AttachmentRole = "managed"
	BuiltInAttachmentRole basespec.AttachmentRole = "builtin"

	AgentSkillArtifactKind   basespec.ArtifactKind = "agent.skill"
	AgentSkillSchemaID       basespec.SchemaID     = "agent.skill.v1"
	AgentSkillDecoderID      basespec.DecoderID    = "agent.skill-markdown"
	AgentSkillSchemaVersion                        = "v1"
	AgentSkillInsertLabelKey                       = "skill.insert"

	// AgentSkillBuiltInInstallerName is stable across built-in hydration
	// revisions so prior hydration records remain discoverable.
	AgentSkillBuiltInInstallerName = "agent.skill"

	AgentSkillHydrationFingerprintSchemaVersion = "agent.skill.builtin-hydration/v1"

	WorkspaceContextArtifactKind  basespec.ArtifactKind = "workspace.context"
	WorkspaceContextSchemaID      basespec.SchemaID     = "workspace.context.v1"
	WorkspaceContextDecoderID     basespec.DecoderID    = "workspace.context-markdown"
	WorkspaceContextSchemaVersion                       = "v1"
	WorkspaceContextRoleLabelKey                        = "context.role"

	WorkspaceContextRoleAgentInstructions     WorkspaceContextRole = "agent-instructions"
	WorkspaceContextRoleAssistantInstructions WorkspaceContextRole = "assistant-instructions"
	WorkspaceContextRoleProjectReadme         WorkspaceContextRole = "project-readme"
	WorkspaceContextRoleProjectContext        WorkspaceContextRole = "project-context"

	WorkspaceContextMediaTypeMarkdown WorkspaceContextMediaType = "text/markdown"

	WorkspaceContextPreferenceIncludeReadme WorkspaceContextPreference = "include-readme"
)
View Source
const (
	WorkspaceCollectionV1Kind          basespec.CollectionKind = "workspace.collection"
	WorkspaceCollectionV1SchemaID      basespec.SchemaID       = "workspace.collection.v1"
	WorkspaceCollectionV1SchemaVersion                         = "v1"
)

Variables

View Source
var BundleV1JSONSchema []byte
View Source
var PolicyV1JSONSchema []byte
View Source
var ServerV1JSONSchema []byte

Functions

func ApplicationStorageNames

func ApplicationStorageNames() []string

func BuiltinTopologyDeclaration

func BuiltinTopologyDeclaration() topology.Declaration

func CheckCodecContext

func CheckCodecContext(ctx context.Context) error

func EmbeddedMCPPackages

func EmbeddedMCPPackages() (fs.FS, error)

func EmbeddedSkillPackages

func EmbeddedSkillPackages() (fs.FS, error)

func EncodeWorkspaceCollectionV1Body

func EncodeWorkspaceCollectionV1Body(
	value WorkspaceCollectionV1Body,
) (json.RawMessage, error)

func ExternalTraversalExcludedDirectoryNames

func ExternalTraversalExcludedDirectoryNames() []string

func MarshalSkillCollectionV1

func MarshalSkillCollectionV1(value SkillCollectionV1) ([]byte, error)

func MarshalWorkspaceCollectionV1

func MarshalWorkspaceCollectionV1(
	value WorkspaceCollectionV1,
) ([]byte, error)

func ProtectedRootIDs

func ProtectedRootIDs() []basespec.RootID

func ReadEmbeddedMCPRegistry

func ReadEmbeddedMCPRegistry() ([]byte, error)

func ReadEmbeddedSkillRegistry

func ReadEmbeddedSkillRegistry() ([]byte, error)

func RetainedRootDrafts

func RetainedRootDrafts() []root.RootDraft

func RetainedRootIDs

func RetainedRootIDs() []basespec.RootID

func SkillCollectionV1JSONSchema

func SkillCollectionV1JSONSchema() []byte

func ValidateApplicationTopology

func ValidateApplicationTopology() error

func WorkspaceCollectionV1JSONSchema

func WorkspaceCollectionV1JSONSchema() []byte

func WorkspaceSkillRoots

func WorkspaceSkillRoots() []basespec.Locator

Types

type BootstrapRegistry

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

BootstrapRegistry owns application-level built-in installation order and shared topology. It is intentionally unaware of Skills, MCPs, or any other artifact format.

func NewBootstrapRegistry

func NewBootstrapRegistry(
	declaration topology.Declaration,
	ensurer topology.Ensurer,
	hydrator topology.HydrationCoordinator,
) (*BootstrapRegistry, error)

func (*BootstrapRegistry) Ensure

func (r *BootstrapRegistry) Ensure(ctx context.Context) error

func (*BootstrapRegistry) Register

func (r *BootstrapRegistry) Register(installer Installer) error

type ContentRef

type ContentRef struct {
	Locator            string  `json:"locator,omitempty"`
	URI                string  `json:"uri,omitempty"`
	SubresourceLocator string  `json:"subresourceLocator,omitempty"`
	Digest             *string `json:"digest,omitempty"`
	MediaType          string  `json:"mediaType,omitempty"`
	Role               string  `json:"role,omitempty"`
}

func (ContentRef) Clone

func (v ContentRef) Clone() ContentRef

type HydrationInstaller

type HydrationInstaller interface {
	Installer

	DesiredHydration(ctx context.Context) (topology.Hydration, error)

	// EnsureHydration creates or repairs this artifact family's desired
	// topology and package state. It may publish managed Source content.
	EnsureHydration(ctx context.Context, current bool) error

	// FinalizeHydration runs after every hydration installer has completed its
	// package publication. It must reconcile source-derived state, such as
	// catalogs, against the final shared Source generation. It must not mutate
	// managed package content or topology.
	FinalizeHydration(ctx context.Context) error
}

HydrationInstaller supplies artifact-family desired state and receives the result of generic hydration comparison. It does not read or write hydration markers and it does not reset topology roots itself.

type Installer

type Installer interface {
	BuiltInName() string
	BuiltInIDs() []string
	BuiltInPackageScopes() []basespec.Locator
	Ensure(ctx context.Context) error
}

Installer is implemented by one artifact-family-owned built-in installer. The generic built-in layer deliberately does not inspect package contents, artifact definitions, or artifact-specific manifests.

type SkillCollectionV1

type SkillCollectionV1 struct {
	Digest         *string           `json:"digest,omitempty"`
	Kind           string            `json:"kind"`
	SchemaID       string            `json:"schemaID"`
	SchemaVersion  string            `json:"schemaVersion"`
	LogicalName    string            `json:"logicalName"`
	LogicalVersion string            `json:"logicalVersion,omitempty"`
	DisplayName    string            `json:"displayName,omitempty"`
	Description    string            `json:"description,omitempty"`
	Labels         map[string]string `json:"labels,omitempty"`
	Body           json.RawMessage   `json:"body"`
	Members        []ContentRef      `json:"members,omitempty"`
}

SkillCollectionV1 is the public Go wire schema for collection.json.

It intentionally uses ordinary strings and json.RawMessage rather than internal Artifact Store value types. Semantic conversion and validation are supplied by the registered artifact-family codec.

func CanonicalizeSkillCollectionV1

func CanonicalizeSkillCollectionV1(
	input SkillCollectionV1,
) (SkillCollectionV1, error)

CanonicalizeSkillCollectionV1 validates a shareable collection document, deterministically orders its members, calculates its digest, and verifies a supplied digest when one is present.

Member digests intentionally remain optional. They can be supplied by a sharer or enriched later by package hydration when member bytes exist.

func ParseSkillCollectionV1

func ParseSkillCollectionV1(raw []byte) (SkillCollectionV1, error)

ParseSkillCollectionV1 validates structural and semantic input but does not calculate or verify a supplied document digest. Call CanonicalizeSkillCollectionV1 when the digest must be calculated or verified.

func (SkillCollectionV1) Clone

func (SkillCollectionV1) Validate

func (v SkillCollectionV1) Validate() error

Validate accepts both shareable input documents without a digest and canonical documents with a digest. CanonicalizeSkillCollectionV1 additionally calculates and verifies the digest.

func (SkillCollectionV1) ValidateEnvelope

func (v SkillCollectionV1) ValidateEnvelope() error

type WorkspaceCollectionV1

type WorkspaceCollectionV1 struct {
	Digest         *string           `json:"digest,omitempty"`
	Kind           string            `json:"kind"`
	SchemaID       string            `json:"schemaID"`
	SchemaVersion  string            `json:"schemaVersion"`
	LogicalName    string            `json:"logicalName"`
	LogicalVersion string            `json:"logicalVersion,omitempty"`
	DisplayName    string            `json:"displayName,omitempty"`
	Description    string            `json:"description,omitempty"`
	Labels         map[string]string `json:"labels,omitempty"`
	Body           json.RawMessage   `json:"body"`
	Members        []ContentRef      `json:"members,omitempty"`
}

WorkspaceCollectionV1 is the portable workspace.json schema model.

Digest is optional on input. CanonicalizeWorkspaceCollectionV1 always calculates and returns a digest.

func CanonicalizeWorkspaceCollectionV1

func CanonicalizeWorkspaceCollectionV1(
	input WorkspaceCollectionV1,
) (WorkspaceCollectionV1, error)

func ParseWorkspaceCollectionV1

func ParseWorkspaceCollectionV1(
	raw []byte,
) (WorkspaceCollectionV1, error)

func (WorkspaceCollectionV1) Clone

func (WorkspaceCollectionV1) Validate

func (v WorkspaceCollectionV1) Validate() error

type WorkspaceCollectionV1Body

type WorkspaceCollectionV1Body struct {
	Discovery WorkspaceDiscoveryV1 `json:"discovery"`
}

func DecodeWorkspaceCollectionV1Body

func DecodeWorkspaceCollectionV1Body(
	raw json.RawMessage,
) (WorkspaceCollectionV1Body, error)

type WorkspaceContextFileConvention

type WorkspaceContextFileConvention struct {
	FileName         basespec.Locator           `json:"fileName"`
	Role             WorkspaceContextRole       `json:"role"`
	DefaultDiscovery bool                       `json:"defaultDiscovery"`
	Preference       WorkspaceContextPreference `json:"preference,omitempty"`
	RuntimeOrder     int                        `json:"runtimeOrder"`
}

func WorkspaceContextFileConventions

func WorkspaceContextFileConventions() []WorkspaceContextFileConvention

type WorkspaceContextMediaType

type WorkspaceContextMediaType string

type WorkspaceContextPreference

type WorkspaceContextPreference string

type WorkspaceContextRole

type WorkspaceContextRole string

type WorkspaceDirectoryRootV1

type WorkspaceDirectoryRootV1 struct {
	Root            string   `json:"root"`
	Recursive       bool     `json:"recursive,omitempty"`
	IncludePatterns []string `json:"includePatterns,omitempty"`
}

type WorkspaceDiscoveryV1

type WorkspaceDiscoveryV1 struct {
	AdditionalLocators []string                   `json:"additionalLocators,omitempty"`
	AdditionalRoots    []WorkspaceDirectoryRootV1 `json:"additionalRoots,omitempty"`
	IncludeReadme      bool                       `json:"includeReadme,omitempty"`
}

Jump to

Keyboard shortcuts

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