Internal

internal/app/specsource

Package specsource loads exact Markdown source for agent-facing commands.

import "github.com/nilstate/scafld/v2/internal/app/specsource"

Package specsource loads exact Markdown source for agent-facing commands.

Variables

ErrChanged is returned when the canonical Markdown changes while a provider packet is being assembled. The caller must discard the packet and start from a new source snapshot.

Source: internal/app/specsource/specsource.go:21

var ErrChanged = errors.New("spec source changed during operation")

ErrUnavailable is returned when a spec store cannot provide source Markdown.

Source: internal/app/specsource/specsource.go:16

var ErrUnavailable = errors.New("spec source markdown unavailable")

Functions

func Load(ctx context.Context, store any, taskID string) (spec.Source, error)

Source: internal/app/specsource/specsource.go:30

Load returns the exact Markdown source for taskID.

func MarkdownDigest(source spec.Source) string

Source: internal/app/specsource/specsource.go:52

MarkdownDigest returns the digest of the exact canonical Markdown bytes. This is deliberately separate from spec.ContractDigest: lifecycle evidence can be projected from the ledger without changing the source contract, but a provider packet must never silently use an older source snapshot.

func ReloadUnchanged(ctx context.Context, store any, prior spec.Source) (spec.Source, error)

Source: internal/app/specsource/specsource.go:59

ReloadUnchanged reloads the canonical source and verifies that its path and exact bytes still match the snapshot used to assemble an agent packet.

Types

type Loader

Source: internal/app/specsource/specsource.go:25

Loader is implemented by stores that can return the parsed spec and its exact Markdown source in one operation.

type Loader interface {
	LoadSource(context.Context, string) (spec.Source, error)
}
Methods
  • LoadSource func(context.Context, string) (spec.Source, error)