Documentation
¶
Index ¶
- Constants
- type AgentDocument
- type AgentRuntime
- type AgentSpec
- type ApplyResult
- func (r *ApplyResult) AddConflict(kind, id, message string)
- func (r *ApplyResult) AddCreated(kind, id string)
- func (r *ApplyResult) AddError(kind, id, message string)
- func (r *ApplyResult) AddFieldError(kind, id, field, message string)
- func (r *ApplyResult) AddUnchanged(kind, id string)
- func (r *ApplyResult) AddValidationError(kind, id, message string)
- func (r ApplyResult) ApplyErrorCount() int
- func (r ApplyResult) ConflictCount() int
- func (r ApplyResult) CreatedCount() int
- func (r ApplyResult) HasValidationErrors() bool
- func (r ApplyResult) IsValid() bool
- func (r ApplyResult) PartialSuccess() bool
- func (r ApplyResult) Success() bool
- func (r ApplyResult) TotalCount() int
- func (r ApplyResult) UnchangedCount() int
- func (r ApplyResult) ValidationErrorCount() int
- type ConsequenceThreshold
- type ConsequenceType
- type ContextField
- type ContextSchema
- type Document
- type DocumentMetadata
- type EvidenceRequirement
- type GrantDocument
- type GrantSpec
- type PlanEntry
- type PlanEntryAction
- type PlanEntryDecisionSource
- type PlanResult
- type ProfileAuthority
- type ProfileDocument
- type ProfileInputRequirements
- type ProfileLifecycle
- type ProfilePolicy
- type ProfileSpec
- type ResourceResult
- type ResourceStatus
- type SurfaceDocument
- type SurfaceSpec
- type ValidationError
- type ValidationRule
Constants ¶
const ( APIVersionV1 = "midas.accept.io/v1" KindSurface = "Surface" KindAgent = "Agent" KindProfile = "Profile" KindGrant = "Grant" )
API version and resource kind constants for MIDAS control plane.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentDocument ¶
type AgentDocument struct {
APIVersion string `json:"apiVersion" yaml:"apiVersion"`
Kind string `json:"kind" yaml:"kind"`
Metadata DocumentMetadata `json:"metadata" yaml:"metadata"`
Spec AgentSpec `json:"spec" yaml:"spec"`
}
AgentDocument defines a non-human or system identity.
func (AgentDocument) GetKind ¶
func (a AgentDocument) GetKind() string
GetKind returns the resource kind.
type AgentRuntime ¶
type AgentRuntime struct {
Model string `json:"model,omitempty" yaml:"model,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
Provider string `json:"provider,omitempty" yaml:"provider,omitempty"`
}
AgentRuntime contains runtime metadata for an agent.
type AgentSpec ¶
type AgentSpec struct {
Type string `json:"type,omitempty" yaml:"type,omitempty"` // llm_agent | workflow | automation | copilot | rpa
Runtime AgentRuntime `json:"runtime,omitempty" yaml:"runtime,omitempty"`
Status string `json:"status,omitempty" yaml:"status,omitempty"` // active | inactive
}
AgentSpec contains the specification for an agent.
type ApplyResult ¶
type ApplyResult struct {
Results []ResourceResult `json:"results"`
ValidationErrors []ValidationError `json:"validation_errors,omitempty"`
}
ApplyResult summarizes the outcome of applying a bundle of control plane resources.
func (*ApplyResult) AddConflict ¶
func (r *ApplyResult) AddConflict(kind, id, message string)
AddConflict records a resource that already exists.
func (*ApplyResult) AddCreated ¶
func (r *ApplyResult) AddCreated(kind, id string)
AddCreated records a successfully created resource.
func (*ApplyResult) AddError ¶
func (r *ApplyResult) AddError(kind, id, message string)
AddError records a resource that failed to apply due to an execution error.
func (*ApplyResult) AddFieldError ¶
func (r *ApplyResult) AddFieldError(kind, id, field, message string)
AddFieldError records a validation error for a specific field.
func (*ApplyResult) AddUnchanged ¶
func (r *ApplyResult) AddUnchanged(kind, id string)
AddUnchanged records a resource that was already in the desired state.
func (*ApplyResult) AddValidationError ¶
func (r *ApplyResult) AddValidationError(kind, id, message string)
AddValidationError records a document-level validation error (not field-specific).
func (ApplyResult) ApplyErrorCount ¶
func (r ApplyResult) ApplyErrorCount() int
ApplyErrorCount returns the number of apply-time resource errors.
func (ApplyResult) ConflictCount ¶
func (r ApplyResult) ConflictCount() int
ConflictCount returns the number of conflicting resources.
func (ApplyResult) CreatedCount ¶
func (r ApplyResult) CreatedCount() int
CreatedCount returns the number of created resources.
func (ApplyResult) HasValidationErrors ¶
func (r ApplyResult) HasValidationErrors() bool
HasValidationErrors returns true if validation errors occurred.
func (ApplyResult) IsValid ¶
func (r ApplyResult) IsValid() bool
IsValid returns true if no validation errors occurred.
func (ApplyResult) PartialSuccess ¶
func (r ApplyResult) PartialSuccess() bool
PartialSuccess returns true if at least one resource succeeded and no validation errors occurred.
func (ApplyResult) Success ¶
func (r ApplyResult) Success() bool
Success returns true if all resources were successfully applied.
Phase 7 (MVP): Conflicts are treated as failures because apply is create-only. Phase 8+: When idempotent apply is implemented, this may treat unchanged resources as successful.
func (ApplyResult) TotalCount ¶
func (r ApplyResult) TotalCount() int
TotalCount returns the total number of resources processed.
func (ApplyResult) UnchangedCount ¶
func (r ApplyResult) UnchangedCount() int
UnchangedCount returns the number of unchanged resources.
func (ApplyResult) ValidationErrorCount ¶
func (r ApplyResult) ValidationErrorCount() int
ValidationErrorCount returns the number of validation errors.
type ConsequenceThreshold ¶
type ConsequenceThreshold struct {
Type string `json:"type,omitempty" yaml:"type,omitempty"` // monetary | data_access | risk_rating
Amount float64 `json:"amount,omitempty" yaml:"amount,omitempty"` // for monetary type
Currency string `json:"currency,omitempty" yaml:"currency,omitempty"` // for monetary type
RiskRating string `json:"risk_rating,omitempty" yaml:"risk_rating,omitempty"` // for risk_rating type
}
ConsequenceThreshold defines limits on decision consequences.
type ConsequenceType ¶
type ConsequenceType struct {
ID string `json:"id" yaml:"id"`
Name string `json:"name" yaml:"name"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
MeasureType string `json:"measure_type" yaml:"measure_type"` // financial | temporal | risk_rating | impact_scope | custom`
Currency string `json:"currency,omitempty" yaml:"currency,omitempty"`
DurationUnit string `json:"duration_unit,omitempty" yaml:"duration_unit,omitempty"` // hours | days | months | years
RatingScale []string `json:"rating_scale,omitempty" yaml:"rating_scale,omitempty"`
ScopeScale []string `json:"scope_scale,omitempty" yaml:"scope_scale,omitempty"`
MinValue *float64 `json:"min_value,omitempty" yaml:"min_value,omitempty"`
MaxValue *float64 `json:"max_value,omitempty" yaml:"max_value,omitempty"`
}
ConsequenceType defines a category of impact that decisions on this surface can produce.
type ContextField ¶
type ContextField struct {
Name string `json:"name" yaml:"name"`
Type string `json:"type" yaml:"type"` // string | number | boolean | object | array
Required bool `json:"required,omitempty" yaml:"required,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Validation *ValidationRule `json:"validation,omitempty" yaml:"validation,omitempty"`
Example any `json:"example,omitempty" yaml:"example,omitempty"`
}
ContextField defines a single required or optional context attribute.
type ContextSchema ¶
type ContextSchema struct {
Fields []ContextField `json:"fields,omitempty" yaml:"fields,omitempty"`
}
ContextSchema defines the structure and validation rules for the context map required to make decisions on this surface.
type DocumentMetadata ¶
type DocumentMetadata struct {
ID string `json:"id" yaml:"id"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
}
DocumentMetadata contains common metadata fields for all control plane resources.
type EvidenceRequirement ¶
type EvidenceRequirement struct {
ID string `json:"id" yaml:"id"`
Name string `json:"name" yaml:"name"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Required bool `json:"required,omitempty" yaml:"required,omitempty"`
Format string `json:"format,omitempty" yaml:"format,omitempty"` // structured_data | document_reference | attestation
}
EvidenceRequirement specifies documentation or justification that must accompany decisions on this surface.
type GrantDocument ¶
type GrantDocument struct {
APIVersion string `json:"apiVersion" yaml:"apiVersion"`
Kind string `json:"kind" yaml:"kind"`
Metadata DocumentMetadata `json:"metadata" yaml:"metadata"`
Spec GrantSpec `json:"spec" yaml:"spec"`
}
GrantDocument assigns a profile to an agent for a time period.
func (GrantDocument) GetKind ¶
func (g GrantDocument) GetKind() string
GetKind returns the resource kind.
type GrantSpec ¶
type GrantSpec struct {
AgentID string `json:"agent_id" yaml:"agent_id"`
ProfileID string `json:"profile_id" yaml:"profile_id"`
GrantedBy string `json:"granted_by,omitempty" yaml:"granted_by,omitempty"`
GrantedAt string `json:"granted_at,omitempty" yaml:"granted_at,omitempty"`
EffectiveFrom string `json:"effective_from,omitempty" yaml:"effective_from,omitempty"`
EffectiveUntil string `json:"effective_until,omitempty" yaml:"effective_until,omitempty"`
Status string `json:"status,omitempty" yaml:"status,omitempty"` // active | suspended | revoked | expired
Metadata map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty"`
}
GrantSpec contains the specification for a grant.
type PlanEntry ¶
type PlanEntry struct {
// Kind is the document kind (Surface, Agent, Profile, Grant).
Kind string `json:"kind"`
// ID is the document metadata.id.
ID string `json:"id"`
// Action is the intended operation if the bundle were applied.
Action PlanEntryAction `json:"action"`
// DocumentIndex is the 1-based position in the original bundle.
DocumentIndex int `json:"document_index"`
// Message provides human-readable context for conflict and invalid entries.
Message string `json:"message,omitempty"`
// DecisionSource records how the planner arrived at the action.
DecisionSource PlanEntryDecisionSource `json:"decision_source,omitempty"`
// ValidationErrors holds structured validation errors for this entry.
// Populated when Action is invalid.
ValidationErrors []ValidationError `json:"validation_errors,omitempty"`
}
PlanEntry describes the planned action for a single document in a dry-run plan response. It carries all fields needed for a caller to understand what would happen and why.
type PlanEntryAction ¶
type PlanEntryAction string
PlanEntryAction mirrors the apply.ApplyAction values for use in the HTTP plan response. It is intentionally a plain string type so the types package remains free of a dependency on the apply package.
const ( PlanEntryActionCreate PlanEntryAction = "create" PlanEntryActionConflict PlanEntryAction = "conflict" PlanEntryActionInvalid PlanEntryAction = "invalid" PlanEntryActionUnchanged PlanEntryAction = "unchanged" )
type PlanEntryDecisionSource ¶
type PlanEntryDecisionSource string
PlanEntryDecisionSource records how the planner resolved the action for an entry. The value is informational and intended for dry-run callers.
const ( // PlanEntryDecisionSourcePersistedState means the action was determined by // inspecting persisted state via a repository lookup. PlanEntryDecisionSourcePersistedState PlanEntryDecisionSource = "persisted_state" // PlanEntryDecisionSourceBundleDependency means the action was determined // by resolving a cross-document reference against another entry in the same // bundle rather than persisted state. PlanEntryDecisionSourceBundleDependency PlanEntryDecisionSource = "bundle_dependency" // PlanEntryDecisionSourceValidation means the action was determined by a // structural or referential-integrity validation failure. PlanEntryDecisionSourceValidation PlanEntryDecisionSource = "validation" )
type PlanResult ¶
type PlanResult struct {
// Entries describes the planned action for each document in bundle order.
Entries []PlanEntry `json:"entries"`
// WouldApply is true when the plan contains no invalid entries and at
// least one create entry — i.e., applying this bundle would succeed and
// produce at least one new resource.
WouldApply bool `json:"would_apply"`
// InvalidCount is the number of entries with action invalid.
InvalidCount int `json:"invalid_count"`
// ConflictCount is the number of entries with action conflict.
ConflictCount int `json:"conflict_count"`
// CreateCount is the number of entries with action create.
CreateCount int `json:"create_count"`
}
PlanResult is the structured response returned by a dry-run plan request. It describes what would happen for each document in the bundle without persisting anything.
type ProfileAuthority ¶
type ProfileAuthority struct {
DecisionConfidenceThreshold float64 `json:"decision_confidence_threshold,omitempty" yaml:"decision_confidence_threshold,omitempty"`
ConsequenceThreshold ConsequenceThreshold `json:"consequence_threshold,omitempty" yaml:"consequence_threshold,omitempty"`
}
ProfileAuthority defines the authority limits for a profile.
type ProfileDocument ¶
type ProfileDocument struct {
APIVersion string `json:"apiVersion" yaml:"apiVersion"`
Kind string `json:"kind" yaml:"kind"`
Metadata DocumentMetadata `json:"metadata" yaml:"metadata"`
Spec ProfileSpec `json:"spec" yaml:"spec"`
}
ProfileDocument defines an authority policy envelope.
func (ProfileDocument) GetID ¶
func (p ProfileDocument) GetID() string
GetID returns the resource ID.
func (ProfileDocument) GetKind ¶
func (p ProfileDocument) GetKind() string
GetKind returns the resource kind.
type ProfileInputRequirements ¶
type ProfileInputRequirements struct {
RequiredContext []string `json:"required_context,omitempty" yaml:"required_context,omitempty"`
}
ProfileInputRequirements defines required context for decisions.
type ProfileLifecycle ¶
type ProfileLifecycle struct {
Status string `json:"status,omitempty" yaml:"status,omitempty"` // active | inactive | deprecated
EffectiveFrom string `json:"effective_from,omitempty" yaml:"effective_from,omitempty"` // RFC3339 timestamp
EffectiveUntil string `json:"effective_until,omitempty" yaml:"effective_until,omitempty"` // RFC3339 timestamp
Version int `json:"version,omitempty" yaml:"version,omitempty"`
}
ProfileLifecycle defines lifecycle metadata for a profile.
type ProfilePolicy ¶
type ProfilePolicy struct {
Reference string `json:"reference,omitempty" yaml:"reference,omitempty"` // e.g. rego://payments/auto_approve_v1
FailMode string `json:"fail_mode,omitempty" yaml:"fail_mode,omitempty"` // closed | open
}
ProfilePolicy defines policy evaluation settings.
type ProfileSpec ¶
type ProfileSpec struct {
SurfaceID string `json:"surface_id" yaml:"surface_id"`
Authority ProfileAuthority `json:"authority,omitempty" yaml:"authority,omitempty"`
InputRequirements ProfileInputRequirements `json:"input_requirements,omitempty" yaml:"input_requirements,omitempty"`
Policy ProfilePolicy `json:"policy,omitempty" yaml:"policy,omitempty"`
Lifecycle ProfileLifecycle `json:"lifecycle,omitempty" yaml:"lifecycle,omitempty"`
}
ProfileSpec contains the specification for an authority profile.
type ResourceResult ¶
type ResourceResult struct {
Kind string `json:"kind"` // Surface | Agent | Profile | Grant
ID string `json:"id"` // metadata.id from the document
Status ResourceStatus `json:"status"` // created | conflict | error | unchanged
Message string `json:"message,omitempty"` // additional context
}
ResourceResult represents the outcome of applying a single resource.
type ResourceStatus ¶
type ResourceStatus string
ResourceStatus represents the outcome of applying a single resource.
const ( ResourceStatusCreated ResourceStatus = "created" ResourceStatusConflict ResourceStatus = "conflict" ResourceStatusError ResourceStatus = "error" ResourceStatusUnchanged ResourceStatus = "unchanged" )
type SurfaceDocument ¶
type SurfaceDocument struct {
APIVersion string `json:"apiVersion" yaml:"apiVersion"`
Kind string `json:"kind" yaml:"kind"`
Metadata DocumentMetadata `json:"metadata" yaml:"metadata"`
Spec SurfaceSpec `json:"spec" yaml:"spec"`
}
SurfaceDocument defines a governed action boundary.
func (SurfaceDocument) GetID ¶
func (s SurfaceDocument) GetID() string
GetID returns the resource ID.
func (SurfaceDocument) GetKind ¶
func (s SurfaceDocument) GetKind() string
GetKind returns the resource kind.
type SurfaceSpec ¶
type SurfaceSpec struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"`
// Registry / classification
Domain string `json:"domain,omitempty" yaml:"domain,omitempty"`
Category string `json:"category,omitempty" yaml:"category,omitempty"` // financial | customer_data | compliance | operational
RiskTier string `json:"risk_tier,omitempty" yaml:"risk_tier,omitempty"` // high | medium | low
Taxonomy []string `json:"taxonomy,omitempty" yaml:"taxonomy,omitempty"`
Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"`
// Decision characteristics
DecisionType string `json:"decision_type,omitempty" yaml:"decision_type,omitempty"` // strategic | tactical | operational
ReversibilityClass string `json:"reversibility_class,omitempty" yaml:"reversibility_class,omitempty"` // reversible | conditionally_reversible | irreversible
MinimumConfidence float64 `json:"minimum_confidence,omitempty" yaml:"minimum_confidence,omitempty"` // 0.0 - 1.0
SubjectRequired bool `json:"subject_required,omitempty" yaml:"subject_required,omitempty"`
// Policy integration
PolicyPackage string `json:"policy_package,omitempty" yaml:"policy_package,omitempty"`
PolicyVersion string `json:"policy_version,omitempty" yaml:"policy_version,omitempty"`
FailureMode string `json:"failure_mode,omitempty" yaml:"failure_mode,omitempty"` // closed | open
// Ownership / governance
BusinessOwner string `json:"business_owner,omitempty" yaml:"business_owner,omitempty"`
TechnicalOwner string `json:"technical_owner,omitempty" yaml:"technical_owner,omitempty"`
Stakeholders []string `json:"stakeholders,omitempty" yaml:"stakeholders,omitempty"`
// Evidence / compliance
MandatoryEvidence []EvidenceRequirement `json:"mandatory_evidence,omitempty" yaml:"mandatory_evidence,omitempty"`
AuditRetentionHours int `json:"audit_retention_hours,omitempty" yaml:"audit_retention_hours,omitempty"`
ComplianceFrameworks []string `json:"compliance_frameworks,omitempty" yaml:"compliance_frameworks,omitempty"`
// Runtime evaluation inputs
RequiredContext ContextSchema `json:"required_context,omitempty" yaml:"required_context,omitempty"`
ConsequenceTypes []ConsequenceType `json:"consequence_types,omitempty" yaml:"consequence_types,omitempty"`
// Lifecycle
Status string `json:"status,omitempty" yaml:"status,omitempty"` // draft | review | active | deprecated | retired
EffectiveFrom time.Time `json:"effective_from,omitempty" yaml:"effective_from,omitempty"`
EffectiveUntil *time.Time `json:"effective_until,omitempty" yaml:"effective_until,omitempty"`
DeprecationReason string `json:"deprecation_reason,omitempty" yaml:"deprecation_reason,omitempty"`
SuccessorSurfaceID string `json:"successor_surface_id,omitempty" yaml:"successor_surface_id,omitempty"`
SuccessorVersion int `json:"successor_version,omitempty" yaml:"successor_version,omitempty"`
// Documentation / references
DocumentationURL string `json:"documentation_url,omitempty" yaml:"documentation_url,omitempty"`
ExternalReferences map[string]string `json:"external_references,omitempty" yaml:"external_references,omitempty"`
}
SurfaceSpec contains the specification for a decision surface.
This schema is intentionally richer than the original MVP shape so that the control-plane document can represent a governed, versioned decision surface more faithfully.
type ValidationError ¶
type ValidationError struct {
Kind string `json:"kind"` // Surface | Agent | Profile | Grant
ID string `json:"id"` // metadata.id from the document
Field string `json:"field,omitempty"` // e.g. spec.surface_id
Message string `json:"message"` // human-readable error description
DocumentIndex int `json:"document_index,omitempty"` // 1-based position in a multi-document bundle
}
ValidationError represents a single validation failure for a control plane resource.
type ValidationRule ¶
type ValidationRule struct {
// String validation
Pattern string `json:"pattern,omitempty" yaml:"pattern,omitempty"`
MinLength *int `json:"min_length,omitempty" yaml:"min_length,omitempty"`
MaxLength *int `json:"max_length,omitempty" yaml:"max_length,omitempty"`
Enum []string `json:"enum,omitempty" yaml:"enum,omitempty"`
// Number validation
Minimum *float64 `json:"minimum,omitempty" yaml:"minimum,omitempty"`
Maximum *float64 `json:"maximum,omitempty" yaml:"maximum,omitempty"`
ExclusiveMinimum bool `json:"exclusive_minimum,omitempty" yaml:"exclusive_minimum,omitempty"`
ExclusiveMaximum bool `json:"exclusive_maximum,omitempty" yaml:"exclusive_maximum,omitempty"`
// Array validation
MinItems *int `json:"min_items,omitempty" yaml:"min_items,omitempty"`
MaxItems *int `json:"max_items,omitempty" yaml:"max_items,omitempty"`
}
ValidationRule specifies constraints on field values.