Contracts (the shared language): - percept / state / context / utterance / render / audio / capabilities - Capability model instead of vendor schemas (see below) Providers (capability-based abstraction): - LLM + Embedding: OpenAI-compatible shape IS the standard, adopted directly - ASR: internal contract is an event stream (partial -> final), because /v1/audio/transcriptions has no partial and dialogue needs it for endpointing. OpenAI adapter degrades to supports_partial=False. - TTS: internal contract carries tags/emotion/style, because /v1/audio/speech has no paralinguistics and [laughter]/[breath] are the core of feeling alive. Unsupported providers are stripped AND reported via Degradation -- silent degradation is forbidden. - Avatar: no de-facto standard, custom RenderCmd protocol driven by State. Core: - mood: dynamical system, slow variables, negativity bias (grudge), numbing after prolonged negativity - bazi: four pillars -> numeric vector; 'ming' is data, not prose - projection: phi, system event -> in-world statement; uncovered events are counted as projection gaps Storage: - SQLite schema, three memory layers, dyad ledger - accessibility floor 0.03 (not 0): forgettable but still there Config split: - models.yaml is the ONLY place model versions live - character.yaml holds world rules / emotion params, no version numbers 58 tests pass; ruff clean.
90 lines
1.7 KiB
Python
90 lines
1.7 KiB
Python
"""数据契约层。
|
|
|
|
全项目唯一的共同语言。任何跨层通信都只通过这里定义的结构。
|
|
每层内部实现可换,契约不变。
|
|
|
|
设计原则:
|
|
1. 契约按「能力与语义」建模,不按某个厂商的 schema 建模
|
|
2. 所有结构 frozen/slots,避免下游意外修改
|
|
3. 降级必须显式(Degradation),不允许静默
|
|
"""
|
|
|
|
from .audio import (
|
|
PCM16_16K,
|
|
PCM16_48K,
|
|
VAD_RATE,
|
|
AudioChunk,
|
|
AudioFormat,
|
|
AudioFrameStats,
|
|
)
|
|
from .capabilities import Capabilities, Degradation, HealthStatus, Modality, Streaming
|
|
from .context import (
|
|
ContextBundle,
|
|
DyadBlock,
|
|
LifeBlock,
|
|
MemoryBlock,
|
|
OntologyBlock,
|
|
TurnBlock,
|
|
)
|
|
from .percept import (
|
|
ParaEmotion,
|
|
ParaEvent,
|
|
Paralinguistics,
|
|
Percept,
|
|
PerceptKind,
|
|
)
|
|
from .render import Expression, Posture, RenderCmd, RenderType
|
|
from .state import Presence, State, StateBlock, Trend
|
|
from .utterance import (
|
|
LLMDelta,
|
|
LLMMessage,
|
|
LLMResponse,
|
|
SpeechTag,
|
|
Utterance,
|
|
)
|
|
|
|
__all__ = [
|
|
# audio
|
|
"AudioChunk",
|
|
"AudioFormat",
|
|
"AudioFrameStats",
|
|
"PCM16_16K",
|
|
"PCM16_48K",
|
|
"VAD_RATE",
|
|
# capabilities
|
|
"Capabilities",
|
|
"Degradation",
|
|
"HealthStatus",
|
|
"Modality",
|
|
"Streaming",
|
|
# context
|
|
"ContextBundle",
|
|
"DyadBlock",
|
|
"LifeBlock",
|
|
"MemoryBlock",
|
|
"OntologyBlock",
|
|
"TurnBlock",
|
|
# percept
|
|
"ParaEmotion",
|
|
"ParaEvent",
|
|
"Paralinguistics",
|
|
"Percept",
|
|
"PerceptKind",
|
|
# render
|
|
"Expression",
|
|
"Posture",
|
|
"RenderCmd",
|
|
"RenderType",
|
|
# state
|
|
"Presence",
|
|
"State",
|
|
"StateBlock",
|
|
"Trend",
|
|
# utterance
|
|
"LLMDelta",
|
|
"LLMMessage",
|
|
"LLMResponse",
|
|
"SpeechTag",
|
|
"Utterance",
|
|
]
|