Documentation
¶
Index ¶
- Constants
- func AppendKillSwitchJournal(path string, record KillSwitchJournalRecord) error
- func ApplyWrkrContext(intent *schemagate.IntentRequest, toolName string, ...) bool
- func ApprovalContext(policy Policy, intent schemagate.IntentRequest) (string, string, []string, error)
- func ApprovedScriptDigest(input schemagate.ApprovedScriptEntry) (string, error)
- func ArgsDigest(args map[string]any) (string, error)
- func BuildApprovalAuditRecord(opts BuildApprovalAuditOptions) schemagate.ApprovalAuditRecord
- func BuildBrokerCredentialRecord(opts BuildBrokerCredentialRecordOptions) schemagate.BrokerCredentialRecord
- func BuildDelegationAuditRecord(opts BuildDelegationAuditOptions) schemagate.DelegationAuditRecord
- func BuildPolicyExplain(policy Policy, outcome EvalOutcome, opts BuildPolicyExplainOptions) schemagate.PolicyExplain
- func CommitmentIntentToIntent(input schemavoice.CommitmentIntent) (schemagate.IntentRequest, error)
- func CredentialTargetBinding(intent schemagate.IntentRequest) (string, error)
- func DelegationBindingDigest(intent schemagate.IntentRequest) (string, error)
- func DelegationDigest(delegation schemagate.IntentDelegation) (string, error)
- func DelegationTokenDigest(t schemagate.DelegationToken) (string, error)
- func Evaluate(policy Policy, intent schemagate.IntentRequest, options EvalOptions) (schemagate.GateResult, error)
- func EvaluatePolicy(policy Policy, intent schemagate.IntentRequest, opts EvalOptions) (schemagate.GateResult, error)
- func IntentContainsDestructiveTarget(targets []schemagate.IntentTarget) bool
- func IntentDigest(input schemagate.IntentRequest) (string, error)
- func IsCommitmentClass(value string) bool
- func KillSwitchJournalPath(statePath string) string
- func LoadKillSwitchState(path string) (schemagate.KillSwitchState, error)
- func MatchKillSwitch(state schemagate.KillSwitchState, intent schemagate.IntentRequest, ...) *schemagate.KillSwitchDecision
- func NewKillSwitchEntry(now time.Time, entry schemagate.KillSwitchEntry) (schemagate.KillSwitchEntry, error)
- func NewKillSwitchState(now time.Time, producerVersion string) schemagate.KillSwitchState
- func NormalizeApprovedScriptEntry(input schemagate.ApprovedScriptEntry) (schemagate.ApprovedScriptEntry, error)
- func NormalizeCommitmentIntent(input schemavoice.CommitmentIntent) (schemavoice.CommitmentIntent, error)
- func NormalizeIntent(input schemagate.IntentRequest) (schemagate.IntentRequest, error)
- func NormalizedIntentBytes(input schemagate.IntentRequest) ([]byte, error)
- func PolicyDigest(policy Policy) (string, error)
- func PolicyHasHighRiskUnbrokeredActions(policy Policy) bool
- func PolicyRequiresBrokerForHighRisk(policy Policy) bool
- func PolicyRequiresContextEvidence(policy Policy) bool
- func ReadApprovalToken(path string) (schemagate.ApprovalToken, error)
- func ReadApprovedScriptRegistry(path string) ([]schemagate.ApprovedScriptEntry, error)
- func ReadDelegationToken(path string) (schemagate.DelegationToken, error)
- func ReadSayToken(path string) (schemavoice.SayToken, error)
- func ReadTraceRecord(path string) (schemagate.TraceRecord, error)
- func ScriptHash(input schemagate.IntentRequest) (string, error)
- func SignApprovedScriptEntry(input schemagate.ApprovedScriptEntry, privateKey ed25519.PrivateKey) (schemagate.ApprovedScriptEntry, error)
- func ValidateApprovalToken(token schemagate.ApprovalToken, publicKey ed25519.PublicKey, ...) error
- func ValidateBrokerCredentialReceipt(rule PolicyRule, request credential.Request, response credential.Response, ...) ([]string, []string)
- func ValidateDelegationNonExpansion(parent, child schemagate.DelegationToken) error
- func ValidateDelegationToken(token schemagate.DelegationToken, publicKey ed25519.PublicKey, ...) error
- func ValidateSayToken(token schemavoice.SayToken, publicKey ed25519.PublicKey, ...) error
- func VerifyApprovedScriptEntry(input schemagate.ApprovedScriptEntry, publicKey ed25519.PublicKey, ...) error
- func VerifyTraceRecordSignature(trace schemagate.TraceRecord, publicKey ed25519.PublicKey) (bool, error)
- func WriteApprovalAuditRecord(path string, record schemagate.ApprovalAuditRecord) error
- func WriteApprovalToken(path string, token schemagate.ApprovalToken) error
- func WriteApprovedScriptRegistry(path string, entries []schemagate.ApprovedScriptEntry) error
- func WriteBrokerCredentialRecord(path string, record schemagate.BrokerCredentialRecord) error
- func WriteDelegationAuditRecord(path string, record schemagate.DelegationAuditRecord) error
- func WriteDelegationToken(path string, token schemagate.DelegationToken) error
- func WriteKillSwitchState(path string, state schemagate.KillSwitchState) error
- func WriteSayToken(path string, token schemavoice.SayToken) error
- func WriteTraceRecord(path string, trace schemagate.TraceRecord) error
- type ApprovalTokenError
- type ApprovalValidationOptions
- type ApprovedScriptMatch
- type BuildApprovalAuditOptions
- type BuildBrokerCredentialRecordOptions
- type BuildDelegationAuditOptions
- type BuildPolicyExplainOptions
- type DataflowPolicy
- type DelegationChainValidationOptions
- type DelegationChainValidationResult
- type DelegationTokenError
- type DelegationValidationOptions
- type EmitTraceOptions
- type EmitTraceResult
- type EndpointPolicy
- type EvalOptions
- type EvalOutcome
- type FailClosedPolicy
- type FreezeWindowPolicy
- type FreezeWindowRange
- type IntentBrokerBinding
- type KillSwitchJournalRecord
- type LegacyPolicyContractError
- type LegacyPolicyFieldMigration
- type MCPTrustPolicy
- type MintApprovalTokenOptions
- type MintApprovalTokenResult
- type MintDelegationTokenOptions
- type MintDelegationTokenResult
- type MintSayTokenOptions
- type MintSayTokenResult
- type Policy
- type PolicyMatch
- type PolicyRule
- type RateLimitDecision
- type RateLimitPolicy
- type SandboxPolicy
- type SayTokenError
- type SayTokenValidationOptions
- type ScriptPolicy
- type ToolAnnotationMatch
- type WrkrInventory
- type WrkrToolMetadata
Constants ¶
View Source
const ( ApprovalReasonMissingToken = "approval_token_missing" ApprovalReasonGranted = "approval_granted" ApprovalReasonChainInsufficient = "approval_chain_insufficient" ApprovalReasonDistinctApprovers = "approval_distinct_approvers_required" ApprovalCodeSchemaInvalid = "approval_token_invalid" ApprovalCodeSignatureMiss = "approval_token_signature_missing" ApprovalCodeSignatureFailed = "approval_token_signature_invalid" ApprovalCodeExpired = "approval_token_expired" ApprovalCodeIntentMismatch = "approval_token_intent_mismatch" ApprovalCodePolicyMismatch = "approval_token_policy_mismatch" ApprovalCodeDelegationMismatch = "approval_token_delegation_binding_mismatch" ApprovalCodeScopeMismatch = "approval_token_scope_mismatch" ApprovalCodeTargetsExceeded = "approval_token_max_targets_exceeded" ApprovalCodeOpsExceeded = "approval_token_max_ops_exceeded" )
View Source
const ( DelegationCodeSchemaInvalid = "delegation_token_invalid" DelegationCodeSignatureMiss = "delegation_token_signature_missing" DelegationCodeSignatureFailed = "delegation_token_signature_invalid" DelegationCodeExpired = "delegation_token_expired" DelegationCodeDelegatorMis = "delegation_token_delegator_mismatch" DelegationCodeDelegateMis = "delegation_token_delegate_mismatch" DelegationCodeScopeMismatch = "delegation_token_scope_mismatch" DelegationCodeIntentMismatch = "delegation_token_intent_mismatch" DelegationCodePolicyMismatch = "delegation_token_policy_mismatch" DelegationCodeChainMismatch = "delegation_token_chain_mismatch" )
View Source
const ( SayTokenCodeSchemaInvalid = "say_token_invalid" SayTokenCodeSignatureMiss = "say_token_signature_missing" SayTokenCodeSignatureFailed = "say_token_signature_invalid" SayTokenCodeExpired = "say_token_expired" SayTokenCodeIntentMismatch = "say_token_intent_mismatch" SayTokenCodePolicyMismatch = "say_token_policy_mismatch" SayTokenCodeCallMismatch = "say_token_call_binding_mismatch" SayTokenCodeClassMismatch = "say_token_class_mismatch" )
Variables ¶
This section is empty.
Functions ¶
func AppendKillSwitchJournal ¶ added in v1.4.0
func AppendKillSwitchJournal(path string, record KillSwitchJournalRecord) error
func ApplyWrkrContext ¶ added in v1.2.8
func ApplyWrkrContext(intent *schemagate.IntentRequest, toolName string, inventory map[string]WrkrToolMetadata) bool
func ApprovalContext ¶
func ApprovalContext(policy Policy, intent schemagate.IntentRequest) (string, string, []string, error)
func ApprovedScriptDigest ¶ added in v1.2.8
func ApprovedScriptDigest(input schemagate.ApprovedScriptEntry) (string, error)
func BuildApprovalAuditRecord ¶
func BuildApprovalAuditRecord(opts BuildApprovalAuditOptions) schemagate.ApprovalAuditRecord
func BuildBrokerCredentialRecord ¶
func BuildBrokerCredentialRecord(opts BuildBrokerCredentialRecordOptions) schemagate.BrokerCredentialRecord
func BuildDelegationAuditRecord ¶
func BuildDelegationAuditRecord(opts BuildDelegationAuditOptions) schemagate.DelegationAuditRecord
func BuildPolicyExplain ¶ added in v1.4.0
func BuildPolicyExplain(policy Policy, outcome EvalOutcome, opts BuildPolicyExplainOptions) schemagate.PolicyExplain
func CommitmentIntentToIntent ¶
func CommitmentIntentToIntent(input schemavoice.CommitmentIntent) (schemagate.IntentRequest, error)
func CredentialTargetBinding ¶ added in v1.4.0
func CredentialTargetBinding(intent schemagate.IntentRequest) (string, error)
func DelegationBindingDigest ¶
func DelegationBindingDigest(intent schemagate.IntentRequest) (string, error)
func DelegationDigest ¶
func DelegationDigest(delegation schemagate.IntentDelegation) (string, error)
func DelegationTokenDigest ¶ added in v1.6.0
func DelegationTokenDigest(t schemagate.DelegationToken) (string, error)
func Evaluate ¶
func Evaluate(policy Policy, intent schemagate.IntentRequest, options EvalOptions) (schemagate.GateResult, error)
Evaluate is a stable alias for policy evaluation used by integration callers.
func EvaluatePolicy ¶
func EvaluatePolicy(policy Policy, intent schemagate.IntentRequest, opts EvalOptions) (schemagate.GateResult, error)
func IntentContainsDestructiveTarget ¶ added in v1.3.0
func IntentContainsDestructiveTarget(targets []schemagate.IntentTarget) bool
func IntentDigest ¶
func IntentDigest(input schemagate.IntentRequest) (string, error)
func IsCommitmentClass ¶
func KillSwitchJournalPath ¶ added in v1.4.0
func LoadKillSwitchState ¶ added in v1.4.0
func LoadKillSwitchState(path string) (schemagate.KillSwitchState, error)
func MatchKillSwitch ¶ added in v1.4.0
func MatchKillSwitch(state schemagate.KillSwitchState, intent schemagate.IntentRequest, now time.Time) *schemagate.KillSwitchDecision
func NewKillSwitchEntry ¶ added in v1.4.0
func NewKillSwitchEntry(now time.Time, entry schemagate.KillSwitchEntry) (schemagate.KillSwitchEntry, error)
func NewKillSwitchState ¶ added in v1.4.0
func NewKillSwitchState(now time.Time, producerVersion string) schemagate.KillSwitchState
func NormalizeApprovedScriptEntry ¶ added in v1.2.8
func NormalizeApprovedScriptEntry(input schemagate.ApprovedScriptEntry) (schemagate.ApprovedScriptEntry, error)
func NormalizeCommitmentIntent ¶
func NormalizeCommitmentIntent(input schemavoice.CommitmentIntent) (schemavoice.CommitmentIntent, error)
func NormalizeIntent ¶
func NormalizeIntent(input schemagate.IntentRequest) (schemagate.IntentRequest, error)
func NormalizedIntentBytes ¶
func NormalizedIntentBytes(input schemagate.IntentRequest) ([]byte, error)
func PolicyDigest ¶
func PolicyRequiresContextEvidence ¶ added in v1.3.3
func ReadApprovalToken ¶
func ReadApprovalToken(path string) (schemagate.ApprovalToken, error)
func ReadApprovedScriptRegistry ¶ added in v1.2.8
func ReadApprovedScriptRegistry(path string) ([]schemagate.ApprovedScriptEntry, error)
func ReadDelegationToken ¶
func ReadDelegationToken(path string) (schemagate.DelegationToken, error)
func ReadSayToken ¶
func ReadSayToken(path string) (schemavoice.SayToken, error)
func ReadTraceRecord ¶
func ReadTraceRecord(path string) (schemagate.TraceRecord, error)
func ScriptHash ¶ added in v1.2.8
func ScriptHash(input schemagate.IntentRequest) (string, error)
func SignApprovedScriptEntry ¶ added in v1.2.8
func SignApprovedScriptEntry(input schemagate.ApprovedScriptEntry, privateKey ed25519.PrivateKey) (schemagate.ApprovedScriptEntry, error)
func ValidateApprovalToken ¶
func ValidateApprovalToken(token schemagate.ApprovalToken, publicKey ed25519.PublicKey, opts ApprovalValidationOptions) error
func ValidateBrokerCredentialReceipt ¶ added in v1.4.0
func ValidateBrokerCredentialReceipt(rule PolicyRule, request credential.Request, response credential.Response, intentBinding IntentBrokerBinding) ([]string, []string)
func ValidateDelegationNonExpansion ¶ added in v1.6.0
func ValidateDelegationNonExpansion(parent, child schemagate.DelegationToken) error
func ValidateDelegationToken ¶
func ValidateDelegationToken(token schemagate.DelegationToken, publicKey ed25519.PublicKey, opts DelegationValidationOptions) error
func ValidateSayToken ¶
func ValidateSayToken(token schemavoice.SayToken, publicKey ed25519.PublicKey, opts SayTokenValidationOptions) error
func VerifyApprovedScriptEntry ¶ added in v1.2.8
func VerifyApprovedScriptEntry(input schemagate.ApprovedScriptEntry, publicKey ed25519.PublicKey, now time.Time) error
func VerifyTraceRecordSignature ¶
func VerifyTraceRecordSignature(trace schemagate.TraceRecord, publicKey ed25519.PublicKey) (bool, error)
func WriteApprovalAuditRecord ¶
func WriteApprovalAuditRecord(path string, record schemagate.ApprovalAuditRecord) error
func WriteApprovalToken ¶
func WriteApprovalToken(path string, token schemagate.ApprovalToken) error
func WriteApprovedScriptRegistry ¶ added in v1.2.8
func WriteApprovedScriptRegistry(path string, entries []schemagate.ApprovedScriptEntry) error
func WriteBrokerCredentialRecord ¶
func WriteBrokerCredentialRecord(path string, record schemagate.BrokerCredentialRecord) error
func WriteDelegationAuditRecord ¶
func WriteDelegationAuditRecord(path string, record schemagate.DelegationAuditRecord) error
func WriteDelegationToken ¶
func WriteDelegationToken(path string, token schemagate.DelegationToken) error
func WriteKillSwitchState ¶ added in v1.4.0
func WriteKillSwitchState(path string, state schemagate.KillSwitchState) error
func WriteSayToken ¶
func WriteSayToken(path string, token schemavoice.SayToken) error
func WriteTraceRecord ¶
func WriteTraceRecord(path string, trace schemagate.TraceRecord) error
Types ¶
type ApprovalTokenError ¶
func (*ApprovalTokenError) Error ¶
func (e *ApprovalTokenError) Error() string
func (*ApprovalTokenError) Unwrap ¶
func (e *ApprovalTokenError) Unwrap() error
type ApprovalValidationOptions ¶
type ApprovalValidationOptions struct {
Now time.Time
ExpectedIntentDigest string
ExpectedPolicyDigest string
ExpectedDelegationBindingDigest string
RequiredScope []string
TargetCount int
OperationCount int
ExpectedContractFamilyID string
ExpectedContractID string
ExpectedContractRevision int
ExpectedProposalDigest string
ExpectedActivationDigest string
ExpectedTargetScope, ExpectedEnvironmentScope, ExpectedOutcomeScope, ExpectedEffectScope, ExpectedContainmentScope []string
}
type ApprovedScriptMatch ¶ added in v1.2.8
func MatchApprovedScript ¶ added in v1.2.8
func MatchApprovedScript(intent schemagate.IntentRequest, policyDigest string, entries []schemagate.ApprovedScriptEntry, now time.Time) (ApprovedScriptMatch, error)
type BuildApprovalAuditOptions ¶
type BuildApprovalAuditOptions struct {
CreatedAt time.Time
ProducerVersion string
TraceID string
ToolName string
IntentDigest string
PolicyDigest string
RequiredApprovals int
Entries []schemagate.ApprovalAuditEntry
}
type BuildBrokerCredentialRecordOptions ¶
type BuildBrokerCredentialRecordOptions struct {
CreatedAt time.Time
ProducerVersion string
TraceID string
ToolName string
Identity string
Broker string
Reference string
CredentialSource string
CredentialAccessType string
CredentialIssuer string
CredentialSubject string
CredentialOwner string
Scope []string
CredentialRef string
TargetBinding string
RunBinding string
JobBinding string
RequestDigest string
IssuedAt time.Time
ExpiresAt time.Time
TTLSeconds int64
ContractFamilyID string
ContractID string
ContractRevision int
ProposalDigest string
ActivationDigest string
PolicyDigest string
ApprovalTokenDigest string
DelegationDigest string
ExpectedOutcome string
EffectScope, ContainmentScope []string
}
type BuildPolicyExplainOptions ¶ added in v1.4.0
type DataflowPolicy ¶
type DataflowPolicy struct {
Enabled bool `yaml:"enabled"`
TaintedSources []string `yaml:"tainted_sources"`
DestinationKinds []string `yaml:"destination_kinds"`
DestinationValues []string `yaml:"destination_values"`
DestinationOperations []string `yaml:"destination_operations"`
Action string `yaml:"action"`
ReasonCode string `yaml:"reason_code"`
Violation string `yaml:"violation"`
}
type DelegationChainValidationOptions ¶ added in v1.3.3
type DelegationChainValidationResult ¶ added in v1.3.3
type DelegationChainValidationResult struct {
Complete bool
RequiredDelegations int
ValidDelegations int
ValidTokenIDs []string
Entries []schemagate.DelegationAuditEntry
}
func ValidateDelegationChain ¶ added in v1.3.3
func ValidateDelegationChain(delegation *schemagate.IntentDelegation, tokens []schemagate.DelegationToken, publicKey ed25519.PublicKey, opts DelegationChainValidationOptions) (DelegationChainValidationResult, error)
type DelegationTokenError ¶
func (*DelegationTokenError) Error ¶
func (e *DelegationTokenError) Error() string
func (*DelegationTokenError) Unwrap ¶
func (e *DelegationTokenError) Unwrap() error
type DelegationValidationOptions ¶
type DelegationValidationOptions struct {
Now time.Time
ExpectedDelegator string
ExpectedDelegate string
RequiredScope []string
ExpectedIntentDigest string
ExpectedPolicyDigest string
ExpectedContractDigest string
RequiredActionClasses, RequiredTargetScope, RequiredEnvironmentScope, RequiredDataClasses, RequiredNetworkDestinations []string
OperationCount, TargetCount, DescendantDepth int
RequireExactBindings bool
}
type EmitTraceOptions ¶
type EmitTraceOptions struct {
ProducerVersion string
CorrelationID string
ApprovalTokenRef string
DelegationTokenRef string
DelegationReasonCodes []string
LatencyMS float64
ContextSource string
CompositeRiskClass string
ReadinessDigest string
StepVerdicts []schemagate.TraceStepVerdict
PreApproved bool
PatternID string
RegistryReason string
FreezeWindow *schemagate.FreezeWindowDecision
Sandbox *schemagate.SandboxDecision
KillSwitch *schemagate.KillSwitchDecision
BrokerCredentialRef string
BrokerCredentialSource string
BrokerCredentialAccessType string
BrokerCredentialIssuer string
BrokerRequestDigest string
BrokerTargetBinding string
BrokerRunBinding string
BrokerJobBinding string
MCPTrust *schemagate.MCPTrustDecision
SigningPrivateKey ed25519.PrivateKey
TracePath string
}
type EmitTraceResult ¶
type EmitTraceResult struct {
Trace schemagate.TraceRecord
TracePath string
PolicyDigest string
IntentDigest string
}
func EmitSignedTrace ¶
func EmitSignedTrace(policy Policy, intent schemagate.IntentRequest, gateResult schemagate.GateResult, opts EmitTraceOptions) (EmitTraceResult, error)
type EndpointPolicy ¶
type EndpointPolicy struct {
Enabled bool `yaml:"enabled"`
PathAllowlist []string `yaml:"path_allowlist"`
PathDenylist []string `yaml:"path_denylist"`
DomainAllowlist []string `yaml:"domain_allowlist"`
DomainDenylist []string `yaml:"domain_denylist"`
EgressClasses []string `yaml:"egress_classes"`
Action string `yaml:"action"`
DestructiveAction string `yaml:"destructive_action"`
ReasonCode string `yaml:"reason_code"`
Violation string `yaml:"violation"`
}
type EvalOptions ¶
type EvalOptions struct {
ProducerVersion string
WrkrInventory map[string]WrkrToolMetadata
WrkrSource string
VerifiedContextEnvelope *schemacontext.Envelope
EvaluationTime time.Time
ContextEvidenceNow time.Time
KillSwitchState *schemagate.KillSwitchState
KillSwitchStateError error
RequireKillSwitchState bool
}
type EvalOutcome ¶
type EvalOutcome struct {
Result schemagate.GateResult
PreparedIntent schemagate.IntentRequest
MatchedRule string
MinApprovals int
RequireDistinctApprovers bool
RequireBrokerCredential bool
RequireDelegation bool
RequiredDelegationScopes []string
BrokerReference string
BrokerScopes []string
RateLimit RateLimitPolicy
DestructiveBudget RateLimitPolicy
DataflowTriggered bool
Script bool
StepCount int
ScriptHash string
CompositeRiskClass string
StepVerdicts []schemagate.TraceStepVerdict
ContextSource string
PreApproved bool
PatternID string
RegistryReason string
FreezeWindow *schemagate.FreezeWindowDecision
Sandbox *schemagate.SandboxDecision
KillSwitch *schemagate.KillSwitchDecision
MCPTrust *schemagate.MCPTrustDecision
}
func EvaluatePolicyDetailed ¶
func EvaluatePolicyDetailed(policy Policy, intent schemagate.IntentRequest, opts EvalOptions) (EvalOutcome, error)
type FailClosedPolicy ¶
type FreezeWindowPolicy ¶ added in v1.4.0
type FreezeWindowRange ¶ added in v1.4.0
type IntentBrokerBinding ¶ added in v1.4.0
type IntentBrokerBinding struct {
ExpectedCredentialRef string
TargetBinding string
RunBinding string
JobBinding string
ContractFamilyID string
ContractID string
ContractRevision int
ProposalDigest string
ActivationDigest string
PolicyDigest string
ApprovalTokenDigest string
DelegationDigest string
ExpectedOutcome string
EffectScope, ContainmentScope []string
}
type KillSwitchJournalRecord ¶ added in v1.4.0
type KillSwitchJournalRecord struct {
SchemaID string `json:"schema_id"`
SchemaVersion string `json:"schema_version"`
CreatedAt time.Time `json:"created_at"`
ProducerVersion string `json:"producer_version"`
Source string `json:"source"`
TraceID string `json:"trace_id,omitempty"`
JobID string `json:"job_id,omitempty"`
ToolName string `json:"tool_name,omitempty"`
AgentID string `json:"agent_id,omitempty"`
Identity string `json:"identity,omitempty"`
ReasonCodes []string `json:"reason_codes,omitempty"`
MatchedEntryIDs []string `json:"matched_entry_ids,omitempty"`
}
type LegacyPolicyContractError ¶ added in v1.3.3
type LegacyPolicyContractError struct {
Fields []LegacyPolicyFieldMigration
}
func (LegacyPolicyContractError) Error ¶ added in v1.3.3
func (err LegacyPolicyContractError) Error() string
type LegacyPolicyFieldMigration ¶ added in v1.3.3
type LegacyPolicyFieldMigration struct {
Field string `json:"field"`
ReplacementFields []string `json:"replacement_fields,omitempty"`
Note string `json:"note,omitempty"`
}
func LegacyPolicyFieldMigrations ¶ added in v1.3.3
func LegacyPolicyFieldMigrations(fieldNames []string) []LegacyPolicyFieldMigration
type MCPTrustPolicy ¶ added in v1.3.3
type MCPTrustPolicy struct {
Enabled bool `yaml:"enabled"`
SnapshotPath string `yaml:"snapshot"`
Action string `yaml:"action"`
RequiredRiskClasses []string `yaml:"required_risk_classes"`
MinScore float64 `yaml:"min_score"`
MaxAge string `yaml:"max_age"`
PublisherAllowlist []string `yaml:"publisher_allowlist"`
RequireRegistry bool `yaml:"require_registry"`
}
type MintApprovalTokenOptions ¶
type MintApprovalTokenOptions struct {
ProducerVersion string
ApproverIdentity string
ReasonCode string
IntentDigest string
PolicyDigest string
DelegationBindingDigest string
Scope []string
MaxTargets int
MaxOps int
TTL time.Duration
Now time.Time
SigningPrivateKey ed25519.PrivateKey
TokenPath string
ContractFamilyID string
ContractID string
ContractRevision int
ProposalDigest string
ActivationDigest string
TargetScope, EnvironmentScope, OutcomeScope, EffectScope, ContainmentScope []string
}
type MintApprovalTokenResult ¶
type MintApprovalTokenResult struct {
Token schemagate.ApprovalToken
TokenPath string
}
func MintApprovalToken ¶
func MintApprovalToken(opts MintApprovalTokenOptions) (MintApprovalTokenResult, error)
type MintDelegationTokenOptions ¶
type MintDelegationTokenOptions struct {
ProducerVersion string
DelegatorIdentity string
DelegateIdentity string
Scope []string
ScopeClass string
IntentDigest string
PolicyDigest string
TTL time.Duration
Now time.Time
SigningPrivateKey ed25519.PrivateKey
TokenPath string
ActionClasses, TargetScope, EnvironmentScope, DataClasses, NetworkDestinations []string
MaxOperations, MaxTargets, MaxDescendantDepth int
ContractDigest string
ParentTokenID, ParentTokenDigest, OriginAuthorityDigest string
Depth int
}
type MintDelegationTokenResult ¶
type MintDelegationTokenResult struct {
Token schemagate.DelegationToken
TokenPath string
}
func MintDelegationToken ¶
func MintDelegationToken(opts MintDelegationTokenOptions) (MintDelegationTokenResult, error)
type MintSayTokenOptions ¶
type MintSayTokenOptions struct {
ProducerVersion string
CommitmentClass string
IntentDigest string
PolicyDigest string
CallID string
TurnIndex int
CallSeq int
Currency string
QuoteMinCents int64
QuoteMaxCents int64
RefundCeilingCents int64
TTL time.Duration
Now time.Time
SigningPrivateKey ed25519.PrivateKey
TokenPath string
}
type MintSayTokenResult ¶
type MintSayTokenResult struct {
Token schemavoice.SayToken
TokenPath string
}
func MintSayToken ¶
func MintSayToken(opts MintSayTokenOptions) (MintSayTokenResult, error)
type Policy ¶
type Policy struct {
SchemaID string `yaml:"schema_id"`
SchemaVersion string `yaml:"schema_version"`
DefaultVerdict string `yaml:"default_verdict"`
DefaultAction string `yaml:"default_action"`
Scripts ScriptPolicy `yaml:"scripts"`
FailClosed FailClosedPolicy `yaml:"fail_closed"`
MCPTrust MCPTrustPolicy `yaml:"mcp_trust"`
Rules []PolicyRule `yaml:"rules"`
// contains filtered or unexported fields
}
func LoadPolicyFile ¶
func ParsePolicyYAML ¶
type PolicyMatch ¶
type PolicyMatch struct {
ToolName string `yaml:"tool_name"`
ToolNames []string `yaml:"tool_names"`
RiskClasses []string `yaml:"risk_classes"`
TargetKinds []string `yaml:"target_kinds"`
TargetValues []string `yaml:"target_values"`
EndpointClass []string `yaml:"endpoint_class"`
EndpointClasses []string `yaml:"endpoint_classes"`
DiscoveryMethods []string `yaml:"discovery_method"`
ToolAnnotations ToolAnnotationMatch `yaml:"tool_annotations"`
SkillPublishers []string `yaml:"skill_publishers"`
SkillSources []string `yaml:"skill_sources"`
DataClasses []string `yaml:"data_classes"`
DestinationKinds []string `yaml:"destination_kinds"`
DestinationValues []string `yaml:"destination_values"`
DestinationOps []string `yaml:"destination_operations"`
ProvenanceSources []string `yaml:"provenance_sources"`
Identities []string `yaml:"identities"`
WorkspacePrefixes []string `yaml:"workspace_prefixes"`
ContextToolNames []string `yaml:"context_tool_names"`
ContextDataClasses []string `yaml:"context_data_classes"`
ContextEndpointClasses []string `yaml:"context_endpoint_classes"`
ContextAutonomyLevels []string `yaml:"context_autonomy_levels"`
RequireDelegation bool `yaml:"require_delegation"`
AllowedDelegatorIdentities []string `yaml:"allowed_delegator_identities"`
AllowedDelegateIdentities []string `yaml:"allowed_delegate_identities"`
DelegationScopes []string `yaml:"delegation_scopes"`
MaxDelegationDepth *int `yaml:"max_delegation_depth"`
}
type PolicyRule ¶
type PolicyRule struct {
Name string `yaml:"name"`
Priority int `yaml:"priority"`
Effect string `yaml:"effect"`
Action string `yaml:"action"`
Match PolicyMatch `yaml:"match"`
Endpoint EndpointPolicy `yaml:"endpoint"`
ReasonCodes []string `yaml:"reason_codes"`
Violations []string `yaml:"violations"`
RequireDeclaredAgent bool `yaml:"require_declared_agent"`
AllowedAgentIDs []string `yaml:"allowed_agent_ids"`
DeniedAgentIDs []string `yaml:"denied_agent_ids"`
RequiredAgentManifestDigest string `yaml:"required_agent_manifest_digest"`
AllowedAgentManifestPublishers []string `yaml:"allowed_agent_manifest_publishers"`
AllowedAgentManifestSources []string `yaml:"allowed_agent_manifest_sources"`
RequiredAgentLifecycleStates []string `yaml:"required_agent_lifecycle_states"`
RequireAgentOwner bool `yaml:"require_agent_owner"`
RequireUnexpiredAgent bool `yaml:"require_unexpired_agent"`
BlockStandingCredentials bool `yaml:"block_standing_credentials"`
AllowedCredentialSources []string `yaml:"allowed_credential_sources"`
AllowedCredentialIssuers []string `yaml:"allowed_credential_issuers"`
AllowedCredentialAccessTypes []string `yaml:"allowed_credential_access_types"`
MaxCredentialTTLSeconds int64 `yaml:"max_credential_ttl_seconds"`
RequireJITCredential bool `yaml:"require_jit_credential"`
MinApprovals int `yaml:"min_approvals"`
RequireDistinctApprovers bool `yaml:"require_distinct_approvers"`
RequireContextEvidence bool `yaml:"require_context_evidence"`
RequiredContextEvidenceMode string `yaml:"required_context_evidence_mode"`
MaxContextAgeSeconds int64 `yaml:"max_context_age_seconds"`
RequireBrokerCredential bool `yaml:"require_broker_credential"`
BrokerReference string `yaml:"broker_reference"`
BrokerScopes []string `yaml:"broker_scopes"`
FreezeWindow FreezeWindowPolicy `yaml:"freeze_window"`
Sandbox SandboxPolicy `yaml:"sandbox"`
RateLimit RateLimitPolicy `yaml:"rate_limit"`
DestructiveBudget RateLimitPolicy `yaml:"destructive_budget"`
Dataflow DataflowPolicy `yaml:"dataflow"`
}
type RateLimitDecision ¶
type RateLimitDecision struct {
Allowed bool `json:"allowed"`
Limit int `json:"limit"`
Used int `json:"used"`
Remaining int `json:"remaining"`
Scope string `json:"scope"`
Key string `json:"key"`
}
func EnforceRateLimit ¶
func EnforceRateLimit(statePath string, limit RateLimitPolicy, intent schemagate.IntentRequest, now time.Time) (RateLimitDecision, error)
type RateLimitPolicy ¶
type SandboxPolicy ¶ added in v1.4.0
type SandboxPolicy struct {
Enabled bool `yaml:"enabled"`
AllowedNetworkModes []string `yaml:"allowed_network_modes"`
AllowedWritablePathPrefixes []string `yaml:"allowed_writable_path_prefixes"`
RequiredReadOnlyRoots []string `yaml:"required_read_only_roots"`
AllowedEnvExposureModes []string `yaml:"allowed_env_exposure_modes"`
MaxTimeoutSeconds int64 `yaml:"max_timeout_seconds"`
AllowedFilesystemIsolations []string `yaml:"allowed_filesystem_isolations"`
AllowedUserModes []string `yaml:"allowed_user_modes"`
}
type SayTokenError ¶
func (*SayTokenError) Error ¶
func (e *SayTokenError) Error() string
func (*SayTokenError) Unwrap ¶
func (e *SayTokenError) Unwrap() error
type ScriptPolicy ¶ added in v1.2.8
type ToolAnnotationMatch ¶ added in v1.2.9
type WrkrInventory ¶ added in v1.2.8
type WrkrInventory struct {
Path string
ModTime time.Time
Tools map[string]WrkrToolMetadata
}
func LoadWrkrInventory ¶ added in v1.2.8
func LoadWrkrInventory(path string) (WrkrInventory, error)
Source Files
¶
- agent_identity.go
- approval.go
- approval_audit.go
- approved_scripts.go
- broker_receipt.go
- context_evidence.go
- context_wrkr.go
- credential_evidence.go
- credential_policy.go
- delegation.go
- delegation_audit.go
- evaluate.go
- explain.go
- freeze_window.go
- intent.go
- kill_switch.go
- policy.go
- policy_migration.go
- rate_limit.go
- relationship.go
- sandbox_policy.go
- token_io.go
- trace.go
- voice.go
Click to show internal directories.
Click to hide internal directories.