thea

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

internal/thea/client.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	ID                string   `json:"id"`
	FileExtension     string   `json:"fileExtension"`
	Title             string   `json:"title"`
	ArtifactVersion   string   `json:"artifactVersion"`
	Summary           string   `json:"summary"`
	UsageGuidance     []string `json:"usageGuidance,omitempty"`
	Owner             string   `json:"owner,omitempty"`
	CreatedDate       string   `json:"createdDate,omitempty"`
	LastModifiedDate  string   `json:"lastModifiedDate,omitempty"`
	DefaultTargetPath string   `json:"defaultTargetPath,omitempty"`
	Tags              []string `json:"tags,omitempty"`
}

Artifact represents a single artifact entry in the manifest.

type Client

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

Client provides methods to interact with the THEA framework (e.g., fetching manifests and artifacts).

func NewClient

func NewClient(_ context.Context, cfg *THEAServiceConfig, logger *slog.Logger) (*Client, error)

NewClient creates a new THEA client. The context here is primarily for future use if any initial setup needs it; individual methods like FetchArtifactContent will also take a context.

func (*Client) FetchArtifactContentByID

func (c *Client) FetchArtifactContentByID(
	ctx context.Context,
	id string,
	artifactVersionHint string,
) (string, error)

FetchArtifactContentByID fetches the content of a specific artifact version. If version is empty, it might fetch the one specified in the manifest or use DefaultArtifactRef.

func (*Client) LoadManifest

func (c *Client) LoadManifest(ctx context.Context) (*Manifest, error)

LoadManifest retrieves the THEA manifest, using a cache if available and valid. For MVP, it might just always fetch.

type Manifest

type Manifest struct {
	ManifestSchemaVersion       string     `json:"manifestSchemaVersion"`
	THEAFrameworkReleaseVersion string     `json:"theaFrameworkReleaseVersion"`
	LastUpdated                 string     `json:"lastUpdated"` // ISO 8601 timestamp
	Artifacts                   []Artifact `json:"artifacts"`
}

Manifest represents the structure of the thea-manifest.json file.

func (*Manifest) GetArtifactByID

func (m *Manifest) GetArtifactByID(id string) (*Artifact, error)

GetArtifactMetadata finds an artifact in the loaded manifest by ID. It does not consider version yet for simplicity in this example, but should.

type THEAServiceConfig

type THEAServiceConfig struct {
	ManifestURL        string        // Full URL to the thea-manifest.json
	DefaultArtifactRef string        // e.g., "main" or a specific release tag like "v0.7.0"
	RawContentBaseURL  string        // e.g., "https://raw.githubusercontent.com/contextvibes/THEA" (without ref)
	CacheDir           string        // Directory for caching manifests/artifacts (e.g., ~/.contextvibes/cache/thea)
	CacheTTL           time.Duration // Time-to-live for cached items
	RequestTimeout     time.Duration // Timeout for HTTP requests
}

THEAServiceConfig contains configuration specific to the THEA client. This would be part of your main AppConfig.LoadedAppConfig.THEA.ServiceConfig or similar.

Jump to

Keyboard shortcuts

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