Documentation
¶
Index ¶
- Variables
- func ApplySharedFactoryStarterWork(factoryDir string, cfg *interfaces.FactoryConfig) error
- func ApplySupportedPortableBundledFiles(factoryDir string, cfg *interfaces.FactoryConfig, includeInlineContent bool) error
- func CloneFactoryConfig(cfg *interfaces.FactoryConfig) (*interfaces.FactoryConfig, error)
- func CloneWorkerConfig(def interfaces.WorkerConfig) interfaces.WorkerConfig
- func CloneWorkstationConfig(def interfaces.FactoryWorkstationConfig) interfaces.FactoryWorkstationConfig
- func DeleteNamedFactory(rootDir, name string) error
- func ExpandFactoryConfigLayout(path string) (string, error)
- func FactoryConfigFromOpenAPI(apiCfg factoryapi.Factory) (interfaces.FactoryConfig, error)
- func FactoryConfigFromOpenAPIJSON(data []byte) (*interfaces.FactoryConfig, error)
- func FactoryConfigToOpenAPI(cfg *interfaces.FactoryConfig) factoryapi.Factory
- func FactoryConfigWithRuntimeDefinitions(cfg *interfaces.FactoryConfig, runtimeCfg interfaces.RuntimeDefinitionLookup) (*interfaces.FactoryConfig, error)
- func FlattenFactoryConfig(path string) ([]byte, error)
- func GeneratedFactoryFromOpenAPIJSON(data []byte) (factoryapi.Factory, error)
- func InlineRuntimeDefinitions(factoryDir string, cfg *interfaces.FactoryConfig, ...) (*interfaces.FactoryConfig, error)
- func LoadWorkerConfig(dir string) (*interfaces.WorkerConfig, error)
- func LoadWorkstationConfig(dir string) (*interfaces.FactoryWorkstationConfig, error)
- func MarshalCanonicalFactoryConfig(cfg *interfaces.FactoryConfig) ([]byte, error)
- func NormalizeWorkstationExecutionLimit(cfg *interfaces.FactoryWorkstationConfig)
- func PersistNamedFactory(rootDir, name string, canonicalFactoryJSON []byte) (string, error)
- func PersistNamedFactoryWithPrepared(rootDir, name string, prepared *PreparedFactoryLayoutPayload) (string, error)
- func ReadCurrentFactoryPointer(rootDir string) (string, error)
- func ReplaceFactoryLayoutAtDir(targetDir string, payload []byte, opts FactoryLayoutReplaceOptions) (restore func(), err error)
- func ReplaceFactoryLayoutAtDirWithAfterStageHook(targetDir string, payload []byte, opts FactoryLayoutReplaceOptions, ...) (restore func(), err error)
- func ReplaceNamedFactory(rootDir, name string, canonicalFactoryJSON []byte) (string, error)
- func ResolveCurrentFactoryDir(rootDir string) (string, error)
- func ResolveNamedFactoryDir(rootDir, name string) (string, error)
- func ValidateNamedFactoryName(name string) error
- func WorkerConfigFromOpenAPI(worker factoryapi.Worker) (interfaces.WorkerConfig, error)
- func WorkerConfigToOpenAPI(worker interfaces.WorkerConfig) factoryapi.Worker
- func WorkstationConfigFromOpenAPI(workstation factoryapi.Workstation) (interfaces.FactoryWorkstationConfig, error)
- func WorkstationConfigToOpenAPI(workstation interfaces.FactoryWorkstationConfig) factoryapi.Workstation
- func WorkstationExecutionTimeout(cfg *interfaces.FactoryWorkstationConfig) (time.Duration, error)
- func WriteCurrentFactoryPointer(rootDir, name string) error
- type ConfigMapper
- type ConfigValidator
- type ConfigValidatorOption
- type FactoryConfigMapper
- type FactoryLayoutReplaceOptions
- type FactorySplitLayoutReplaceResult
- func ReplaceFactoryLayoutAtDirWithPreparedWithResult(targetDir string, prepared *PreparedFactoryLayoutPayload, ...) (*FactorySplitLayoutReplaceResult, error)
- func ReplaceFactoryLayoutAtDirWithResult(targetDir string, payload []byte, opts FactoryLayoutReplaceOptions) (*FactorySplitLayoutReplaceResult, error)
- func ReplaceFactorySplitLayout(targetDir string, canonicalFactoryJSON []byte) (*FactorySplitLayoutReplaceResult, error)
- func ReplaceFactorySplitLayoutWithAfterStageHook(targetDir string, canonicalFactoryJSON []byte, ...) (*FactorySplitLayoutReplaceResult, error)
- type FactorySplitLayoutWriteOptions
- type Finding
- type InlineRuntimeDefinitionOptions
- type LayoutExpansionReport
- type LoadedFactoryConfig
- func LoadFromCanonicalJSON(payload []byte, workstationLoader WorkstationLoader) (*LoadedFactoryConfig, error)
- func LoadFromFactoryDir(factoryDir string, workstationLoader WorkstationLoader) (*LoadedFactoryConfig, error)
- func LoadRuntimeConfig(factoryDir string, workstationLoader WorkstationLoader) (*LoadedFactoryConfig, error)
- func LoadRuntimeConfigFromFactoryDir(factoryDir string, workstationLoader WorkstationLoader) (*LoadedFactoryConfig, error)
- func NewLoadedFactoryConfig(factoryDir string, factoryCfg *interfaces.FactoryConfig, ...) (*LoadedFactoryConfig, error)
- func (c *LoadedFactoryConfig) FactoryConfig() *interfaces.FactoryConfig
- func (c *LoadedFactoryConfig) FactoryDir() string
- func (c *LoadedFactoryConfig) PortableBundledFileReplacements() []PortableBundledFileReplacement
- func (c *LoadedFactoryConfig) RuntimeBaseDir() string
- func (c *LoadedFactoryConfig) SetRuntimeBaseDir(dir string)
- func (c *LoadedFactoryConfig) Worker(name string) (*interfaces.WorkerConfig, bool)
- func (c *LoadedFactoryConfig) Workstation(name string) (*interfaces.FactoryWorkstationConfig, bool)
- func (c *LoadedFactoryConfig) WorkstationConfigs() map[string]*interfaces.FactoryWorkstationConfig
- type MockWorkInputSelector
- type MockWorkerConfig
- type MockWorkerRejectConfig
- type MockWorkerRunType
- type MockWorkerScriptConfig
- type MockWorkersConfig
- type NamedFactoryListEntry
- type NamedFactoryPersistResult
- func PersistNamedFactoryWithPreparedReport(rootDir, name string, prepared *PreparedFactoryLayoutPayload) (*NamedFactoryPersistResult, error)
- func PersistNamedFactoryWithReport(rootDir, name string, canonicalFactoryJSON []byte) (*NamedFactoryPersistResult, error)
- func ReplaceNamedFactoryWithReport(rootDir, name string, canonicalFactoryJSON []byte) (*NamedFactoryPersistResult, error)
- type PortableBundledFileReplacement
- type PreparedFactoryLayoutPayload
- type RequiredToolCheckResult
- type RequiredToolChecker
- type RequiredToolFailureKind
- type Severity
- type ValidationResult
- type WorkstationLoader
Constants ¶
This section is empty.
Variables ¶
var ErrFactoryLayoutNotFound = errors.New("factory layout not found")
ErrFactoryLayoutNotFound reports that a directory does not contain either a legacy single-factory layout or a named-factory current-pointer layout.
var ErrInvalidNamedFactory = errors.New("invalid named factory")
ErrInvalidNamedFactory reports that the submitted named-factory payload could not be normalized into a runnable named-factory layout.
var ErrNamedFactoryAlreadyExists = errors.New("named factory already exists")
ErrNamedFactoryAlreadyExists reports that the requested named-factory target already exists on disk.
var ErrNamedFactoryIsCurrent = errors.New("cannot delete current factory")
ErrNamedFactoryIsCurrent reports that a named factory cannot be deleted because it is selected by .current-factory.
Functions ¶
func ApplySharedFactoryStarterWork ¶ added in v0.0.5
func ApplySharedFactoryStarterWork(factoryDir string, cfg *interfaces.FactoryConfig) error
ApplySharedFactoryStarterWork snapshots eligible inputs/ files into the portability manifest as INPUT bundled files so share/export payloads carry starter work without live links back to the source factory.
func ApplySupportedPortableBundledFiles ¶ added in v0.0.3
func ApplySupportedPortableBundledFiles(factoryDir string, cfg *interfaces.FactoryConfig, includeInlineContent bool) error
ApplySupportedPortableBundledFiles merges supported portable bundled files discovered on disk into cfg, optionally inlining file content for API/export callers that need a self-contained manifest.
func CloneFactoryConfig ¶
func CloneFactoryConfig(cfg *interfaces.FactoryConfig) (*interfaces.FactoryConfig, error)
CloneFactoryConfig deep-copies a factory config through explicit field copies.
func CloneWorkerConfig ¶
func CloneWorkerConfig(def interfaces.WorkerConfig) interfaces.WorkerConfig
CloneWorkerConfig returns a copy of a worker runtime definition.
func CloneWorkstationConfig ¶
func CloneWorkstationConfig(def interfaces.FactoryWorkstationConfig) interfaces.FactoryWorkstationConfig
CloneWorkstationConfig returns a copy of a workstation runtime definition.
func DeleteNamedFactory ¶ added in v0.0.5
DeleteNamedFactory removes a persisted named factory directory under rootDir. It refuses to delete the factory referenced by .current-factory.
func ExpandFactoryConfigLayout ¶
ExpandFactoryConfigLayout writes a split factory directory layout from a canonical factory.json file and returns the directory that received the files.
func FactoryConfigFromOpenAPI ¶
func FactoryConfigFromOpenAPI(apiCfg factoryapi.Factory) (interfaces.FactoryConfig, error)
FactoryConfigFromOpenAPI converts the generated OpenAPI factory model into the internal config representation.
func FactoryConfigFromOpenAPIJSON ¶
func FactoryConfigFromOpenAPIJSON(data []byte) (*interfaces.FactoryConfig, error)
FactoryConfigFromOpenAPIJSON converts an OpenAPI-compatible factory JSON payload into the internal config representation used by runtime mappers and tests.
func FactoryConfigToOpenAPI ¶
func FactoryConfigToOpenAPI(cfg *interfaces.FactoryConfig) factoryapi.Factory
FactoryConfigToOpenAPI converts the internal factory config into the generated OpenAPI model without passing through normalized on-disk JSON.
func FactoryConfigWithRuntimeDefinitions ¶
func FactoryConfigWithRuntimeDefinitions(cfg *interfaces.FactoryConfig, runtimeCfg interfaces.RuntimeDefinitionLookup) (*interfaces.FactoryConfig, error)
FactoryConfigWithRuntimeDefinitions returns a copy of cfg with runtime definitions from runtimeCfg embedded into the worker and workstation entries.
func FlattenFactoryConfig ¶
FlattenFactoryConfig reads a factory directory or factory.json file and returns canonical JSON with worker and workstation runtime definitions inlined.
func GeneratedFactoryFromOpenAPIJSON ¶
func GeneratedFactoryFromOpenAPIJSON(data []byte) (factoryapi.Factory, error)
GeneratedFactoryFromOpenAPIJSON converts an OpenAPI-compatible factory JSON payload into the generated Factory boundary model.
func InlineRuntimeDefinitions ¶
func InlineRuntimeDefinitions(factoryDir string, cfg *interfaces.FactoryConfig, opts InlineRuntimeDefinitionOptions) (*interfaces.FactoryConfig, error)
InlineRuntimeDefinitions returns a copy of cfg with any runtime definitions found in workers/<name>/AGENTS.md and workstations/<name>/AGENTS.md embedded into the factory config.
func LoadWorkerConfig ¶
func LoadWorkerConfig(dir string) (*interfaces.WorkerConfig, error)
LoadWorkerConfig loads a worker configuration from the given directory. It reads AGENTS.md, parses YAML frontmatter into WorkerConfig, and sets Body to the remaining markdown content.
func LoadWorkstationConfig ¶
func LoadWorkstationConfig(dir string) (*interfaces.FactoryWorkstationConfig, error)
LoadWorkstationConfig loads a workstation configuration from the given directory. It reads AGENTS.md, parses YAML frontmatter into interfaces.FactoryWorkstationConfig, sets Body to the remaining markdown content, and loads PromptFile if specified.
func MarshalCanonicalFactoryConfig ¶
func MarshalCanonicalFactoryConfig(cfg *interfaces.FactoryConfig) ([]byte, error)
MarshalCanonicalFactoryConfig serializes factory config using camelCase keys across factory/workstation/work structures for deterministic canonical output.
func NormalizeWorkstationExecutionLimit ¶
func NormalizeWorkstationExecutionLimit(cfg *interfaces.FactoryWorkstationConfig)
NormalizeWorkstationExecutionLimit rewrites legacy workstation timeout authoring into the canonical limits.maxExecutionTime field and clears the retired top-level timeout field.
func PersistNamedFactory ¶
PersistNamedFactory materializes a compact canonical factory payload under a named subdirectory rooted at rootDir.
func PersistNamedFactoryWithPrepared ¶ added in v0.0.5
func PersistNamedFactoryWithPrepared(rootDir, name string, prepared *PreparedFactoryLayoutPayload) (string, error)
PersistNamedFactoryWithPrepared materializes a named factory directory from a pre-normalized payload shared by validation and split layout writes.
func ReadCurrentFactoryPointer ¶
ReadCurrentFactoryPointer returns the current named factory selected for the root directory's named-factory layout.
func ReplaceFactoryLayoutAtDir ¶ added in v0.0.5
func ReplaceFactoryLayoutAtDir(targetDir string, payload []byte, opts FactoryLayoutReplaceOptions) (restore func(), err error)
func ReplaceFactoryLayoutAtDirWithAfterStageHook ¶ added in v0.0.5
func ReplaceFactoryLayoutAtDirWithAfterStageHook( targetDir string, payload []byte, opts FactoryLayoutReplaceOptions, afterStageWrite func(stagingDir string) error, ) (restore func(), err error)
ReplaceFactoryLayoutAtDirWithAfterStageHook runs ReplaceFactoryLayoutAtDir and invokes afterStageWrite on the staged directory before validation. It exists for tests that assert validation failures leave the committed target unchanged.
func ReplaceNamedFactory ¶ added in v0.0.5
ReplaceNamedFactory materializes a compact canonical factory payload and atomically replaces an existing named factory directory rooted at rootDir.
func ResolveCurrentFactoryDir ¶
ResolveCurrentFactoryDir returns the directory that should be treated as the active runtime root. A persisted current-pointer layout takes precedence over a legacy single-factory root.
func ResolveNamedFactoryDir ¶
ResolveNamedFactoryDir returns the canonical on-disk directory for a persisted named factory rooted under rootDir.
func ValidateNamedFactoryName ¶
ValidateNamedFactoryName applies the canonical safe directory-segment rules used by the named-factory on-disk layout.
func WorkerConfigFromOpenAPI ¶
func WorkerConfigFromOpenAPI(worker factoryapi.Worker) (interfaces.WorkerConfig, error)
WorkerConfigFromOpenAPI converts a generated OpenAPI worker model into the internal runtime config representation.
func WorkerConfigToOpenAPI ¶
func WorkerConfigToOpenAPI(worker interfaces.WorkerConfig) factoryapi.Worker
WorkerConfigToOpenAPI converts an internal worker config into the generated OpenAPI worker model.
func WorkstationConfigFromOpenAPI ¶
func WorkstationConfigFromOpenAPI(workstation factoryapi.Workstation) (interfaces.FactoryWorkstationConfig, error)
WorkstationConfigFromOpenAPI converts a generated OpenAPI workstation model into the internal config representation.
func WorkstationConfigToOpenAPI ¶
func WorkstationConfigToOpenAPI(workstation interfaces.FactoryWorkstationConfig) factoryapi.Workstation
WorkstationConfigToOpenAPI converts an internal workstation config into the generated OpenAPI model.
func WorkstationExecutionTimeout ¶
func WorkstationExecutionTimeout(cfg *interfaces.FactoryWorkstationConfig) (time.Duration, error)
WorkstationExecutionTimeout resolves the configured workstation execution timeout from the canonical execution limits field.
func WriteCurrentFactoryPointer ¶
WriteCurrentFactoryPointer persists the selected named factory for later restart-time resolution.
Types ¶
type ConfigMapper ¶
type ConfigMapper struct{}
ConfigMapper converts a FactoryConfig into a petri state.
func (*ConfigMapper) Map ¶
func (cm *ConfigMapper) Map(ctx context.Context, cfg *interfaces.FactoryConfig) (*state.Net, error)
type ConfigValidator ¶
type ConfigValidator struct {
// contains filtered or unexported fields
}
ConfigValidator runs all registered validation rules against a factory config.
func NewConfigValidator ¶
func NewConfigValidator(opts ...ConfigValidatorOption) *ConfigValidator
NewConfigValidator creates a ConfigValidator with all built-in validation rules.
func (*ConfigValidator) Validate ¶
func (cv *ConfigValidator) Validate(cfg *interfaces.FactoryConfig) *ValidationResult
Validate runs all rules and returns the aggregated result.
type ConfigValidatorOption ¶
type ConfigValidatorOption func(*ConfigValidator)
ConfigValidatorOption configures optional validation behavior.
func WithRequireDefaultHandlingWorkType ¶ added in v0.0.5
func WithRequireDefaultHandlingWorkType() ConfigValidatorOption
WithRequireDefaultHandlingWorkType enables validation that exactly one work type declares handlingBehavior DEFAULT. Use this for simplified you run --factory flows.
func WithRequiredToolChecker ¶
func WithRequiredToolChecker(checker RequiredToolChecker) ConfigValidatorOption
WithRequiredToolChecker overrides the external required-tool availability checker, primarily for deterministic tests.
type FactoryConfigMapper ¶
type FactoryConfigMapper struct{}
FactoryConfigMapper maps between on-disk factory configuration payloads and canonical in-memory config structures.
func NewFactoryConfigMapper ¶
func NewFactoryConfigMapper() *FactoryConfigMapper
NewFactoryConfigMapper returns the canonical mapper used across config loading and serialization paths.
func (*FactoryConfigMapper) Expand ¶
func (m *FactoryConfigMapper) Expand(data []byte) (*interfaces.FactoryConfig, error)
Expand parses and normalizes a user-provided factory payload into the internal canonical configuration representation.
func (*FactoryConfigMapper) Flatten ¶
func (m *FactoryConfigMapper) Flatten(cfg *interfaces.FactoryConfig) ([]byte, error)
Flatten serializes an internal factory configuration into canonical JSON that is stable for persisted output and downstream tooling.
type FactoryLayoutReplaceOptions ¶ added in v0.0.5
type FactoryLayoutReplaceOptions struct {
LayoutWrite FactorySplitLayoutWriteOptions
}
FactoryLayoutReplaceOptions configures ReplaceFactoryLayoutAtDir.
func DefaultFactoryLayoutReplaceOptions ¶ added in v0.0.5
func DefaultFactoryLayoutReplaceOptions(targetDir string) FactoryLayoutReplaceOptions
DefaultFactoryLayoutReplaceOptions returns persist-from-save layout options for an existing factory directory at targetDir.
type FactorySplitLayoutReplaceResult ¶ added in v0.0.5
type FactorySplitLayoutReplaceResult struct {
Restore func()
DiscardBackup func()
}
FactorySplitLayoutReplaceResult holds rollback and backup-discard callbacks returned by ReplaceFactorySplitLayout after a successful commit.
func ReplaceFactoryLayoutAtDirWithPreparedWithResult ¶ added in v0.0.5
func ReplaceFactoryLayoutAtDirWithPreparedWithResult( targetDir string, prepared *PreparedFactoryLayoutPayload, opts FactoryLayoutReplaceOptions, ) (*FactorySplitLayoutReplaceResult, error)
ReplaceFactoryLayoutAtDirWithPreparedWithResult atomically replaces targetDir using a pre-normalized payload so validation and split layout writes share the same expanded FactoryConfig and canonical factory.json bytes.
func ReplaceFactoryLayoutAtDirWithResult ¶ added in v0.0.5
func ReplaceFactoryLayoutAtDirWithResult(targetDir string, payload []byte, opts FactoryLayoutReplaceOptions) (*FactorySplitLayoutReplaceResult, error)
ReplaceFactoryLayoutAtDir atomically replaces targetDir from payload using normalizeNamedFactoryPayload, staging, writeFactorySplitLayout, LoadRuntimeConfig validation, and an atomic swap. restore reverts to the pre-replace directory tree when downstream activation fails. ReplaceFactoryLayoutAtDirWithResult runs the same pipeline as ReplaceFactoryLayoutAtDir and also returns DiscardBackup for callers that must remove the on-disk backup after successful downstream activation.
func ReplaceFactorySplitLayout ¶ added in v0.0.5
func ReplaceFactorySplitLayout(targetDir string, canonicalFactoryJSON []byte) (*FactorySplitLayoutReplaceResult, error)
ReplaceFactorySplitLayout atomically replaces an existing factory directory at targetDir with a split-layout materialization of canonicalFactoryJSON. Call Restore to reinstate the pre-replace tree when downstream steps fail; call DiscardBackup after successful activation to remove the on-disk backup.
func ReplaceFactorySplitLayoutWithAfterStageHook ¶ added in v0.0.5
func ReplaceFactorySplitLayoutWithAfterStageHook( targetDir string, canonicalFactoryJSON []byte, afterStageWrite func(stagingDir string) error, ) (*FactorySplitLayoutReplaceResult, error)
ReplaceFactorySplitLayoutWithAfterStageHook runs split-layout replace and invokes afterStageWrite on the staged directory before validation. It exists for tests in pkg/config/splitreplacetests that assert validation failures leave disk unchanged.
type FactorySplitLayoutWriteOptions ¶ added in v0.0.5
type FactorySplitLayoutWriteOptions struct {
// SourceDir is the factory directory to copy portable bundled files and
// referenced scripts from during expand. Leave empty for persist-only writes.
SourceDir string
// CopyReferencedScripts copies script files referenced by opted-in workstations
// when SourceDir is set.
CopyReferencedScripts bool
// OverwriteExistingSplitFiles replaces existing workers/ and workstations/
// AGENTS.md and prompt files and prunes stale entity directories.
OverwriteExistingSplitFiles bool
}
FactorySplitLayoutWriteOptions controls how writeFactorySplitLayout materializes split factory directories for expand vs persist-from-save flows.
type Finding ¶
type Finding struct {
Severity Severity
Path string // e.g. "workstations[0].inputs[1]"
Message string // human-readable description
Rule string // identifier like "workstation-input-ref"
}
Finding represents a single validation issue discovered in a factory config.
func CanonicalStructuralFindings ¶ added in v0.0.5
func CanonicalStructuralFindings(cfg *interfaces.FactoryConfig) []Finding
CanonicalStructuralFindings returns structural validation findings for a factory definition through the canonical pkg/factory/validation entrypoint.
type InlineRuntimeDefinitionOptions ¶
type InlineRuntimeDefinitionOptions struct {
RequireSplitDefinitions bool
WorkstationLoader WorkstationLoader
}
InlineRuntimeDefinitionOptions controls how split runtime definition files are resolved when building a self-contained factory config.
type LayoutExpansionReport ¶ added in v0.0.5
type LayoutExpansionReport struct {
FactoryConfigPaths int
WorkerAgentPaths int
WorkstationAgentPaths int
PromptPaths int
BundledReplacements []PortableBundledFileReplacement
}
LayoutExpansionReport describes filesystem paths managed by a split-layout expansion without exposing file contents.
func ExpandFactoryConfigLayoutWithExpansionReport ¶ added in v0.0.5
func ExpandFactoryConfigLayoutWithExpansionReport(path string) (string, LayoutExpansionReport, error)
ExpandFactoryConfigLayoutWithExpansionReport writes a split factory directory layout and reports path counts by category for CLI diagnostics.
type LoadedFactoryConfig ¶
type LoadedFactoryConfig struct {
// contains filtered or unexported fields
}
LoadedFactoryConfig is the effective runtime configuration assembled from factory.json plus any worker/workstation AGENTS.md definitions available on disk.
func LoadFromCanonicalJSON ¶ added in v0.0.5
func LoadFromCanonicalJSON(payload []byte, workstationLoader WorkstationLoader) (*LoadedFactoryConfig, error)
LoadFromCanonicalJSON normalizes canonical factory JSON, expands it to a FactoryConfig, and runs the same blocking load validation used for inline factory directories. It does not require an on-disk factory directory; split worker/workstation AGENTS.md layouts still need LoadFromFactoryDir.
func LoadFromFactoryDir ¶ added in v0.0.5
func LoadFromFactoryDir(factoryDir string, workstationLoader WorkstationLoader) (*LoadedFactoryConfig, error)
LoadFromFactoryDir reads one concrete factory directory without following the current-factory pointer indirection used by workspace roots. Production callers should prefer pkg/config/load.LoadFromFactoryDir; this symbol remains the config-package implementation and backward-compatible alias.
func LoadRuntimeConfig ¶
func LoadRuntimeConfig(factoryDir string, workstationLoader WorkstationLoader) (*LoadedFactoryConfig, error)
LoadRuntimeConfig reads factory.json plus worker/workstation AGENTS.md files into a single runtime configuration object with stable lookup maps.
func LoadRuntimeConfigFromFactoryDir ¶ added in v0.0.5
func LoadRuntimeConfigFromFactoryDir(factoryDir string, workstationLoader WorkstationLoader) (*LoadedFactoryConfig, error)
LoadRuntimeConfigFromFactoryDir delegates to LoadFromFactoryDir.
func NewLoadedFactoryConfig ¶
func NewLoadedFactoryConfig(factoryDir string, factoryCfg *interfaces.FactoryConfig, runtimeCfg interfaces.RuntimeDefinitionLookup) (*LoadedFactoryConfig, error)
NewLoadedFactoryConfig builds the effective runtime configuration from a canonical factory config plus optional runtime-loaded definitions.
func (*LoadedFactoryConfig) FactoryConfig ¶
func (c *LoadedFactoryConfig) FactoryConfig() *interfaces.FactoryConfig
FactoryConfig returns the effective factory config after runtime definitions have been merged onto the canonical topology.
func (*LoadedFactoryConfig) FactoryDir ¶
func (c *LoadedFactoryConfig) FactoryDir() string
FactoryDir returns the source directory used to load the factory config.
func (*LoadedFactoryConfig) PortableBundledFileReplacements ¶ added in v0.0.3
func (c *LoadedFactoryConfig) PortableBundledFileReplacements() []PortableBundledFileReplacement
PortableBundledFileReplacements returns bundled file target paths that were overwritten while materializing inline portable content during runtime load.
func (*LoadedFactoryConfig) RuntimeBaseDir ¶
func (c *LoadedFactoryConfig) RuntimeBaseDir() string
RuntimeBaseDir returns the directory used to resolve relative runtime paths such as workstation workingDirectory values. It defaults to the loaded factory directory when no explicit runtime override is set.
func (*LoadedFactoryConfig) SetRuntimeBaseDir ¶
func (c *LoadedFactoryConfig) SetRuntimeBaseDir(dir string)
SetRuntimeBaseDir overrides the directory used to resolve relative runtime execution paths without changing the authored factory source directory.
func (*LoadedFactoryConfig) Worker ¶
func (c *LoadedFactoryConfig) Worker(name string) (*interfaces.WorkerConfig, bool)
Worker returns the loaded worker definition for the given configured worker name.
func (*LoadedFactoryConfig) Workstation ¶
func (c *LoadedFactoryConfig) Workstation(name string) (*interfaces.FactoryWorkstationConfig, bool)
Workstation returns the canonical loaded workstation entry for the given configured workstation name.
func (*LoadedFactoryConfig) WorkstationConfigs ¶
func (c *LoadedFactoryConfig) WorkstationConfigs() map[string]*interfaces.FactoryWorkstationConfig
WorkstationConfigs returns the effective workstation definitions by name.
type MockWorkInputSelector ¶
type MockWorkInputSelector struct {
WorkID string `json:"workId,omitempty"`
WorkType string `json:"workType,omitempty"`
State string `json:"state,omitempty"`
InputName string `json:"inputName,omitempty"`
TraceID string `json:"traceId,omitempty"`
Channel string `json:"channel,omitempty"`
PayloadHash string `json:"payloadHash,omitempty"`
}
MockWorkInputSelector narrows a mock worker match by consumed work input.
type MockWorkerConfig ¶
type MockWorkerConfig struct {
ID string `json:"id,omitempty"`
WorkerName string `json:"workerName,omitempty"`
WorkstationName string `json:"workstationName,omitempty"`
WorkInputs []MockWorkInputSelector `json:"workInputs,omitempty"`
RunType MockWorkerRunType `json:"runType"`
ScriptConfig *MockWorkerScriptConfig `json:"scriptConfig,omitempty"`
RejectConfig *MockWorkerRejectConfig `json:"rejectConfig,omitempty"`
}
MockWorkerConfig selects a worker dispatch and declares the deterministic behavior to apply at the execution boundary.
func (MockWorkerConfig) Validate ¶
func (c MockWorkerConfig) Validate() error
Validate checks a single mock-worker entry.
type MockWorkerRejectConfig ¶
type MockWorkerRejectConfig struct {
Stdout string `json:"stdout,omitempty"`
Stderr string `json:"stderr,omitempty"`
ExitCode *int `json:"exitCode,omitempty"`
}
MockWorkerRejectConfig declares observable output for a rejected mock result.
type MockWorkerRunType ¶
type MockWorkerRunType string
MockWorkerRunType identifies the deterministic behavior a mock worker entry applies when it matches a worker dispatch.
const ( MockWorkerRunTypeAccept MockWorkerRunType = "accept" MockWorkerRunTypeScript MockWorkerRunType = "script" MockWorkerRunTypeReject MockWorkerRunType = "reject" )
type MockWorkerScriptConfig ¶
type MockWorkerScriptConfig struct {
Command string `json:"command"`
Args []string `json:"args,omitempty"`
Env map[string]string `json:"env,omitempty"`
WorkingDirectory string `json:"workingDirectory,omitempty"`
Stdin string `json:"stdin,omitempty"`
Timeout string `json:"timeout,omitempty"`
}
MockWorkerScriptConfig declares the command a script mock executes through the shared command-runner boundary.
type MockWorkersConfig ¶
type MockWorkersConfig struct {
MockWorkers []MockWorkerConfig `json:"mockWorkers"`
}
MockWorkersConfig is the JSON contract for agent-factory mock-worker runs.
func LoadMockWorkersConfig ¶
func LoadMockWorkersConfig(path string) (*MockWorkersConfig, error)
LoadMockWorkersConfig reads and validates a mock-workers JSON file. An empty path intentionally returns an empty config so CLI callers can enable mock mode without supplying a file.
func NewEmptyMockWorkersConfig ¶
func NewEmptyMockWorkersConfig() *MockWorkersConfig
NewEmptyMockWorkersConfig returns the default mock-worker config used when mock mode is enabled without a config file. With no entries, dispatches fall through to the runtime's default accept behavior.
func ParseMockWorkersConfig ¶
func ParseMockWorkersConfig(data []byte) (*MockWorkersConfig, error)
ParseMockWorkersConfig validates raw JSON into the normalized runtime mock-worker configuration.
func (*MockWorkersConfig) Validate ¶
func (c *MockWorkersConfig) Validate() error
Validate checks that mock-worker entries are complete for their run type.
type NamedFactoryListEntry ¶ added in v0.0.5
type NamedFactoryListEntry struct {
Name string `json:"name"`
FactoryDir string `json:"factoryDirectory"`
Current bool `json:"current"`
}
NamedFactoryListEntry describes one persisted named factory under a factory root.
func ListNamedFactories ¶ added in v0.0.5
func ListNamedFactories(rootDir string) ([]NamedFactoryListEntry, error)
ListNamedFactories discovers persisted named factories by scanning rootDir for subdirectories that contain a valid factory.json layout.
type NamedFactoryPersistResult ¶ added in v0.0.3
type NamedFactoryPersistResult struct {
FactoryDir string
PortableBundledFileReplacements []PortableBundledFileReplacement
}
NamedFactoryPersistResult reports the staged named-factory directory together with any bundled files that were overwritten while restoring inline portable content into the thin persisted layout.
func PersistNamedFactoryWithPreparedReport ¶ added in v0.0.5
func PersistNamedFactoryWithPreparedReport(rootDir, name string, prepared *PreparedFactoryLayoutPayload) (*NamedFactoryPersistResult, error)
PersistNamedFactoryWithPreparedReport is the report variant of PersistNamedFactoryWithPrepared.
func PersistNamedFactoryWithReport ¶ added in v0.0.3
func PersistNamedFactoryWithReport(rootDir, name string, canonicalFactoryJSON []byte) (*NamedFactoryPersistResult, error)
PersistNamedFactoryWithReport materializes a compact canonical factory payload under a named subdirectory rooted at rootDir and reports any differing portable bundled files that were replaced on disk.
func ReplaceNamedFactoryWithReport ¶ added in v0.0.5
func ReplaceNamedFactoryWithReport(rootDir, name string, canonicalFactoryJSON []byte) (*NamedFactoryPersistResult, error)
ReplaceNamedFactoryWithReport is the replacement equivalent of PersistNamedFactoryWithReport. It uses the same staging and validation path as create, then swaps the staged layout into the existing named-factory slot.
type PortableBundledFileReplacement ¶ added in v0.0.3
type PortableBundledFileReplacement struct {
TargetPath string
}
func ExpandFactoryConfigLayoutWithReport ¶ added in v0.0.3
func ExpandFactoryConfigLayoutWithReport(path string) (string, []PortableBundledFileReplacement, error)
ExpandFactoryConfigLayoutWithReport writes a split factory directory layout from a canonical factory.json file and reports any differing portable bundled files that were overwritten during materialization.
type PreparedFactoryLayoutPayload ¶ added in v0.0.5
type PreparedFactoryLayoutPayload struct {
Config *interfaces.FactoryConfig
Canonical []byte
}
PreparedFactoryLayoutPayload holds normalized factory state produced once from submitted JSON for split-layout validation and persist.
func PrepareFactoryLayoutPayload ¶ added in v0.0.5
func PrepareFactoryLayoutPayload(segment string, payload []byte) (*PreparedFactoryLayoutPayload, error)
PrepareFactoryLayoutPayload normalizes factory JSON into expanded config (with inline runtime bodies for split writes) and thin canonical factory.json bytes.
type RequiredToolCheckResult ¶
type RequiredToolCheckResult struct {
ResolvedPath string
FailureKind RequiredToolFailureKind
Err error
}
RequiredToolCheckResult captures the availability result for one declarative required tool entry.
type RequiredToolChecker ¶
type RequiredToolChecker interface {
Check(tool interfaces.RequiredToolConfig) RequiredToolCheckResult
}
RequiredToolChecker validates one required external tool entry without performing any installation or embedding behavior.
type RequiredToolFailureKind ¶
type RequiredToolFailureKind string
RequiredToolFailureKind classifies the canonical source of a required-tool validation failure.
const ( RequiredToolFailureKindNone RequiredToolFailureKind = "" RequiredToolFailureKindMissing RequiredToolFailureKind = "missing" RequiredToolFailureKindVersionProbe RequiredToolFailureKind = "version-probe" )
type ValidationResult ¶
type ValidationResult struct {
Findings []Finding
}
ValidationResult aggregates all findings from a validation pass.
func ValidateRequiredTools ¶
func ValidateRequiredTools(cfg *interfaces.FactoryConfig, checker RequiredToolChecker) *ValidationResult
ValidateRequiredTools runs only the declarative required-tool validation rules. Load boundaries can use this narrower pass without re-running the full topology validator.
func (*ValidationResult) Error ¶
func (vr *ValidationResult) Error() string
Error returns a formatted error string listing all error-severity findings.
func (*ValidationResult) Errors ¶
func (vr *ValidationResult) Errors() []Finding
Errors returns only error-severity findings.
func (*ValidationResult) HasErrors ¶
func (vr *ValidationResult) HasErrors() bool
HasErrors returns true if any finding has error severity.
type WorkstationLoader ¶
type WorkstationLoader interface {
Load(name string) (*interfaces.FactoryWorkstationConfig, error)
}
WorkstationLoader loads workstation definitions by name. Implement this interface in tests to inject workstation configs without requiring AGENTS.md files on disk. Returning (nil, nil) signals no config is available and the caller should use its normal fallback behavior.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package load is the canonical entrypoint for loading and validating factory definitions from on-disk directories or canonical JSON bytes.
|
Package load is the canonical entrypoint for loading and validating factory definitions from on-disk directories or canonical JSON bytes. |
|
Package persist is the canonical entrypoint for persisting factory definitions to disk: named-factory create/replace, split-layout replace, and current-factory pointer read/write.
|
Package persist is the canonical entrypoint for persisting factory definitions to disk: named-factory create/replace, split-layout replace, and current-factory pointer read/write. |