Documentation
¶
Index ¶
- Constants
- func AuthenticateCommandPayloadDescriptor(meta DecodedSchemaMeta, descriptor CommandPayloadDescriptor) error
- func BuildCommandMetaLookup(registry SchemaRegistry) map[string]CommandMeta
- func BuildSchemaProductLocators(registry SchemaRegistry) (map[string]string, error)
- func CloneFieldProvenance(source map[string]contract.FieldProvenance) map[string]contract.FieldProvenance
- func CloneOptionalStrings(values []string) []string
- func Compact(payload map[string]any) map[string]any
- func CompactCollection(value any) any
- func CompactParameter(parameter map[string]any) map[string]any
- func CompactParameters(value any) any
- func CompactValue(value any) any
- func DecodeAllSchemaProducts(shards []byte, meta DecodedSchemaMeta) (SchemaRegistry, SchemaIndex, error)
- func DefaultString(value, fallback string) string
- func EqualJSONValues(left, right []byte) bool
- func MarshalSchemaCacheDeterministic(message proto.Message) ([]byte, error)
- func NormalizeCLIPath(path string) string
- func NormalizeQueryCLIPath(path string) string
- func ParameterProvenanceValue(parameter ParameterSpec, field string) (any, bool)
- func ProductProvenanceValue(product ProductSpec, field string) (any, bool)
- func ProductShardBounds(descriptor ProductDescriptor, total uint64) (int64, int, error)
- func RawJSONValue(raw json.RawMessage) (any, error)
- func RegisterCommandMetaAliases(lookup map[string]CommandMeta, metas []CommandMeta) map[string]CommandMeta
- func RenderAll(registry SchemaRegistry, hashes TrustedHashes) (map[string]any, error)
- func RenderCatalog(registry SchemaRegistry, hashes TrustedHashes) (map[string]any, error)
- func RenderOverview(registry SchemaRegistry, hashes TrustedHashes) (map[string]any, error)
- func RenderQuery(registry SchemaRegistry, index SchemaIndex, raw string) (map[string]any, error)
- func RenderQueryWithProjectors(registry SchemaRegistry, index SchemaIndex, raw string, ...) (map[string]any, error)
- func SortedUniqueStrings(values []string) []string
- func SplitPathTokens(raw string) []string
- func StableUniqueStrings(values []string) []string
- func StampTrustedHashes(payload map[string]any, hashes TrustedHashes)
- func ToolProvenanceValue(tool ToolSpec, field string) (any, bool)
- func ToolUnderGroup(tool ToolSpec, group string) bool
- func TypedJSONValue(value any) (any, error)
- func ValidateFinalFieldProvenance(owner, field string, provenance contract.FieldProvenance, finalValue any) error
- type BuiltSchemaCache
- type CacheHashes
- type CommandIdentity
- type CommandMeta
- type CommandPayloadDescriptor
- type CommandSafety
- type CommandSelection
- type DecodedCommandPayloads
- type DecodedSchemaMeta
- type DecodedSchemaPayloadIndex
- type DecodedSchemaProduct
- type OverviewProduct
- type OverviewSummaryKind
- type ParameterSpec
- type ProductDescriptor
- type ProductSpec
- type QueryProjectors
- type RenderedLeafRef
- type RuntimeToolSpecInput
- type SchemaIndex
- type SchemaOverview
- type SchemaRegistry
- func (r SchemaRegistry) Index() (SchemaIndex, error)
- func (r SchemaRegistry) Sorted() SchemaRegistry
- func (r SchemaRegistry) ToOverviewPayload() (map[string]any, error)
- func (r SchemaRegistry) ToPayload() (map[string]any, error)
- func (r SchemaRegistry) ToSnapshotPayload() (SchemaSnapshotPayload, error)
- type SchemaSnapshotPayload
- type SnapshotProjectors
- type ToolSpec
- type TrustedHashes
- type UnknownPathError
Constants ¶
const ( // SchemaCacheDTOVersion is the independently validated private DTO version. SchemaCacheDTOVersion = 5 MaxSchemaMetaBytes = 4 << 20 MaxSchemaProductBytes = 8 << 20 MaxSchemaShardData = 64<<20 - 208 )
Variables ¶
This section is empty.
Functions ¶
func AuthenticateCommandPayloadDescriptor ¶
func AuthenticateCommandPayloadDescriptor(meta DecodedSchemaMeta, descriptor CommandPayloadDescriptor) error
AuthenticateCommandPayloadDescriptor binds a command payload descriptor to the Meta's authenticated copy.
func BuildCommandMetaLookup ¶
func BuildCommandMetaLookup(registry SchemaRegistry) map[string]CommandMeta
BuildCommandMetaLookup projects primary and compatibility alias paths.
func BuildSchemaProductLocators ¶
func BuildSchemaProductLocators(registry SchemaRegistry) (map[string]string, error)
BuildSchemaProductLocators returns every explicit Registry index locator.
func CloneFieldProvenance ¶
func CloneFieldProvenance(source map[string]contract.FieldProvenance) map[string]contract.FieldProvenance
CloneFieldProvenance defensively copies one provenance map and nested values.
func CloneOptionalStrings ¶
CloneOptionalStrings defensively copies a list while preserving nil versus empty.
func Compact ¶
Compact projects a Schema payload onto the reviewed positive Agent allowlist. Typed result, constraint, positional, pagination, and dry-run values remain verbatim.
func CompactCollection ¶
CompactCollection applies Compact to structural collection members.
func CompactParameter ¶
CompactParameter applies the reviewed parameter allowlist to one parameter.
func CompactParameters ¶
CompactParameters applies the reviewed parameter allowlist.
func CompactValue ¶
CompactValue applies compact projection to a nested plain value.
func DecodeAllSchemaProducts ¶
func DecodeAllSchemaProducts(shards []byte, meta DecodedSchemaMeta) (SchemaRegistry, SchemaIndex, error)
DecodeAllSchemaProducts reconstructs and globally indexes the full Registry.
func DefaultString ¶
DefaultString trims value and returns fallback when it is empty.
func EqualJSONValues ¶
EqualJSONValues compares JSON values using the model's number-preserving semantics.
func MarshalSchemaCacheDeterministic ¶
MarshalSchemaCacheDeterministic is the only production protobuf encoder.
func NormalizeCLIPath ¶
NormalizeCLIPath normalizes authored space-separated CLI paths.
func NormalizeQueryCLIPath ¶
NormalizeQueryCLIPath accepts historical dot/slash/space query spellings.
func ParameterProvenanceValue ¶
func ParameterProvenanceValue(parameter ParameterSpec, field string) (any, bool)
ParameterProvenanceValue returns the delivered ParameterSpec value for a provenance key.
func ProductProvenanceValue ¶
func ProductProvenanceValue(product ProductSpec, field string) (any, bool)
ProductProvenanceValue returns the delivered ProductSpec value for a provenance key.
func ProductShardBounds ¶
func ProductShardBounds(descriptor ProductDescriptor, total uint64) (int64, int, error)
ProductShardBounds validates a descriptor before an offset or allocation is used.
func RawJSONValue ¶
func RawJSONValue(raw json.RawMessage) (any, error)
RawJSONValue decodes one validated polymorphic JSON value.
func RegisterCommandMetaAliases ¶
func RegisterCommandMetaAliases(lookup map[string]CommandMeta, metas []CommandMeta) map[string]CommandMeta
RegisterCommandMetaAliases keeps primary paths authoritative and resolves alias collisions by lexicographically smallest primary path.
func RenderAll ¶
func RenderAll(registry SchemaRegistry, hashes TrustedHashes) (map[string]any, error)
RenderAll projects the complete registry and stamps only trusted hashes.
func RenderCatalog ¶
func RenderCatalog(registry SchemaRegistry, hashes TrustedHashes) (map[string]any, error)
RenderCatalog projects the progressive full catalog and stamps only trusted hashes.
func RenderOverview ¶
func RenderOverview(registry SchemaRegistry, hashes TrustedHashes) (map[string]any, error)
RenderOverview projects the first-hop product view and stamps only trusted hashes.
func RenderQuery ¶
func RenderQuery(registry SchemaRegistry, index SchemaIndex, raw string) (map[string]any, error)
RenderQuery resolves and projects one product, group, or leaf. Query payloads intentionally carry no catalog or surface hashes.
func RenderQueryWithProjectors ¶
func RenderQueryWithProjectors(registry SchemaRegistry, index SchemaIndex, raw string, projectors QueryProjectors) (map[string]any, error)
RenderQueryWithProjectors is RenderQuery with optional pure summary seams.
func SortedUniqueStrings ¶
SortedUniqueStrings exposes the model's sorted normalization.
func SplitPathTokens ¶
SplitPathTokens splits a query on dots, slashes, and whitespace.
func StableUniqueStrings ¶
StableUniqueStrings exposes the model's order-preserving normalization.
func StampTrustedHashes ¶
func StampTrustedHashes(payload map[string]any, hashes TrustedHashes)
StampTrustedHashes stamps trusted release-envelope hashes onto a payload.
func ToolProvenanceValue ¶
ToolProvenanceValue returns the delivered ToolSpec value for a provenance key.
func ToolUnderGroup ¶
ToolUnderGroup reports whether any primary or alias CLI path is below group.
func TypedJSONValue ¶
TypedJSONValue projects a typed value into its plain JSON representation.
func ValidateFinalFieldProvenance ¶
func ValidateFinalFieldProvenance(owner, field string, provenance contract.FieldProvenance, finalValue any) error
ValidateFinalFieldProvenance verifies that provenance selects the delivered value.
Types ¶
type BuiltSchemaCache ¶
type BuiltSchemaCache struct {
Meta []byte
ProductShards []byte
PayloadShards []byte
Descriptors []ProductDescriptor
PayloadDescriptors []CommandPayloadDescriptor
RegistrySHA256 [sha256.Size]byte
RegistryDataSize uint64
PayloadSHA256 [sha256.Size]byte
PayloadDataSize uint64
// The payload file opens with the length-prefixed SchemaPayloadIndex
// region; these pins let the binary authenticate that region without
// reading Meta first. Payload descriptor offsets are relative to the first
// byte after the index region.
PayloadIndexLength uint64
PayloadIndexSHA256 [sha256.Size]byte
}
BuiltSchemaCache is one deterministic Meta payload and its concatenated shards.
func BuildSchemaCache ¶
func BuildSchemaCache(registry SchemaRegistry, lookup map[string]CommandMeta, overview SchemaOverview, locators map[string]string, hashes CacheHashes, rendered map[string][]byte) (BuiltSchemaCache, error)
BuildSchemaCache builds stable product-sorted shards and the authenticating Meta. The supplied projections must exactly match the validated Registry. rendered carries each canonical Schema path's exact pre-rendered compact leaf payload (indented JSON plus trailing newline) for the payload shard's rendered leaves.
type CacheHashes ¶
CacheHashes binds generated DTOs to the public release Schema identities.
type CommandIdentity ¶
type CommandIdentity struct {
CLIPath string
Canonical string
Aliases []string
ProductID string
Title string
}
CommandIdentity is the stable identity of a command.
type CommandMeta ¶
type CommandMeta struct {
Identity CommandIdentity
Safety CommandSafety
Selection CommandSelection
}
CommandMeta is the immutable runtime metadata projection for one command.
func CommandMetaFromTool ¶
func CommandMetaFromTool(tool ToolSpec) CommandMeta
CommandMetaFromTool projects one typed leaf without reading wire maps.
type CommandPayloadDescriptor ¶
type CommandPayloadDescriptor struct {
ProductID string
Offset uint64
Length uint64
SHA256 [sha256.Size]byte
HeaderLength uint64
HeaderSHA256 [sha256.Size]byte
}
CommandPayloadDescriptor locates one product's Safety and Selection shard in the separate payload file, deliberately independent of the registry. HeaderLength and HeaderSHA256 cover the shard's 4-byte header length prefix plus the header proto, so header-only readers authenticate exactly that prefix; rendered leaf blobs carry their own digests inside the header.
type CommandSafety ¶
CommandSafety is the runtime safety view projected from ToolSpec.
func (CommandSafety) ShouldRender ¶
func (s CommandSafety) ShouldRender() bool
ShouldRender reports whether any reviewed safety metadata is available.
type CommandSelection ¶
type CommandSelection struct {
AgentSummary string
UseWhen []string
AvoidWhen []string
Prerequisites []string
Tips []string
Examples []string
}
CommandSelection is the agent-facing selection metadata.
type DecodedCommandPayloads ¶
type DecodedCommandPayloads struct {
ProductID string
// Commands maps each lookup path (primary and alias) to the complete
// CommandMeta: identity, Safety, and Selection.
Commands map[string]CommandMeta
// LeafIndex locates each canonical path's pre-rendered compact leaf bytes
// inside the shard's blob region, sorted by canonical path.
LeafIndex []RenderedLeafRef
// RenderedLeaves carries the verified leaf bytes only for the whole-shard
// decode used by round-trip verification; header reads leave it nil.
RenderedLeaves map[string][]byte
}
DecodedCommandPayloads holds the complete CommandMeta rows for one product's commands, decoded from its payload shard header.
func DecodeSchemaCommandPayloadCache ¶
func DecodeSchemaCommandPayloadCache(payload []byte, descriptor CommandPayloadDescriptor, meta DecodedSchemaMeta) (DecodedCommandPayloads, error)
DecodeSchemaCommandPayloadCache authenticates a whole command payload shard against the Meta's descriptor, decodes its Safety and Selection rows, and verifies every rendered leaf blob against the header's index digests. The header-only variant covers production reads; this full decode serves round-trip verification.
func DecodeSchemaCommandPayloadHeader ¶
func DecodeSchemaCommandPayloadHeader(payload []byte, descriptor CommandPayloadDescriptor) (DecodedCommandPayloads, error)
DecodeSchemaCommandPayloadHeader authenticates only the shard's header prefix against the descriptor, so command reads never pull the rendered leaf blob region. The descriptor must come from an already authenticated source (Meta or the pinned payload index).
func (DecodedCommandPayloads) RenderedLeaf ¶
func (d DecodedCommandPayloads) RenderedLeaf(canonical string) (RenderedLeafRef, bool)
RenderedLeaf finds the leaf ref for one canonical path by binary search.
type DecodedSchemaMeta ¶
type DecodedSchemaMeta struct {
Kind string
Level string
Source string
AgentMetadata json.RawMessage
CommandMetaByPath map[string]CommandMeta
Overview SchemaOverview
LocatorProductByPath map[string]string
ProductDescriptors []ProductDescriptor
PayloadDescriptors []CommandPayloadDescriptor
RegistryDataLength uint64
PayloadDataLength uint64
PayloadSHA256 [sha256.Size]byte
RegistryDataSHA256 [sha256.Size]byte
Hashes CacheHashes
// contains filtered or unexported fields
}
DecodedSchemaMeta is a fully validated runtime Meta cache.
func DecodeSchemaMetaCache ¶
func DecodeSchemaMetaCache(payload []byte) (DecodedSchemaMeta, error)
DecodeSchemaMetaCache rejects unbounded, unknown, unordered, or inconsistent DTOs.
func (DecodedSchemaMeta) CommandMeta ¶
func (m DecodedSchemaMeta) CommandMeta(path string) (CommandMeta, bool)
CommandMeta resolves one command row. While CommandMetaByPath is fully populated (verification paths) this is a plain lookup; ordinary single-path resolution decodes only the row's own product shard.
func (DecodedSchemaMeta) MaterializeCommandMeta ¶
func (m DecodedSchemaMeta) MaterializeCommandMeta()
MaterializeCommandMeta decodes every shard into CommandMetaByPath. Only verification paths that compare the complete lookup need this; ordinary single-path resolution should use CommandMeta.
type DecodedSchemaPayloadIndex ¶
type DecodedSchemaPayloadIndex struct {
LocatorProductByPath map[string]string
PayloadDescriptors []CommandPayloadDescriptor
}
DecodedSchemaPayloadIndex is the payload file's self-describing global header: the locator table plus the per-product shard descriptors.
func DecodeSchemaPayloadIndex ¶
func DecodeSchemaPayloadIndex(region []byte) (DecodedSchemaPayloadIndex, error)
DecodeSchemaPayloadIndex decodes and validates the payload index region, including the 4-byte length prefix the pinned digest covers. The region bytes must already be authenticated by the caller against the binary-pinned payload index digest.
type DecodedSchemaProduct ¶
type DecodedSchemaProduct struct {
Registry SchemaRegistry
Index SchemaIndex
}
DecodedSchemaProduct contains the exact shard conversion and its typed index.
func DecodeSchemaProductCache ¶
func DecodeSchemaProductCache(payload []byte, descriptor ProductDescriptor, meta DecodedSchemaMeta) (DecodedSchemaProduct, error)
DecodeSchemaProductCache verifies an already bounded shard before protobuf decode.
func DecodeSchemaProductFromShards ¶
func DecodeSchemaProductFromShards(shards []byte, meta DecodedSchemaMeta, productID string) (DecodedSchemaProduct, error)
DecodeSchemaProductFromShards checks aggregate identity and a descriptor range.
type OverviewProduct ¶
type OverviewProduct struct {
ID string
ToolCount uint64
SchemaPath string
SummaryKind OverviewSummaryKind
Summary string
}
OverviewProduct is one typed no-argument Schema overview entry.
type OverviewSummaryKind ¶
type OverviewSummaryKind string
OverviewSummaryKind identifies the exact ToOverviewPayload fallback used.
const ( OverviewSummaryNone OverviewSummaryKind = "" OverviewSummaryAgentSummary OverviewSummaryKind = "agent_summary" OverviewSummaryUseWhen OverviewSummaryKind = "use_when" OverviewSummaryDescription OverviewSummaryKind = "description" )
type ParameterSpec ¶
type ParameterSpec struct {
Name string
Type string
Description string
Property string
Required bool
CLIRequired bool
RequiredWhen string
Default json.RawMessage
InterfaceDefault json.RawMessage
Example json.RawMessage
AnyOf []contract.FormatAlternative
Format string
Enum []string
InterfaceDescription string
InterfaceType string
FieldProvenance map[string]contract.FieldProvenance
}
ParameterSpec is one resolved CLI flag projection. Name is the CLI flag key used in the legacy parameters object. Default and Example are RawMessage because JSON literals are polymorphic; they are still typed JSON values and never participate in precedence as map[string]any.
func NormalizeParameterSpec ¶
func NormalizeParameterSpec(parameter ParameterSpec) ParameterSpec
NormalizeParameterSpec returns a detached copy of one parameter.
type ProductDescriptor ¶
type ProductDescriptor struct {
ProductID string
Offset uint64
Length uint64
SHA256 [sha256.Size]byte
}
ProductDescriptor authenticates one range in the concatenated shard payload.
type ProductSpec ¶
type ProductSpec struct {
ID string
Name string
Description string
Runtime bool
Tools []ToolSpec
Selection contract.SelectionSpec
FieldProvenance map[string]contract.FieldProvenance
}
ProductSpec is one deterministic product grouping in SchemaRegistry.
func (ProductSpec) ToPayload ¶
func (p ProductSpec) ToPayload() (map[string]any, error)
ToPayload renders one product and its full tools.
func (ProductSpec) ToSummaryPayload ¶
func (p ProductSpec) ToSummaryPayload() (map[string]any, error)
ToSummaryPayload renders one product with progressive tool summaries. Both this view and the full product payload are projections of the same ToolSpec slice; neither re-resolves annotations or metadata.
type QueryProjectors ¶
type QueryProjectors struct {
ProductSummary func(ProductSpec) (map[string]any, error)
ToolSummary func(ToolSpec) (map[string]any, error)
}
QueryProjectors permits a caller's invariant tests to replace a pure summary projection. Production callers should use RenderQuery.
type RenderedLeafRef ¶
type RenderedLeafRef struct {
CanonicalPath string
Offset uint64
Length uint64
SHA256 [sha256.Size]byte
}
RenderedLeafRef locates one canonical path's pre-rendered compact leaf bytes inside the shard's blob region (offset 0 = first byte after the header).
type RuntimeToolSpecInput ¶
type RuntimeToolSpecInput struct {
Identity contract.ToolIdentitySpec
Display string
Title string
Description string
MetadataSource string
Parameters []ParameterSpec
Constraints contract.RuntimeSchemaConstraints
Positionals []contract.RuntimeSchemaPositional
DryRun *contract.DryRunSpec
Wait *contract.WaitSpec
Result *contract.ResultSpec
Pagination *contract.PaginationSpec
Safety contract.SafetySpec
Interface contract.InterfaceSpec
Selection contract.SelectionSpec
FieldProvenance map[string]contract.FieldProvenance
}
Final provenance coverage is an explicit contract, not a truthiness check. These fields all pass through a precedence resolver and therefore must keep a winner even when the delivered value is false, "", [], or null. RuntimeToolSpecInput is the typed hand-off from runtime source resolution to contract assembly. Adapters resolve candidates first, then call ToolSpecFromRuntime exactly once; payload rendering does no further merging.
type SchemaIndex ¶
type SchemaIndex struct {
// contains filtered or unexported fields
}
SchemaIndex is the immutable navigation view over one normalized registry. It mirrors Lark's typed catalog split: SchemaRegistry owns data, SchemaIndex owns deterministic identity/path resolution, and serializers only render a resolved ToolSpec.
func (SchemaIndex) CanonicalPaths ¶
func (i SchemaIndex) CanonicalPaths() []string
CanonicalPaths returns the complete tool identity set in stable order.
func (SchemaIndex) Product ¶
func (i SchemaIndex) Product(id string) (ProductSpec, bool)
Product resolves one product by exact stable ID.
func (SchemaIndex) Registry ¶
func (i SchemaIndex) Registry() SchemaRegistry
Registry returns the detached normalized registry owned by this index.
func (SchemaIndex) Resolve ¶
func (i SchemaIndex) Resolve(path string) (ToolSpec, bool)
Resolve resolves either an exact canonical path or a normalized CLI path. No inference or fuzzy matching occurs in this layer.
func (SchemaIndex) ResolveQuery ¶
func (i SchemaIndex) ResolveQuery(path string) (ToolSpec, bool)
ResolveQuery adds compatibility for dotted and slash-separated CLI paths at the user-facing query boundary. Resolve remains strict because Registry validation uses it to detect missing canonical identities without falling through to a similarly spelled CLI path.
type SchemaOverview ¶
type SchemaOverview struct {
Kind string
Level string
Source string
AgentMetadata json.RawMessage
Products []OverviewProduct
ToolCount uint64
}
SchemaOverview is the typed equivalent of SchemaRegistry.ToOverviewPayload.
func BuildSchemaOverview ¶
func BuildSchemaOverview(registry SchemaRegistry) (SchemaOverview, error)
BuildSchemaOverview creates the typed no-argument projection without maps.
type SchemaRegistry ¶
type SchemaRegistry struct {
Kind string
Level string
Source string
Products []ProductSpec
AgentMetadata json.RawMessage
}
SchemaRegistry is the resolved, typed Agent contract. Source adapters and precedence resolvers populate this model; wire payloads are rendered only at the outer boundary by ToPayload. This keeps map[string]any out of the contract assembly path.
func SchemaRegistryFromRuntime ¶
func SchemaRegistryFromRuntime(source string, products []ProductSpec) (SchemaRegistry, error)
SchemaRegistryFromRuntime constructs and validates the one registry shared by leaf lookup, Catalog summaries and full export.
func (SchemaRegistry) Index ¶
func (r SchemaRegistry) Index() (SchemaIndex, error)
Index validates all registry identities and returns deterministic navigation indexes. Canonical paths, primary CLI paths and reviewed aliases must each resolve unambiguously.
func (SchemaRegistry) Sorted ¶
func (r SchemaRegistry) Sorted() SchemaRegistry
Sorted returns a detached, deterministic registry. Products are ordered by ID, tools by canonical path then CLI path, and parameters by CLI flag name.
func (SchemaRegistry) ToOverviewPayload ¶
func (r SchemaRegistry) ToOverviewPayload() (map[string]any, error)
ToOverviewPayload renders the small first-hop product index directly from the resolved registry. It is a presentation projection only: it never reads Agent metadata or any other source after assembly.
func (SchemaRegistry) ToPayload ¶
func (r SchemaRegistry) ToPayload() (map[string]any, error)
ToPayload renders the compatible flat schema payload after deterministically sorting the typed model.
func (SchemaRegistry) ToSnapshotPayload ¶
func (r SchemaRegistry) ToSnapshotPayload() (SchemaSnapshotPayload, error)
ToSnapshotPayload derives the progressive Catalog and full tool map from one normalized registry. This is the direct typed replacement for separately assembling runtimeToolSummary and runtimeToolPayload.
type SchemaSnapshotPayload ¶
SchemaSnapshotPayload is the final wire boundary for the release snapshot. Catalog summaries and full Tools are both derived from the same typed ToolSpec instances, preventing the two snapshot layers from drifting.
func ToSnapshotPayloadWithProjectors ¶
func ToSnapshotPayloadWithProjectors(r SchemaRegistry, projectors SnapshotProjectors) (SchemaSnapshotPayload, error)
ToSnapshotPayloadWithProjectors derives a snapshot with optional pure projector substitutions. Nil projectors use the standard wire projection.
type SnapshotProjectors ¶
type SnapshotProjectors struct {
ToolSummary func(ToolSpec) (map[string]any, error)
ToolPayload func(ToolSpec) (map[string]any, error)
ProductSummary func(ProductSpec) (map[string]any, error)
}
SnapshotProjectors permits focused invariant tests to substitute one pure projection without changing the registry model.
type ToolSpec ¶
type ToolSpec struct {
Identity contract.ToolIdentitySpec
Display string
Title string
Description string
MetadataSource string
Parameters []ParameterSpec
Constraints contract.RuntimeSchemaConstraints
Positionals []contract.RuntimeSchemaPositional
DryRun *contract.DryRunSpec
Wait *contract.WaitSpec
Result *contract.ResultSpec
Pagination *contract.PaginationSpec
Safety contract.SafetySpec
Interface contract.InterfaceSpec
Selection contract.SelectionSpec
FieldProvenance map[string]contract.FieldProvenance
}
ToolSpec is the single assembled representation of a command contract. Safety, interface and selection are typed sub-models even though ToPayload preserves the historical flat JSON shape for compatibility.
func AliasView ¶
AliasView returns a detached leaf view for an alias query. Only cli_path and is_alias may differ from the canonical registry tool.
func NormalizeToolSpec ¶
NormalizeToolSpec returns the model's deterministic detached leaf form.
func ToolSpecFromRuntime ¶
func ToolSpecFromRuntime(input RuntimeToolSpecInput) (ToolSpec, error)
ToolSpecFromRuntime validates and normalizes the fully resolved runtime input. It does not choose between sources; that is the resolver's job. Snapshot loading shares this path and validates a delivered winner exactly as serialized: it deliberately does not repair provenance, so a snapshot whose winner differs from the final field must fail closed.
func (ToolSpec) ToPayload ¶
ToPayload renders one full leaf contract in the existing flat JSON shape.
func (ToolSpec) ToSummaryPayload ¶
ToSummaryPayload projects a ToolSpec without parameters and leaf-only execution detail. It is derived from the same typed ToolSpec, never assembled independently.
type TrustedHashes ¶
TrustedHashes are release-envelope values validated by the loading layer. The runtime boundary projects them verbatim and does not calculate or verify cache hashes.
type UnknownPathError ¶
type UnknownPathError struct{ Path string }
UnknownPathError identifies a query miss without coupling the runtime to the parent CLI's public error framework.
func (UnknownPathError) Error ¶
func (e UnknownPathError) Error() string