Major additions: - Community Next.js app (port 18187) for browsing claims with API docs - stemedb-chaos crate: Fault injection, chaos testing, CRDT properties - Latent ingestion system: Reddit/FDA ingesters with ADK-Go agents - Disputed claims handling: Manual review workflows and validation - Aphoria security scanner: New extractors (SQL injection, command injection, weak crypto, TLS version), policy-based ignores, UAT reports - Docker infrastructure: Dockerfile, docker-compose.yml for full stack - VulnBank demo: Intentionally vulnerable multi-language test corpus SDK & API enhancements: - Source registry handlers for tracking data provenance - Metrics endpoint - Skeptic filtering improvements Code quality: - Split 14 large files (>500 lines) into focused modules - All files now under 500-line limit per project guidelines Documentation: - Chaos testing guide, circuit breakers, observability docs - Phase 7 UAT documentation updates - Martin Kleppmann technical writer agent Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
70 lines
2.0 KiB
Go
70 lines
2.0 KiB
Go
// Package steme provides a Go SDK for StemeDB, a probabilistic knowledge graph
|
|
// that stores Claims, not Facts.
|
|
//
|
|
// StemeDB is an append-only Merkle DAG with read-time conflict resolution via
|
|
// Lenses. Think "Git for Truth" - conflicting assertions coexist and are
|
|
// resolved at query time.
|
|
//
|
|
// # Quick Start
|
|
//
|
|
// Create a signer and client:
|
|
//
|
|
// signer, err := steme.GenerateSigner()
|
|
// if err != nil {
|
|
// log.Fatal(err)
|
|
// }
|
|
// client := steme.NewClient("http://localhost:18180", signer)
|
|
//
|
|
// Build and submit an assertion:
|
|
//
|
|
// assertion := steme.NewAssertion("Tesla_Inc", "has_revenue").
|
|
// WithNumber(96.7).
|
|
// WithConfidence(0.95).
|
|
// WithSourceHash("0000...64 hex chars...").
|
|
// Build()
|
|
//
|
|
// hash, err := client.Assert(context.Background(), assertion)
|
|
//
|
|
// Query with lens-based conflict resolution:
|
|
//
|
|
// params := steme.NewQuery().
|
|
// WithSubject("Tesla_Inc").
|
|
// WithLens(steme.LensConsensus).
|
|
// Build()
|
|
// result, err := client.Query(context.Background(), params)
|
|
//
|
|
// # Lenses
|
|
//
|
|
// StemeDB resolves conflicts at query time using Lenses:
|
|
// - Recency: Latest timestamp wins
|
|
// - Consensus: Most common value wins
|
|
// - Authority: Weighted by agent reputation
|
|
// - VoteAwareConsensus: Highest vote weight
|
|
// - TrustAwareAuthority: Weighted by TrustRank
|
|
//
|
|
// # Security
|
|
//
|
|
// All assertions are cryptographically signed using Ed25519. The SDK
|
|
// automatically signs assertions when you call client.Assert().
|
|
//
|
|
// Never commit private key seeds to version control. Use environment
|
|
// variables or secret management:
|
|
//
|
|
// signer, err := steme.SignerFromEnv("STEME_PRIVATE_KEY")
|
|
//
|
|
// # Error Handling
|
|
//
|
|
// The SDK uses sentinel errors for common cases:
|
|
//
|
|
// if errors.Is(err, steme.ErrInvalidConfidence) {
|
|
// // handle validation error
|
|
// }
|
|
//
|
|
// API errors provide structured information:
|
|
//
|
|
// var apiErr *steme.APIError
|
|
// if errors.As(err, &apiErr) {
|
|
// log.Printf("API error [%d]: %s", apiErr.StatusCode, apiErr.Message)
|
|
// }
|
|
package steme
|