First crate of the Pet UI v1 line (feat/pet-ui-v1 branch). Ships: ## Schema (src/schema.rs — 213 LOC) Strongly-typed `PetManifest` covering: - identity (pet_name, user_name, addressing, languages) - voice (tone primary/secondary, humor style + frequency) - edge (profanity, directness, initiative) - appearance (base_shape, size, colours, eyes, expression, accessories) - room (theme, lighting, decor, time_sync) - privacy (public_profile, publish_allowed, share_dreams, share_garden) - interests[] (topic, depth, freshness, vault_path, last_refresh) - routines[] (kind, schedule, template, enabled) - forbidden (topics, tone_patterns) - meta (schema version, timestamps, tune_count) All enums serde-renamed to kebab-case for TOML-native feel. ## Validation (src/validate.rs — 180 LOC) 19-rule validator (R1–R19 per earlier spec). Errors **accumulate** — single validate() call surfaces every issue, not just the first. Covers: - schema version (R1) - name bounds (R2, R2) - languages ISO-639-1 (R4) - tone_secondary cardinality + no-primary-dup (R6) - profanity/language consistency (R10) - interest topic slug-safety (R12) - interest/forbidden contradiction (R14) - schedule grammar: HH:MM, dow-HH:MM, every-Nh, no-commit-for-Nh, N-errors-in-N-calls (R16) - empty-string guards (R18) - ISO-8601 timestamps (R19) - hex-colour sanity on appearance ## Overlay rendering (src/overlay.rs — 128 LOC) Pure function `system_prompt(&PetManifest) -> String`. Deterministic — same manifest → same bytes. Used as prompt-prefix by the runtime at spawn time. ## Identity (src/identity.rs — 117 LOC incl. 5 unit tests) Standard Ed25519 (RFC 8032) via ed25519-dalek. `user_id` = first 16 hex chars of blake3(public_key) — deterministic, 64-bit, URL-safe. Hex-string API for cross-boundary verify. No proprietary crypto, no matrix math. ## CLI (src/bin/kei-pet.rs — 110 LOC) - `kei-pet validate <path>` — parse + run R1–R19 - `kei-pet show <path>` — print rendered overlay - `kei-pet identity new` — generate + store ~/.keisei/identity.key (0600) - `kei-pet identity show` — print public key + user_id - `kei-pet tune` stub (Day 2 — /pet-tune skill lands full implementation) ## Tests - 23/23 integration (tests/validation_tests.rs) — one rejector per rule + accept cases for examples/minimal.toml and examples/full.toml + overlay smoke + multi-error accumulation guard - 5/5 unit (identity module) — keypair roundtrip, user_id determinism, sign/verify, hex API boundary - cargo test -p kei-pet --release: all green ## Examples - examples/minimal.toml — smallest valid manifest - examples/full.toml — every optional section populated ## Scope boundary (enforced by in-file doc comment in lib.rs) NO imports, references, or conceptual mentions of sibling research-grade IP. Identity is standard Ed25519. Cache/projection is standard CQRS. This crate ships as a clean MIT-licensable unit of the KeiSeiKit public surface. Day 2: /pet-setup 7-phase wizard skill that drives this crate via the CLI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
90 lines
2 KiB
TOML
90 lines
2 KiB
TOML
# Full pet.toml — every optional section populated.
|
|
|
|
schema = 1
|
|
|
|
[identity]
|
|
pet_name = "Kei"
|
|
user_name = "Denis"
|
|
addressing = "by-name"
|
|
languages = ["ru", "en"]
|
|
|
|
[voice]
|
|
tone_primary = "dry"
|
|
tone_secondary = ["supportive"]
|
|
humor_style = "dark+meta"
|
|
humor_frequency = "medium"
|
|
|
|
[edge]
|
|
profanity = "mirror-user"
|
|
profanity_languages = ["ru"]
|
|
directness = "hard"
|
|
initiative = "tap-on-shoulder"
|
|
|
|
[appearance]
|
|
base_shape = "cat"
|
|
size = "small"
|
|
color_primary = "#8B4513"
|
|
color_secondary = "#FFD700"
|
|
eyes = "round"
|
|
expression = "focused"
|
|
accessories = ["glasses", "laptop"]
|
|
|
|
[room]
|
|
theme = "study"
|
|
lighting = "warm"
|
|
decor = ["desk", "bookshelf", "window-forest", "plant"]
|
|
time_sync = true
|
|
|
|
[privacy]
|
|
public_profile = true
|
|
publish_allowed = true
|
|
share_dreams = false
|
|
share_garden = "summary"
|
|
|
|
[[interests]]
|
|
topic = "distributed-systems"
|
|
depth = "expert"
|
|
freshness = "weekly"
|
|
vault_path = "memory/interests/distributed-systems"
|
|
last_refresh = ""
|
|
|
|
[[interests]]
|
|
topic = "rust-async-runtimes"
|
|
depth = "expert"
|
|
freshness = "daily"
|
|
vault_path = "memory/interests/rust-async-runtimes"
|
|
last_refresh = ""
|
|
|
|
[[routines]]
|
|
kind = "morning-digest"
|
|
schedule = "09:00"
|
|
template = "pet-routine-morning"
|
|
enabled = true
|
|
|
|
[[routines]]
|
|
kind = "evening-recap"
|
|
schedule = "19:00"
|
|
template = "pet-routine-evening"
|
|
enabled = true
|
|
|
|
[[routines]]
|
|
kind = "weekly-deepdive"
|
|
schedule = "sun-10:00"
|
|
template = "pet-routine-weekly"
|
|
enabled = true
|
|
|
|
[[routines]]
|
|
kind = "idle-check"
|
|
schedule = "no-commit-for-3h"
|
|
template = "pet-routine-idle-nudge"
|
|
enabled = true
|
|
|
|
[forbidden]
|
|
topics = ["politics", "crypto-hype"]
|
|
tone_patterns = ["motivational-platitudes", "empty-affirmations"]
|
|
|
|
[meta]
|
|
schema_version_written_by = "kei-pet 0.1.0"
|
|
created_at = "2026-04-23T12:30:00Z"
|
|
last_tuned = "2026-04-23T12:30:00Z"
|
|
tune_count = 0
|