stemedb/sdk/go/steme/errors.go
jordan 1ce4004807 feat: Complete Phase 2 (The Cortex) - query, lens, and API layers
This commit adds the read path (Cortex) to complement the write path (Spine):

## Crates
- stemedb-api: HTTP API with axum + utoipa OpenAPI
  - /v1/assert, /v1/query, /v1/epoch, /v1/skeptic, /v1/trace, /v1/audit
  - Metered endpoints with quota enforcement
  - Ed25519 signature verification
- stemedb-lens: Truth resolution lenses
  - RecencyLens, ConsensusLens, ConfidenceLens
  - VoteAwareConsensusLens (Ballot Box pattern)
  - TrustAwareAuthorityLens (The Hive pattern)
  - SkepticLens (conflict analysis)
  - EpochAwareLens (paradigm-safe queries)
- stemedb-query: Query engine with materialized views

## Storage Extensions
- VoteStore: Vote aggregation with cached counts
- TrustRankStore: Agent reputation with decay
- AuditStore: Query audit trail
- IndexStore: SP/P/S index structures
- SupersessionStore: Epoch supersession chains

## SDKs
- sdk/go/steme: Go HTTP client with Ed25519 signing
- sdk/go/adk: ADK-Go tools for AI agents

## Documentation
- Updated CLAUDE.md, architecture.md, roadmap.md
- New ai-lookup entries for all services
- Use case docs for consumer health intelligence
- Arena roadmap for simulation advancement

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 13:22:44 -07:00

54 lines
1.6 KiB
Go

package steme
import (
"errors"
"fmt"
)
var (
// ErrInvalidKeySize indicates the private key is not 32 bytes
ErrInvalidKeySize = errors.New("steme: private key must be exactly 32 bytes")
// ErrInvalidPublicKeySize indicates the public key is not 32 bytes
ErrInvalidPublicKeySize = errors.New("steme: public key must be exactly 32 bytes")
// ErrInvalidSignatureSize indicates the signature is not 64 bytes
ErrInvalidSignatureSize = errors.New("steme: signature must be exactly 64 bytes")
// ErrInvalidHashSize indicates a hash is not 32 bytes
ErrInvalidHashSize = errors.New("steme: hash must be exactly 32 bytes")
// ErrMissingSignatures indicates no signatures were provided
ErrMissingSignatures = errors.New("steme: at least one signature is required")
// ErrInvalidConfidence indicates confidence is not in [0.0, 1.0]
ErrInvalidConfidence = errors.New("steme: confidence must be between 0.0 and 1.0")
// ErrInvalidHex indicates hex decoding failed
ErrInvalidHex = errors.New("steme: invalid hex encoding")
// ErrNoWinner indicates lens failed to resolve a winner
ErrNoWinner = errors.New("steme: lens did not resolve a winner")
)
// APIError wraps HTTP API errors with status code and message.
type APIError struct {
StatusCode int
Code string
Message string
}
func (e *APIError) Error() string {
return fmt.Sprintf("steme API error [%d]: %s - %s", e.StatusCode, e.Code, e.Message)
}
// ValidationError indicates a request validation failure.
type ValidationError struct {
Field string
Message string
}
func (e *ValidationError) Error() string {
return fmt.Sprintf("steme validation error: %s - %s", e.Field, e.Message)
}